atsamx7x-rust icon indicating copy to clipboard operation
atsamx7x-rust copied to clipboard

Improve/battle-test USB implementation

Open tmplt opened this issue 1 year ago • 2 comments

Copied from internal issue tracker:

The current usb-device implementation is a reverse-engineering feat that was compared to the ATSAMx5x family implementation, along with an RTT (and Wireshark) trace of a CDC-serial example (the branch of which I have forgotten at the moment where I put it), and some ideas taken from the tinyusb implementation of the x7x.

At the time, the latter was not traceable due to tinyusb/#1520, but with it closed, we can now gather additional data and improve our own implementation. tinyusb also contains some abstracted class implementations in case available usb-device implementations are found to be lacking.

So, what we should do now is RTT/Wireshark trace the current implementation in this HAL and compare it with that of the tinyusb example. In this trace, we should send some known payload to the device which is simply echoed back (usb_serial_echo example). These should be attached in this issue and relevant MRs should be created, closing this issue when traces match.

tmplt avatar Sep 17 '22 11:09 tmplt

Correction: the traced x5x application was not an echo application, but a simple USB enumerator. It is available here.

tmplt avatar Sep 17 '22 11:09 tmplt

We also need to look into how the interrupts behave. In the example application, is USBHS always active, or do we eventually enter idle again? We only want USBHS to be active when needed.

We also need to test if the implementation can handle large payloads, and how large they can be before any eventual bytes are discarded.

tmplt avatar Sep 17 '22 11:09 tmplt