Hi Greg and all,

Currently I am working on USB Host which is plain USB host hardware (which
does not adhere to any of the spec - OHCI/ etc - provides plain registers
interfaces to manage data flow).  I have ported NuttX USB Host for Mass
storage (MSC) and it is working well for basic testing like, mount/ copy
files/ remove files etc.

As part of throughput measurement, I am trying to copy huge files with size
around 200+ KB. Some times, copy succeeds and some times code waits
indefinitely. On looking at the USB analyzer logs, I see below pattern.
1. Upper layer (usbhost_storage.c) keeps sending CBW (Command Block
Wrapper), Data (always 512 bytes) and CSW (Command Status Wrapper) in
usbhost_read()
and usbhost_write() functions.
2. When I see the issue, it is due to
a. Previous block is transmitted.
b. Upper layer (usbhost_storage.c) is trying to transfer the next block and
sends the CBW (31 bytes)
c. Device (using normal pendrive) seems to be busy (possibly it is managing
the internal details with previously received data) and there is no
response.
d. My USB Host device waits for turn around time and raises interrupt Not
Ready (NRDY).
3. With this scenario, I am trying to find out, is there any way, driver
can intimate the upper layer that device is busy/ not responding, so that
upper layer can retry sending the data? I looked at
..nuttx-8.2\include\errno.h and could not figure out which one is the
correct error to be returned for usbhost_storage.c so that re-try can
happen (EBUSY seems to be ideal, but I did not see the retry after
returning this EBUSY error).

Please let me know if you have any suggestion/ comments on handling this
kind of device behavior.

With best regards,
Phani.

>

Reply via email to