如题,三个usb的例子都无法工作均保存这个usb设备工作不正常
用的是官方的103VC mini开发板,跳线帽默认全插(usart选择是usart1),烧录都没问题,日志都一样
usb线我用别的开发板测试工作正常
使用相同cmake脚本编译了GPIO 反转,SysTick_TimeBase,USART1,这三个工作都正常
代码我是一个bit都没改
debug模式步进到最后是USBD_EnableInterrupt(int)宏触发的硬件错误进死循环,三个usb的例子都是这样
我是菜鸡,一点都看不懂,更别说修了
最后是执行这个宏前后USBD寄存器状态
(如果图片太小看不清,右键图片新标签页打开,看原始尺寸图像)




usb hid mouse 报错截图

usb_MSC_Disk_1

stlink日志:
[0mxPack Open On-Chip Debugger 0.12.0+dev-ga7e118aeb-dirty (2025-04-08-08:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'tcl port' not 'tcl_port'
DEPRECATED! use 'gdb port', not 'gdb_port'
DEPRECATED! use 'tcl por[0mt' not 'tcl_port'
Info : STLINK V2J45S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 0.014220
Error: target voltage may be too low for reliable debugging
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x2ba01477
Info : [apm32f1x.cpu] Cortex-M3 r2p1 processor detected
Info : [apm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : [apm32f1x.cpu] Examination succeed
Info : [apm32f1x.cpu] gdb port disabled
[apm32f1x.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08000528 msp: 0x20010000
** Programming Started **
Info : device id = 0x10036414
Info : flash size = 256 KiB
Warn : Adding extra erase range, 0x0800177c .. 0x080017ff
** Programming Finished **
shutdown command invoked
debug追踪过程:

