Ch32V307 usb hs的bug?

发现只要编译选项设置成没有优化,usb host就会出问题

使用官方例程:Wch例子\CH32V307EVT\EVT\EXAM\USB\USBHS\HOST_KM

官方例程默认是 -os优化,插入一个usb设备以后,输出:

SystemClk 222:96000000

ChipID:30500518

USB HOST KM Test

TIM3 Init OK!

USBHS Host Init

USB Port1 Dev Out.

USB Port1 Dev In.

Enum:

Get DevDesc: 12 01 10 01 00 00 00 08 a7 1e 64 00 00 02 00 01 00 01 

Set DevAddr: OK

Get CfgDesc: 09 02 22 00 01 01 00 a0 32 09 04 00 00 01 03 01 02 00 09 21 10 01 00 01 22 69 00 07 05 81 03 08 00 02 

DevType: 03

Set Cfg: OK

Root Device Is HID. Enum Hid:

Analyze CfgDesc: OK

Get Interface0 RepDesc: 06 b5 ff 09 01 a1 01 85 b5 09 02 15 00 26 ff 00 75 08 95 07 81 02 09 02 15 00 26 ff 00 75 08 95 07 91 02 c0 05 01 09 02 a1 01 85 02 09 01 a1 00 05 09 19 01 29 08 15 00 25 01 95 08 75 01 81 02 05 01 09 30 09 31 16 01 f8 26 ff 07 75 0c 95 02 81 06 09 38 15 81 25 7f 75 08 95 01 81 06 05 0c 0a 38 02 95 01 81 06 c0 c0 

Get StringDesc2: 16 03 32 00 2e 00 34 00 47 00 20 00 4d 00 6f 00 75 00 73 00 65 00 

Further Enum Result: OK


------------------------------------------------------------------------------------------------------------

如果把这个优化选项改为 None -00,输出为

SystemClk 222:96000000

ChipID:30500518

USB HOST KM Test

TIM3 Init OK!

USBHS Host Init

USB Port1 Dev Out.

USB Port1 Dev In.

Enum:

Get DevDesc: Err(20)

Get DevDesc: Err(20)

Get DevDesc: Err(20)

Get DevDesc: Err(20)

Get DevDesc: Err(20)

Get DevDesc: Err(20)

Enum Fail with Error Code:45

aaa.png

您好,感谢你的反馈,这边已复现你的问题,后面会具体看一下。一般工程在使用时,使用默认配置优化等级即可。后面若有问题,可邮箱(lzs@wch.cn)和我沟通。


只有登录才能回复,可以选择微信账号登录