CherryUSB: EHCI timeouts on BL616 as host
I do see many timeouts when using the USB host on a BL616. This can be “fixed” by adding a delay to EHCI usbh_submit_urb() like so:
if (urb->timeout > 0) {
usb_osal_msleep(1); // <--- add a delay of 1ms
/* wait until timeout or sem give */
ret = usb_osal_sem_take(pipe->waitsem, urb->timeout);
if (ret < 0) {
goto errout_timeout;
}
ret = urb->errorcode;
}
This makes the setup stable and e.g. running FATFS on top of MSC just works fine. But I am sure this delay is not a good solution and this will sure have a massive negative impact on performance.
I am seeing this on the current master, integrated into the latest bouffalo SDK.
Example usbhost with fatfs enabled. Without this delay:
____ __ __ _ _ _
| _ \ / _|/ _| | | | | | |
| |_) | ___ _ _| |_| |_ __ _| | ___ | | __ _| |__
| _ < / _ \| | | | _| _/ _` | |/ _ \| |/ _` | '_ \
| |_) | (_) | |_| | | | || (_| | | (_) | | (_| | |_) |
|____/ \___/ \__,_|_| |_| \__,_|_|\___/|_|\__,_|_.__/
Build:19:15:52,Aug 12 2023
Copyright (c) 2022 Bouffalolab team
======== flash cfg ========
flash size 0x00400000
jedec id 0xC86016
mid 0xC8
iomode 0x04
clk delay 0x01
clk invert 0x01
read reg cmd0 0x05
read reg cmd1 0x35
write reg cmd0 0x01
write reg cmd1 0x01
qe write len 0x02
cread support 0x01
cread code 0x20
burst wrap cmd 0x77
===========================
dynamic memory init success, ocram heap size = 173 Kbyte
sig1:ffffffff
sig2:0000f32f
cgen1:9f7ffffd
Starting usb host task...
starting scheduler
do not find /dev/ttyACM0
do not fi[I/USB] EHCI HCIVERSION:0100
[I/USB] EHCI HCSPARAMS:000001
[I/USB] EHCI HCCPARAMS:0006
t0 not finnd /dev/inpud /dev/sda
[I/USB] New high-speed device on Hub 1, Port 1 connected
[I/USB] New device found,idVendor:054c,idProduct:0243,bcdDevice:0100
[I/USB] The device has 1 interfaces
[I/USB] Enumeration success, start loading class driver
[I/USB] Loading msc class driver
[I/USB] Get max LUN:1
[I/USB] Ep=81 Attr=02 Mps=512 Interval=255 Mult=00
[I/USB] Ep=02 Attr=02 Mps=512 Interval=255 Mult=00
[I/USB] Capacity info:
[I/USB] Block num:7831552,block size:512
[I/USB] Register MSC Class:/dev/sda
do not find /dev/ttyACM0
do not find /dev/input0
do not find /dev/ttyACM0
data len:25
[I/USB] MSC_disk_read(0x22fc93c0,0,1)
[I/USB] MSC_disk_read(0x22fc93c0,62,1)
[I/USB] MSC_disk_read(0x22fc93c0,63,1)
test fatfs write
[I/USB] MSC_disk_read(0x22fc93c0,16446,1)
[I/USB] MSC_disk_read(0x22fc93c0,16447,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_write(0x22fc93c0,16448,1)
[I/USB] MSC_disk_read(0x22fc93c0,5496,1)
[I/USB] MSC_disk_write(0x22fc9a00,4423918,4)
write success, write len:2500
[I/USB] MSC_disk_write(0x22fc9600,4423922,1)
[I/USB] MSC_disk_write(0x22fc93c0,5496,1)
[I/USB] MSC_disk_write(0x22fc93c0,13123,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_write(0x22fc93c0,16448,1)
[I/USB] MSC_disk_write(0x22fc93c0,63,1)
[I/USB] MSC_disk_ioctl(0,(nil))
test fatfs read
[I/USB] MSC_disk_read(0x22fc93c0,16446,1)
[I/USB] MSC_disk_read(0x22fc93c0,16447,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_read(0x22fc9a00,4423918,4)
[I/USB] MSC_disk_read(0x22fc9600,4423922,1)
do not find /dev/ttyACM0
do not find /dev/input0
do not find /dev/ttyACM0
do not find /dev/input0
do not find /dev/ttyACM0
do not find /dev/ttyACM0
do not find /dev/input0
do not find /dev/ttyACM0
[E/USB] usbh_msc_bulk_in_transfer()=-116
[E/USB] msc data transfer error
read fail
With the delay:
____ __ __ _ _ _
| _ \ / _|/ _| | | | | | |
| |_) | ___ _ _| |_| |_ __ _| | ___ | | __ _| |__
| _ < / _ \| | | | _| _/ _` | |/ _ \| |/ _` | '_ \
| |_) | (_) | |_| | | | || (_| | | (_) | | (_| | |_) |
|____/ \___/ \__,_|_| |_| \__,_|_|\___/|_|\__,_|_.__/
Build:19:15:52,Aug 12 2023
Copyright (c) 2022 Bouffalolab team
======== flash cfg ========
flash size 0x00400000
jedec id 0xC86016
mid 0xC8
iomode 0x04
clk delay 0x01
clk invert 0x01
read reg cmd0 0x05
read reg cmd1 0x35
write reg cmd0 0x01
write reg cmd1 0x01
qe write len 0x02
cread support 0x01
cread code 0x20
burst wrap cmd 0x77
===========================
dynamic memory init success, ocram heap size = 173 Kbyte
sig1:ffffffff
sig2:0000f32f
cgen1:9f7ffffd
Starting usb host task...
starting scheduler
do not find /dev/ttyACM0
do not fi[I/USB] EHCI HCIVERSION:0100
[I/USB] EHCI HCSPARAMS:000001
[I/USB] EHCI HCCPARAMS:0006
t0 not finnd /dev/inpud /dev/sda
[I/USB] New high-speed device on Hub 1, Port 1 connected
[I/USB] New device found,idVendor:054c,idProduct:0243,bcdDevice:0100
[I/USB] The device has 1 interfaces
[I/USB] Enumeration success, start loading class driver
[I/USB] Loading msc class driver
[I/USB] Get max LUN:1
[I/USB] Ep=81 Attr=02 Mps=512 Interval=255 Mult=00
[I/USB] Ep=02 Attr=02 Mps=512 Interval=255 Mult=00
[I/USB] Capacity info:
[I/USB] Block num:7831552,block size:512
[I/USB] Register MSC Class:/dev/sda
do not find /dev/ttyACM0
do not find /dev/input0
do not find /dev/ttyACM0
data len:25
[I/USB] MSC_disk_read(0x22fc93c0,0,1)
[I/USB] MSC_disk_read(0x22fc93c0,62,1)
[I/USB] MSC_disk_read(0x22fc93c0,63,1)
test fatfs write
[I/USB] MSC_disk_read(0x22fc93c0,16446,1)
[I/USB] MSC_disk_read(0x22fc93c0,16447,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_write(0x22fc93c0,16448,1)
[I/USB] MSC_disk_read(0x22fc93c0,5496,1)
[I/USB] MSC_disk_write(0x22fc93c0,5496,1)
[I/USB] MSC_disk_write(0x22fc93c0,13123,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_read(0x22fc93c0,5496,1)
[I/USB] MSC_disk_write(0x22fc9a00,4423918,4)
write success, write len:2500
[I/USB] MSC_disk_write(0x22fc9600,4423922,1)
[I/USB] MSC_disk_write(0x22fc93c0,5496,1)
[I/USB] MSC_disk_write(0x22fc93c0,13123,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_write(0x22fc93c0,16448,1)
[I/USB] MSC_disk_write(0x22fc93c0,63,1)
[I/USB] MSC_disk_ioctl(0,(nil))
test fatfs read
[I/USB] MSC_disk_read(0x22fc93c0,16446,1)
[I/USB] MSC_disk_read(0x22fc93c0,16447,1)
[I/USB] MSC_disk_read(0x22fc93c0,16448,1)
[I/USB] MSC_disk_read(0x22fc9a00,4423918,4)
[I/USB] MSC_disk_read(0x22fc9600,4423922,1)
read success, read len:2500
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 31
Cache line 32, so set 32 or 64 is ok, just you like.