尝试
STM32F103VB上使用
tinyusb,完成配置之后开始没有反应。调试后发现
![]()
这个上拉电阻的实现需要手动实现控制:
dcd_disconnect
dcd_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
原作者:懒洋洋