嵌入式技术论坛
直播中

马占云

7年用户 1497经验值
私信 关注
[问答]

stm32103VB tinyusb使用异常,无法识别描述符是为什么?

尝试STM32F103VB上使用tinyusb,完成配置之后开始没有反应。调试后发现

这个上拉电阻的实现需要手动实现控制:

dcd_disconnectdcd_connect

之后调试发现设备还是无法识别:

之后打开TinyUSB的调试日志
#define CFG_TUSB_DEBUG 3
之后上电出现调试信息:
msh >USBD Bus Reset : Full Speed
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2A 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2B 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2C 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2D 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Suspend : Remote Wakeup = 0
从调试信息上看,有获取设备描述符的指令执行
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
此指令确实是有执行的,于是使用逻辑分析仪抓取USB数据

可以看到获取设备描述符的指令,在附近查找相关指令回复
展开回复:
看到设备也是有回复的
但是这个设备就是无法识别!
后面多抓取一些数据,发现,只是第一次有回应,后面的多次发送都没有回应



好像确实是没有回应PC的获取设备描述符,但是既然能回应一次,为何后面的数据就发送不出来了?
我的配置参数如下:
#define PKG_USING_TINYUSB
#define PKG_TINYUSB_STACK_SIZE 2048
#define PKG_TINYUSB_THREAD_PRIORITY 8
#define PKG_TINYUSB_MEM_SECTION ".data"
#define PKG_TINYUSB_MEM_ALIGN 4
#define PKG_TINYUSB_RHPORT_NUM_1
#define PKG_TINYUSB_RHPORT_NUM 0
#define PKG_TINYUSB_FULL_SPEED
#define PKG_TINYUSB_DEVICE_PORT_SPEED 0x00
#define PKG_TINYUSB_DEVICE_ENABLE
#define PKG_TINYUSB_DEVICE_VID 0x0483
#define PKG_TINYUSB_DEVICE_PID 0x5A4F
#define PKG_TINYUSB_DEVICE_MANUFACTURER "RP552D"
#define PKG_TINYUSB_DEVICE_PRODUCT "NL_v6.x.x"
#define PKG_TINYUSB_EDPT0_SIZE 64
#define PKG_TINYUSB_DEVICE_CURRENT 500
#define PKG_TINYUSB_DEVICE_HID
#define CFG_TUD_HID 1
#define PKG_TINYUSB_DEVICE_HID_STRING "RP552D_NL_v6.x.x"
#define PKG_TINYUSB_DEVICE_HID_EPNUM 4
#define PKG_TINYUSB_DEVICE_HID_INT 1
#define PKG_TINYUSB_DEVICE_HID_KEYBOARD
#define PKG_TINYUSB_DEVICE_HID_MOUSE
#define PKG_TINYUSB_DEVICE_HID_CONSUMER
#define PKG_TINYUSB_DEVICE_HID_EP_BUFSIZE 64
#define PKG_TINYUSB_DEVICE_EXAMPLE
#define PKG_TINYUSB_DEVICE_EXAMPLE_HID
#define PKG_TINYUSB_DEBUG_ERROR
#define CFG_TUSB_DEBUG 1
#define PKG_USING_TINYUSB_V01300

回帖(2)

h1654155275.5741

2022-5-30 11:08:34
尝试STM32F103VB上使用tinyusb,完成配置之后开始没有反应。调试后发现
[img]https://oss-club.rt-thread.org/uploads/20220527/b5e525821e315efd3f78425dd13fd9e3.png[/img]
这个上拉电阻的实现需要手动实现控制:

dcd_disconnectdcd_connect
[img]https://oss-club.rt-thread.org/uploads/20220527/2247da43e8023adf485fb02ae2fbb952.png[/img]
之后调试发现设备还是无法识别:
[img]https://oss-club.rt-thread.org/uploads/20220527/37edf44a84cc779462b82ae3542dfa28.png[/img]
之后打开TinyUSB的调试日志
#define CFG_TUSB_DEBUG 3
之后上电出现调试信息:
msh >USBD Bus Reset : Full Speed
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2A 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2B 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2C 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed
USBD Setup Received 00 05 2D 00 00 00 00 00
  Set Address
