-
Notifications
You must be signed in to change notification settings - Fork 35
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
esp32s3 USB0 register block issues #212
Comments
Also, the MPS field looks incorrect in USB0.DIEPCTLn. I believe this should be bits 0:2 in diepctl0, but bits 0:10 in diepctl1 through diepctl6. However, it is listed as just 2 bits wide for all endpoints. The DOEPCTLn registers to appear to be correct. |
I guess there are two separate aspects to this issue:
I'm not sure how much appetite there is to do the larger cleanup. From a cursory search I didn't really see any downstream crates that seem to be using the USB0 register block much, so it possibly wouldn't disrupt too many things downstream. That said, I'm not sure how much you want to avoid deviating from the base SVD. If we did clean things up I would suggest:
|
Thanks for the issue @simpkins! We very much have an appetite to do the cleanup, particularly in this case where there isn't a driver to update. It's much nicer write drivers when the PAC is in a good spot. We really appreciate the PR, and any subsequent PRs you may file (the clean up suggestions look good to me!). Most of the Rust team will be on vacation till next week, and we'll get to reviewing your PR then :). |
Oh and seeing as you're interested in async USB in the end, cc: @dominazzz and embassy-rs/embassy#2494. I also have a personal use for async USB coming up, so I'd be more than happy to help the both of you work through the issues :). |
Thanks for the feedback. I've got some code that is close to working (I think) for using embassy-usb on esp32s3; I'll try to make some more progress on it in the next few days and then upload it to github. It isn't really based on the embassy-stm32 implementation--I looked at how they did some stuff, but it is largely from scratch with a few different design choices. (I also looked at how tinyusb does things, plus the STMicro documentation, given that Espressif docs cite an NDA and don't include USB register documentation.) I'll try to make a few more pull requests with SVD patches when I have made more progress. Having a combined embassy-usb-driver implementation for both STM32 and ESP32 chips would be nice in the long run. That said, I think it would take quite a bit of refactoring to make this work with esp-pacs--the USB0 API exposed by esp-pacs is rather different than the one used by the embassy-stm32 ral, even though the register block layout is nearly the same. As an aside, I did notice one more SVD bug: the |
I agree, having completely different peripheral access mechanisms makes this probably more effort than it's currently worth. Let's just focus on getting the pac in good shape for your upcoming driver, merging the two can be a longer term stretch goal if we wish. |
Closed via #213 |
I'm playing around with possibly implementing an embassy-usb driver for esp32s3, and while doing so I noticed a few things that look like typos or transcription errors in the esp32s3 SVD file (an also in the esp32s2 one too).
The EPDISn field in the USB0.DIEPCTLn registers aren't named consistently: endpoints 0,1,2,4, and 6 call this
D_EPDISN
while endpoints 3 and 5 call thisDI_EPDISn
. (using aDI_
prefix instead ofD_
)The EPDISn fields in the USB0.DOEPCTLn registers appear to be listed as read-only. This seems likely wrong? The tinyusb esp code does set these fields, and the Synopsys USB docs provided for STMicro chips does document that these fields need to be set to disable OUT endpoints. (As far as I could tell Espressif only provides minimal high level documentation for their USB cores, so I'm going off STMicro docs).
It's unfortunate that the USB0 FIFO ranges aren't listed in the SVD. It looks like the existing blocking (non-embassy) USB drivers end up accessing the FIFO by manually computing the address from the start of the USB0 register block.
(reg_block + 0x1000 + fifo_num * 0x1000)
As an aside, the fact that all of the endpoint registers (DIEPCTLn, DOEPCTLn, DIEPINTn, DOEPINTn, etc) have different types for each endpoint makes the code much more awkward to use. The endpoint 0 registers are slightly different from the others, but it would be nice if endpoints 1 through 5 all used the same types.
Also, very minor, but I wonder if the USB0.GINTSTS.RXFLVI name was a typo in the SVD and should have been RXFLVL instead?
The text was updated successfully, but these errors were encountered: