
问题详细描述如下: 1. 我使用的是F767的主芯片,使用了ST的USB库; 2. 我USB的配置描述符如下: __ALIGN_BEGIN static uint8_tUSBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END = { 0x09, /* bLength: Configuration Descriptor size */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /*bDescriptorType: Configuration */ USB_HID_CONFIG_DESC_SIZ, /* wTotalLength: Bytes returned */ 0x00, 0x01, /*bNumInterfaces: 1interface*/ 0x01, /*bConfigurationValue:Configuration value*/ 0x00, /*iConfiguration: Index of string descriptor describing the configuration*/ 0xE0, /*bmAttributes: buspowered and Support Remote Wake-up */ 0x32, /*MaxPower 100 mA: thiscurrent is used for detecting Vbus*/ /************** Descriptor of Joystick Mouseinterface ****************/ /* 09 */ 0x09, /*bLength: InterfaceDescriptor size*/ USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType:Interface descriptor type*/ 0x00, /*bInterfaceNumber:Number of Interface*/ 0x00, /*bAlternateSetting:Alternate setting*/ 0x04, /*bNumEndpoints*/ 0x00, /*bInterfaceClass: HID*/ 0x00, /*bInterfaceSubClass :1=BOOT, 0=no boot*/ 0x00, /*nInterfaceProtocol :0=none, 1=keyboard, 2=mouse*/ 0, /*iInterface: Index of string descriptor*/ /******************** Descriptor of Mouse endpoint********************/ /* 18 */ 0x07, /*bLength: EndpointDescriptor size*/ USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ HID_IN_EP, /*bEndpointAddress: Endpoint Address (IN)*/ 0x03, /*bmAttributes:Interrupt endpoint*/ HID_IN_PACKET, /*wMaxPacketSize: 4 Byte max */ 0x00, 0x0A, /*bInterval: PollingInterval (10 ms)*/ /******************** Descriptor of Mouse endpoint********************/ /* 25 */ 0x07, /*bLength: Endpoint Descriptor size*/ USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ HID_OUT_EP, /*bEndpointAddress: Endpoint Address (IN)*/ 0x03, /*bmAttributes:Interrupt endpoint*/ HID_IN_PACKET, /*wMaxPacketSize: 4 Byte max */ 0x00, 0x0A, /*bInterval ![]() /******************** Descriptor of Mouse endpoint********************/ /* 32 */ 0x07, /*bLength: EndpointDescriptor size*/ USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ HID_IN_BULK_EP, /*bEndpointAddress: Endpoint Address (IN)*/ 0x02, /*bmAttributes:bulk endpoint*/ HID_IN_BULK_PACKET, /*wMaxPacketSize: 64 Byte max*/ 0x00, 0x0A, /*bInterval ![]() /******************** Descriptor of Mouse endpoint********************/ /* 39 */ 0x07, /*bLength: EndpointDescriptor size*/ USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ HID_OUT_BULK_EP, /*bEndpointAddress: Endpoint Address (OUT)*/ 0x02, /*bmAttributes:bulk endpoint*/ HID_OUT_BULK_PACKET, /*wMaxPacketSize: 64 Byte max*/ 0x00, 0x0A, /*bInterval ![]() /* 46 */ } ; 3. 插入USB端口后,STM32端的打印信息: USBD_StdDevReq,req=0x80, request=0x6, value=0x100, index=0x0, len=0x12 USBD_GetDescriptor,len=18 USBD_StdDevReq,req=0x80, request=0x6, value=0x200, index=0x0, len=0x9 USBD_HID_GetCfgDesc USBD_GetDescriptor,len=9 USBD_StdDevReq,req=0x80, request=0x6, value=0x200, index=0x0, len=0x2e USBD_HID_GetCfgDesc è这里是获取配置描述符 USBD_GetDescriptor,len=46 è打印显示配置描述符的长度是46字节 USBD_StdDevReq,req=0x0, request=0x9, value=0x0, index=0x0, len=0x0 对应的函数如下: staticvoid USBD_GetDescriptor(USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ*req) 函数内容见1.jpg; 4. 在PC端观察到的数据传输如下: 见附件 Bus Hound.jpg 图片。 PC请求0x2e长度的描述符,但STM32只发送了32字节的数据。这个可能是什么原因呢? |
STM32F105 USB HID RCC設定
stm32 USB的CDC类传输掉数据
STM32F105 USB接收数据不断进入中断,出现“死机”现象
ST的hal库有问题手头有STM32L4或STM32F7的帮忙测试DMA SD卡
关于STM32CubeMX配置的USB例程电脑无法识别问题
STM32F756 DCMI +GC0308 Camera图片不正常
STM32F407 USB-HS-OTG是否不外接PHY可以做虚拟串口?
如何做一个USB从机键盘用stm32f407
用STM32F4 Cube MX生成的USB Device C代码的BUG
USB Device + FatFS + SDIO 模拟U盘意外只读问题
评分
查看全部评分
评分
查看全部评分
1、楼主有CDC的工程吗?我直接用cube生成的一直在PC端显示设备无法正常运行。
2、怎么用bus hound抓取usb设备则插入电脑时的通信数据。
谢谢!
1、楼主有CDC的工程吗?我直接用cube生成的一直在PC端显示设备无法正常运行。
2、怎么用bus hound抓取usb设备则插入电脑时的通信数据。
谢谢!