Skip to content

USB improvements for RP2xxx devices - #596

Merged
multiplemonomials merged 9 commits into
mainfrom
dev/rp2xxx-usb
Aug 6, 2026
Merged

USB improvements for RP2xxx devices#596
multiplemonomials merged 9 commits into
mainfrom
dev/rp2xxx-usb

Conversation

@multiplemonomials

Copy link
Copy Markdown
Collaborator

Summary of changes

Started this branch to enable USB on RP2350 devices, and try and resolve any test failures that seemed debuggable. The good news is that USB seems to work out of the box on RP2350 as well as it did on RP2040, but the bad news is that it is far from passing all tests. Ended up digging more into the USB stack than I had before, and was able to fix two issues:

  • No one ever implemented the endpoint abort function for RP2xxx. I was able to implement it by converting code from tinyusb.
  • USB uses a fixed ~4k RAM block for all CPU <--> USB controller interactions. The existing code for allocating buffers within this region was dumb and just advanced the pointer forward each time. So, after a certain amount of total creations and destructions of endpoints, it would fail and then the code would end up MBED_ASSERT(false)-ing. I added a new heap allocator within this region which manages the memory much more effectively.

Impact of changes

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Now all but 2 test cases in usb-basic pass, the stall test and the data toggle reset test. I don't have immediate ideas on how to fix those I'm afraid, they seem a little out of my depth right now.


Comment thread drivers/usb/tests/TESTS/host_tests/pyusb_basic.py
Comment thread drivers/usb/tests/TESTS/usb_device/basic/main.cpp
Comment thread README.md
Comment thread targets/TARGET_RASPBERRYPI/TARGET_MCU_RP2/USBPhy_RP2.cpp Outdated
Comment thread targets/TARGET_RASPBERRYPI/TARGET_MCU_RP2/USBPhy_RP2.cpp Outdated
@multiplemonomials
multiplemonomials merged commit b9f3f4d into main Aug 6, 2026
51 checks passed
@multiplemonomials
multiplemonomials deleted the dev/rp2xxx-usb branch August 6, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants