- Notifications
You must be signed in to change notification settings - Fork1k
feat: add usb msc support for nrf52840#5011
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:dev
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
aykevl commentedAug 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I tried this, but sadly it doesn't work. |
mikesmitty commentedAug 24, 2025
No worries, my nrf52840 just showed up so I'll investigate |
deadprogram commentedSep 16, 2025
@mikesmitty any update on this? I would really like to have it for something... 😸 |
mikesmitty commentedSep 17, 2025
Oh yeah, this fell off my radar. I've got a debugger just about set up with an nrf52840 now so I can dig into this again |
af1b8fe tof246bffComparemikesmitty commentedSep 17, 2025
Ok, at least in my testing it looks like it's just a problem with m.buf being too small. My test device has a write block size of 4 bytes, which I didn't think would ever happen. The m.buf buffer is set, perhaps a bit naively, to use the write block size as a capacity, but it needs to be 64 bytes at a minimum to be able to store a full usb packet and it's panicking.#5017 also modifies these buffer sizes but in a more expansive way so this will likely end up just being a temporary patch. I just saw Ayke commented again on that one so I'll swap back to that one next |
deadprogram commentedOct 21, 2025
Pinging Dr.@mikesmitty 😸 |
mikesmitty commentedOct 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Sorry, been getting distracted a lot recently haha. I'll start working on this again this weekend |
deadprogram commentedOct 23, 2025
Thank you! |
ysoldak commentedNov 24, 2025
ysoldak commentedNov 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Same happens with |
f246bff toced1d5cComparemikesmitty commentedNov 26, 2025
Ok, finally getting back into this now. Let me see where I left off |
ysoldak commentedNov 28, 2025
Just in case it helps in any way, here is UF2 bootloader for nRF52 chips. https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/src/usb/usb.c |
mikesmitty commentedNov 30, 2025
Woof, that was an adventure. The usb endpoint handling logic for nrf52840 was unconditionally accepting packets and I ended up having to rework it a little bit in order to allow returning a NAK when needed, but it seems to be working for me now if you guys want to give it a shot |
deadprogram commentedNov 30, 2025
@ysoldak please give this PR another try if you get a chance. |
ysoldak commentedDec 1, 2025
Still can't see Mass Storage Device when flashing usb-storage example to XIAO BLE board. There is no popup with Eject, Ignore and Initialize... buttons anymore, but nothing else either. Is there any other (better) way to test? |
mikesmitty commentedDec 1, 2025
Sorry, I've been playing whackamole with bugs in this one a little bit. I started putting together a branch with tests to try and iron those out properly. I'll trim this back and put those in the other branch |
4e18962 to649a66dComparedeadprogram commentedDec 6, 2025
@mikesmitty#5109 has been merged, perhaps this PR can now be rebased and retested? |
649a66d to40e51a3Comparemikesmitty commentedDec 8, 2025
I rebased if you want to give it a go, but I haven't tested it yet. I spent a bunch of time arguing with both the jlink and the nrf52 board, but I've finally got a reliable workflow going again |
mikesmitty commentedDec 9, 2025
Ok, nailed down the bug I was stuck on for the longest time where endpoint stalls were hanging indefinitely and the CSW was not being returned. In order to reset the DATA0/DATA1 in |
mikesmitty commentedDec 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Alrighty, I fixed the last bug I was running into and pushed the changes up on#5110 since that's where I was doing my testing. I tried porting the change back over to this branch, but it's running into some fatal bug on this branch and I don't have time to sort it out this morning. I'll sort out/split up the changes a bit later, but for now you can try out the changes on that other PR Edit: Oh, actually there's another new bug, but it enumerates properly now. I'll take a look into it a bit later |
deadprogram commentedDec 10, 2025
Thanks for working on this@mikesmitty ❤️ |



I don't have an nrf52840 on hand to test yet (should have one tomorrow), but I figured I'd push this up in case@aykevl or anyone else wanted to give it a whirl
#4844 (comment)