sekigon-gonnoc/Pico-PIO-USB

🪲[BUG] USB Flash drive descriptor read fails unless log level is 3

Closed this issue · 2 comments

Describe the bug you encountered:
I realize this is not supported yet officially, but I am attempting to implement a USB MSC Host with the Pico-PIO-USB. If log level is 1, enumeration fails getting the USB descriptor of the flash drive with a printout

[1:0] Control FAILED

If I set the log level to 3, enumeration succeeds. The flash drive mounts and I am able to read the block size and block count.
...

What did you expect to happen instead?
I expected the host to at least be able to read the USB device descriptor even if USB MSC Host is not yet supported.
...

What actually happened in your case?
Descriptor read fails every time.

...

Additional information

I am using a Raspberry Pi Pico board and a USB A breakout board that I modified to insert 27 ohm SMT resistors in series with the D+ and D- pins. I have routed D+ to Pico board pin 1 and D- to Pico board pin 2 as per default. I am using a Picoprobe for debug and for UART output; UART0 is the debug UART; I am using Pico board pins 21 and 22 for the UART: i.e., in my CMakeLists.txt

PICO_DEFAULT_UART_TX_PIN=16
PICO_DEFAULT_UART_RX_PIN=17

Power is supplied by my PC via the Pico Board microUSB connector. The USB device mode on the microUSB connector is not yet initialized. I have tested this hardware system with a USB Keyboard connected to the USB A + sample code and with 3 different MIDI devices connected to the USB A + my own USB MIDI host code. All work correctly.

I have a DreamSourceLab logic analyzer, so I can dig deeper. Any hints as to where I should look? Are there PulseView traces that you would recommend I examine?


I think the issue may be that the reset recovery time interval is not being obeyed. See USB Spec section 7.1.7.3 Figure 7-29 timing interval delta-t6 must be 10ms. I measure less than 1ms between the end of bus reset to the start of the first setup packet.
When the log level is 3, I measure about 8.8ms between reset end and the first setup packet. That seems to be enough time for
the flash drive to recover from reset.

I will close this issue for this project. The bug should be fixed in tinyusb hcd_pio_usb.c function hcd_port_reset_end() because
it seems hcd_pio_usb.c has control over the reset timing.