-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
shared/tinyusb: Add common cdc tx/rx functions. #14462
Conversation
Code size report:
|
b4de5d4
to
d606676
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14462 +/- ##
=======================================
Coverage 98.39% 98.39%
=======================================
Files 161 161
Lines 21204 21204
=======================================
Hits 20864 20864
Misses 340 340 ☔ View full report in Codecov by Sentry. |
d606676
to
278ef2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really useful, thanks @andrewleech! One small change suggestion, but I think we should merge it with or without the additional name change.
4f590cb
to
754ae8b
Compare
Note: I've only been able to test this on RP2, I don't own samd / mimxrt / renesas-ra boards. edit: I've got my hands on samd, mimxrt and renesas-ra boards ( thanks @mattytrentini ) but haven't been able to figure out how to enable usb on renesas yet... renesas#2 So now rp2, samd21, samd51, mimxrt have been tested and appear to work as expected! |
52361d3
to
5bedc84
Compare
It may be redundant as I saw the follow-on PR has been tested on samd already, but I've tested this PR on samd and it seems to work as expected. 👍 |
Thanks I've just updated my previous post to reflect what I've now been able to test! Regardless, I certainly appreciate any additional testing as I'm not very familiar with some of these ports! FYI thanks to this incredibly helpful tidbit of info, I'm also looking at bringing esp32s2 and s3 into using this same shared tinyusb implementation, as well as fixing the auto-bootloader jump there for S3 which is currently incredibly frustrating! It's probably worth saving the esp stuff for a follow up PR though, it's a larger parcel of work though! |
@andrewleech Oh wow, that's fantastic news! I had anticipated this being a much bigger task, very exciting. |
So now I've tested everything here except the renesas port changes. Can anyone provide guidance on how to update the auto generated files in a renesas board (in particular the interrupt vector header) to enable USB on a evk board? @TakeoTakahashi2020 @dpgeorge Alternatively @iabdalkader could you perhaps test this PR doesn't break anything on a Portenta C33 (I can really afford one myself for testing with). |
5bedc84
to
41a54fa
Compare
@andrewleech Yes I can test it, perhaps later today. What do I need to test ? |
Thanks, on this PR there's no intended functional change so it's just a basic check that stdio / repl still seems to work. If possible, the bigger change is in the follow on PR #14485 If you know, I'd love some pointers on how to create (or better, modify) the auto generated code in a renesas board so I can test / document it myself too. |
REPL is still functional on the Portenta C33.
You'll need to install the e2studio, load the configuration, edit and then generate the code. For this you need the configuration.xml, I think it's this one: configuration.xml.zip |
Ok thanks! I previously installed RA Smart Configurator which can open a "project", not sure if that will be the XML. I'll try tomorrow. I really think this XML/project file needs to be included in the board folder as the source of the auto gen files. |
That's great thanks! |
There's a cfg.txt file too, those are the only two non-generated files. |
Thanks @iabdalkader that "configuration.xml" file opened just fine in the standalone "RA Smart Configurator" application! That got it going for me, with a cut up usb cable wired to the USB pins and a jumper from 3v to vbus to enable it I had cdc working (quicker than wiring resister divider from USB 5v to vbus pin). More than just replicating your testing on this PR, this more importantly helped me finish off the updates in tinyusb to support my startup buffer feature. Thanks again! I'll try to get a more succinct version of these notes into a readme update pr to help the next person. Would you mind me also including your configuration.xml in that pr (in the matching board folder) to reference as an example? |
No please go ahead. The configuration should have been there with the board files. |
41a54fa
to
2313625
Compare
I found a further consolidation that made sense in moving more of the cdc stdin handling into the With that change, I've restested on all platforms covered here and all appear to be working (basic read/write on repl and mpremote mount still works). I previously had nrf also included here but it was a larger change which grew even larger as I tested and cleaned it up so moved it to its own PR. With this, I consider this PR complete and ready for final review. |
There are a few TinyUSB CDC functions used for stdio that are currently replicated across a number of ports. Not surprisingly in a couple of cases these have started to diverge slightly, with additional features added to one of them. This commit consolidates a couple of key shared functions used directly by TinyUSB based ports, and makes those functions available to all. Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Andrew Leech <andrew@alelec.net>
e7b4332
to
c11efc7
Compare
Thanks, this looks really good. It was always on my list to eventually factor these functions, and I'm glad someone else got to it first :) |
Using pull from 31 may 2024, and master branch, NRF52840 does not compile with these changes on my system. It cannot find the
and
My code now compiles (BOARD=SEEED_XIAO_NRF52), and the REPL works with new build. Note that the 1.23.0 tag compiles and runs without modification. I do not think these are the optimal patches as I did them simply to resolve link/compile errors based on the samd code... and I have little knowledge of |
Not surprisingly, the @andrewleech |
There are a few tinyusb CDC functions used for stdio that are currently replicated across a number of ports.
Not surprisingly in a couple of cases these have started to diverge slightly, with additional features added to one of them.
This PR consolidates a couple of key shared functions used directly by tinyusb based ports.