-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
probe: handle pipelined OUT transfers properly #47
Conversation
A consequence of tinyUSB's implementation of vendor interfaces is that it treats pipe traffic as free-flowing, i.e. no distinction is made if a short packet is received. CMSIS-DAP should ordinarily encapsulate a set of commands in a single packet, but if multiple packets are receieved before the FIFO is drained then all the commands need to be processed at once. Ensure there is always enough RX space, and TX space for the generated response.
Tested with Ubuntu 22.04 x86_64
Your version correctly picks concatenated packet from the input FIFO. If you change DAP_PACKET_COUNT to 4U (OpenOCD now uses up to 4 |
Is this verified with a logic probe? I can't think of anything I did that would break swclk setup. Edit: IN transfers will likely violate the constraint that DAP responses must not cross packet boundaries. I need to find out if tinyUSB has some method of enforcing a transfer boundary in this case. |
LA sampled @ 40 MHz
I already proposed:
I don't know details, but https://github.com/hathach/tinyusb#readme |
I think there are overlaps between this PR and this one: #51 In fact I think the mentioned PR makes this one superfluous (sorry). |
I tried a tud_vendor_flush() after With the flush the fw seems to work reliably up to DAP_PACKET_COUNT 3. Measured (target is not a RP2040 this time):
@P33M Any progress on your side? |
@tom-van : could you please tell me, what those load_image and dump_image commands are? Could be of help for my tests. |
Thanks for that. I find your numbers above very astonishing! When I'm doing this load/dump_image I'm getting ~25KByte/s. With my CMSIS-DAPv2 "patch" I'm getting ~100KByte/s. I'm wondering what part of my setup is broken. |
Testing this has exposed an actual hardware bug in rp2040, so I've been a bit busy dealing with mitigations for that. You're correct in that responses can get arbitrarily merged by tinyUSB, and that we need a dedicated per-packet callback instead of a fifo. |
The actual fix went in via 58fa7a1 |
Tested with the current OpenOCD git master and patched OpenOCD which really pipelines CMSIS-DAP USB-bulk requests git master:
pipelining patches applied:
Although not the fastest USB FS adapter, the speed-up due to pipelining is significant. |
NB: don't merge until I find out why this causes the VL805 integrated hub to spew full-speed bus garbage around SOF and why picoprobe doesn't recover from a bus error condition.