Closed soulfish5 closed 1 year ago
Proposed change doesn't make sense. Will check other code to see if the issue lies outside of this library.
@hathach I should be able to give it a try tomorrow. Thanks!
@soulfish5 no rush, take your time, It is holidays :)
@soulfish5 no rush, take your time, It is holidays :)
Holidays were thoroughly enjoyed! Issue tested and resolved. Thanks!
I was using the PICO as a USB Host for a radio, using the built-in USB connector. I switched to the PIO implementation and the device no longer worked.
Setup of the radio requires Control Transfers with data stages.
Using a Logic Analyzer I compared the output from the PICO when using the built-in connector and PIO. The data stage of the control transfer starts with Data1 on the working built-in USB connector. The data stage of the control transfer starts with Data0 when using PIO.
https://www.keil.com/pack/doc/mw/USB/html/_u_s_bcontroltransfers.html states: "The DATA stage is optional. If present, it always starts with a transaction containing a DATA1 packet. Then, the transaction type alternates between DATA0 and DATA1 until all required data have been transferred."
The radio works and the first packet of the data stage is set correctly after I set ep_data_id to 1 instead of 0 here: https://github.com/sekigon-gonnoc/Pico-PIO-USB/blob/main/src/pio_usb_host.c#L515
I have a branch I can use to make a pull request if that looks like a good solution. Edit: I just created a pull request. https://github.com/sekigon-gonnoc/Pico-PIO-USB/pull/56
Thanks.