USBD Xfer Complete on EP 80 with 0 bytes
USBD Suspend : Remote Wakeup = 0
从调试信息上看,有获取设备描述符的指令执行
USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
此指令确实是有执行的,于是使用逻辑分析仪抓取USB数据
[img]https://oss-club.rt-thread.org/uploads/20220527/e5aadc4b527e820aa9600e0c781aa3f7.png.webp[/img]
可以看到获取设备描述符的指令,在附近查找相关指令回复
[img]https://oss-club.rt-thread.org/uploads/20220527/0ae4b837431e8a2cba1acfa845d83f98.png.webp[/img] 展开回复:
[img]https://oss-club.rt-thread.org/uploads/20220527/3e7d574e212fd45a29b0244a96f6b7af.png.webp[/img] 看到设备也是有回复的
但是这个设备就是无法识别!
后面多抓取一些数据,发现,只是第一次有回应,后面的多次发送都没有回应
[img]https://oss-club.rt-thread.org/uploads/20220527/ad04cc19d6c8cfba752eea940086663c.png.webp[/img]
[img]https://oss-club.rt-thread.org/uploads/20220527/59377ac338697c8fed074efb060de71e.png.webp[/img]
[img]https://oss-club.rt-thread.org/uploads/20220527/4219d8085045c0f9a242d3dc9ea2be08.png.webp[/img]
好像确实是没有回应PC的获取设备描述符,但是既然能回应一次,为何后面的数据就发送不出来了?
我的配置参数如下:
#define PKG_USING_TINYUSB
#define PKG_TINYUSB_STACK_SIZE 2048
#define PKG_TINYUSB_THREAD_PRIORITY 8
#define PKG_TINYUSB_MEM_SECTION ".data"
#define PKG_TINYUSB_MEM_ALIGN 4
#define PKG_TINYUSB_RHPORT_NUM_1
#define PKG_TINYUSB_RHPORT_NUM 0
#define PKG_TINYUSB_FULL_SPEED
#define PKG_TINYUSB_DEVICE_PORT_SPEED 0x00
#define PKG_TINYUSB_DEVICE_ENABLE
#define PKG_TINYUSB_DEVICE_VID 0x0483
#define PKG_TINYUSB_DEVICE_PID 0x5A4F
#define PKG_TINYUSB_DEVICE_MANUFACTURER "RP552D"
#define PKG_TINYUSB_DEVICE_PRODUCT "NL_v6.x.x"
#define PKG_TINYUSB_EDPT0_SIZE 64
#define PKG_TINYUSB_DEVICE_CURRENT 500
#define PKG_TINYUSB_DEVICE_HID
#define CFG_TUD_HID 1
#define PKG_TINYUSB_DEVICE_HID_STRING "RP552D_NL_v6.x.x"
#define PKG_TINYUSB_DEVICE_HID_EPNUM 4
#define PKG_TINYUSB_DEVICE_HID_INT 1
#define PKG_TINYUSB_DEVICE_HID_KEYBOARD
#define PKG_TINYUSB_DEVICE_HID_MOUSE
#define PKG_TINYUSB_DEVICE_HID_CONSUMER
#define PKG_TINYUSB_DEVICE_HID_EP_BUFSIZE 64
#define PKG_TINYUSB_DEVICE_EXAMPLE
#define PKG_TINYUSB_DEVICE_EXAMPLE_HID
#define PKG_TINYUSB_DEBUG_ERROR
#define CFG_TUSB_DEBUG 1
#define PKG_USING_TINYUSB_V01300

举报

陈敏

2022-5-30 11:08:47
我用官方的usb设备也是无法识别
举报

更多回帖

发帖
×
20
完善资料,
赚取积分