-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DCD SAM3U Support #892
base: master
Are you sure you want to change the base?
DCD SAM3U Support #892
Conversation
if it is the same controller, it should be merged together, instead of having 2 different dcds. I have done something similar even across family line for LPC, iMXRT https://github.com/hathach/tinyusb/blob/master/src/portable/nxp/transdimension/dcd_transdimension.c#L30 |
I have to look further into it, the register map seems very different but it still might make sense to join them |
yeah, I really prefer to join them if possible, or at least extract/abstract transfer handling into common API. |
After reading SAM3U's manual, it seems they are very similar in functionality. But there are too much differences in register map, I'm afraid we need to spam |
It is doable with by extracting function to common API and/or some other works. There is no rush to support SAM3U, we do it little by little. |
The reason I added this is because I actually need a usb driver for the sam3u (as well as the sams70), so im planning on working on this |
If you feel adding new dcd is quicker, feel free to do so in this PR to test with your board. Once it is ready, I could help with the merging. PS: just placed an order for SAM3U to help with this PR, the official EK board from atmel is out of stock everywhere. https://vi.aliexpress.com/item/4001163149713.html?spm=a2g0o.store_pc_groupList.8148356.2.41612820wy8Fks |
how do i approach the cmsis @hathach ? should i merge into the microchip driver repository? right now I'm relying on this https://github.com/cmsis-packs/cmsis-dfp-sam3u |
894488d
to
a8b4b88
Compare
I ported the initial driver from the samx7x, without dual port and dma implementation to reduce complexity, I have yet to test compile, but everything should be more or less ready. I'm going to be out for a week, I won't pick this up again until then. |
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.
As mentioned previously, #693 should be merged first, then we will generalize that driver to also support sam3u. Same driver should share a same dcd, that is hard at first but pay off later since it helps maintaining and fixing bug afterwards
btw, my order for sam3u board here has arrived, just haven't time to check it out https://vi.aliexpress.com/item/4001163149713.html?spm=a2g0o.store_pc_groupList.8148356.2.41612820wy8Fks
Waiting on #985 to redo this |
This is still something I want and have to do, but I don't have time right now (due to new job) so If anyone can pick this up for me I would appreciate it (should be only needed to write the header with the registers) |
60abab4
to
5d88621
Compare
Started to look at this again, unfortunately, the USB cores are very similar, but just different enough to make it quite hard to make compatible, so I just forked the original samx7x driver and made the necessary changes. I simply translated as best I could the register from the samx7x to the 3u, but there are a couple features that apparently have slightly different implementations, so I don't believe this is going to work out of the box. also unfortunately, I don't have any boards with this MCU assembled at the moment. @hathach did you ever get the SAM3U development board? Any help testing this and finalizing the port would be very appreciated. |
cmsis PR: Board driver is a todo |
I got the board, and would love to help but I am way behind my work schedule now, and couldn't have the time. I will revisit this whenever I could. |
I understand, i the meantime I'll try to assemble some boards with it @HiFiPhile you think you could take a look? I am certain there are things that beed to be done differently, i recall a couple flags to trigger things in the endpoints status register are very different, i did a naive translation so far |
Yes I could help you if you are going to do some testing, but I haven't used sam3u so my assumption won't be accurate :) |
Signed-off-by: Rafael Silva <[email protected]>
Signed-off-by: Rafael Silva <[email protected]>
Signed-off-by: Rafael Silva <[email protected]>
Signed-off-by: Rafael Silva <[email protected]>
Signed-off-by: Rafael Silva <[email protected]>
Signed-off-by: Rafael Silva <[email protected]>
finally tried running this when I connected in high speed I got constant bus resets to high speed
when forcing full speed i got this
from pc:
|
after usb high speed reset it doesnt seem to get any endpoint interrupts, while it does on full anyone think tthey can help me diagnose this? |
The host seems to be requesting more data than expected for config descriptos, 0x8d/141 vs 77 for dual cdc, curiously on hid_composite it enumerated |
Full speed HID composite
|
@hathach / @HiFiPhile Do you have any tips on what to look for? on high speed it seems to get stuck on the event bus reset on the queue, like it doesnt clear, it did not get more that the first interrupt for the bus reset |
I'm suspecting some hardware issue, which board are you using ? |
It's a board by me, i don't have access to any dev boards or premade hardware with one, but it should be good, in theory https://github.com/openinput-fw/russian-woodpecker |
There's a PDF in the releases |
the ESD is a USBLC6-2SC6 |
Nice layout :) When I have time I'll compare with ASF3 to see if there is any difference. |
What do you mean by that? the asf code for the USB peripheral? do you know of an example by them relatively ready to go for this device? I can't find one suitable |
Yes ASF3 udphs driver.
Yes they lack a basic example ! When I wrote the driver for SAMx7x I found its USB signal is weaker than other MCUs, @hathach had to use a 30cm cable to let USB work. I don't know if it is the same for SAM3U. |
Hm, actually, when i used a longer cable it showed a different behavior, didn't even get to a bus reset, but I'm using a rather short cable right now, could look for something shorter |
I made a really short cable, 5 cm, and I did not have much luck, always showing different symptoms though |
@hathach how is your time? would you be able to take a look at this and try your dev board? |
Thank you, sorry for super delay. will test this out as soon as I could. I need to find my own SAM3U board, I think it is delivered already. |
Hi @perigoso , how's it going the project ? Did you made it work ? |
Hi, i never got back to this project, so there are no updates that I recall |
Signed-off-by: Rafael Silva [email protected]
Describe the PR
Implementation of a DCD driver for the SAM3U.
Additional context
The SAM3U seems to have a similar USB core to the SAMx7x family, for which support is being added in #693, but the register map seems to be completely different.
That said, thanks to that it should be easier to port.
Datasheet for reference.