最近使用f4cube V1.5开发VCP驱动,按照F429-Discovery板子的配置选择OTG-HS接口作为Device设备来用,选择CDC协议。修改完APP_RX_DATA_SIZE和APP_TX_DATA_SIZE为2048,添加LineCoding代码。可是连接到计算机上,装完驱动(VCP V1.4)之后显示错误代码10的故障。计算机业换过win764/32位的。所以估计是代码的错误,使用USB VIEW观测之后,效果如下: Device Descriptor: bcdUSB: 0x0200 bDeviceClass: 0x00 bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x40 (64) idVendor: 0x0483 (STMicroelectronics) idProduct: 0x5740 bcdDevice: 0x0200 iManufacturer: 0x01 0x0409: "STMicroelectronics" iProduct: 0x02 0x0409: "STM32 Virtual ComPort" iSerialNumber: 0x03 0x0409: "000000002B1A" bNumConfigurations: 0x01 ConnectionStatus: DeviceConnected Current Config Value: 0x00 Device Bus Speed: Full Device Address: 0x03 Open Pipes: 0 Configuration Descriptor: wTotalLength: 0x0043 bNumInterfaces: 0x02 bConfigurationValue: 0x01 iConfiguration: 0x00 bmAttributes: 0xC0 (Bus Powered Self Powered ) MaxPower: 0x32 (100 Ma) Interface Descriptor: bInterfaceNumber: 0x00 bAlternateSetting: 0x00 bNumEndpoints: 0x01 bInterfaceClass: 0x02 bInterfaceSubClass: 0x02 bInterfaceProtocol: 0x01 iInterface: 0x00 Unknown Descriptor: bDescriptorType: 0x24 bLength: 0x05 05 24 00 10 01 Unknown Descriptor: bDescriptorType: 0x24 bLength: 0x05 05 24 01 00 01 Unknown Descriptor: bDescriptorType: 0x24 bLength: 0x04 04 24 02 02 Unknown Descriptor: bDescriptorType: 0x24 bLength: 0x05 05 24 06 00 01 Endpoint Descriptor: bEndpointAddress: 0x82 IN Transfer Type: Interrupt wMaxPacketSize: 0x0008 (8) bInterval: 0x10 Interface Descriptor: bInterfaceNumber: 0x01 bAlternateSetting: 0x00 bNumEndpoints: 0x02 bInterfaceClass: 0x0A bInterfaceSubClass: 0x00 bInterfaceProtocol: 0x00 iInterface: 0x00 Endpoint Descriptor: bEndpointAddress: 0x01 OUT Transfer Type: Bulk wMaxPacketSize: 0x0040 (64) bInterval: 0x00 Endpoint Descriptor: bEndpointAddress: 0x81 IN Transfer Type: Bulk wMaxPacketSize: 0x0040 (64) bInterval: 0x00 观察发现枚举应该没有问题,可是端点没有打开。不知何故? |
%DESCRIPTION%=DriverInstall,USB\VID_0483& PID_5740
和我用USB VIEW看到的一样。
无助呀,
网站是: http://stm32f4-discovery.com/
我需要用usb view再观察一下,然后排查一下cube生成的代码还需要做什么工作。我看cube的那个um1734看了一两天,也没看明白流程。杯具呀!
下面是用usb view得出的数据:
Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0483 (STMicroelectronics)
idProduct: 0x5740
bcdDevice: 0x0200
iManufacturer: 0x01
0x0409: "STMicroelectronics"
iProduct: 0x02
0x0409: "STM32 Virtual ComPort in FS Mode"
iSerialNumber: 0x03
0x0409: "00000000050C"
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x03
Open Pipes: 3
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x10
Endpoint Descriptor:
bEndpointAddress: 0x01 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Configuration Descriptor:
wTotalLength: 0x0043
bNumInterfaces: 0x02
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0xC0 (Bus Powered Self Powered )
MaxPower: 0x32 (100 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x01
iInterface: 0x00
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x05
05 24 00 10 01
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x05
05 24 01 00 01
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x04
04 24 02 02
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x05
05 24 06 00 01
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x10
Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x01 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
顺便吐槽一下cube库中F4/429-discovery没有USB Device的例程,F4X9的例程似乎也不适用。
我的F429使用的是标准库里面的USB CDC 驱动,比这个HAL好理解些,这个HAL的USB代码太复杂了