-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement dcd_edpt_close_all() and fix dcd_edpt_clear_stall() for frdm_kl25z #1086
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
Conversation
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.
Superb ! Thank you very much for the update. For frdm_kl25z, we could pick one of its header pin and use wire jumper for input. Though we could always do it later.
For the MSC test, it is the most tricky test, have you tried to explicitly reset the PID of endpoint to DATA0 when dcd_edpt_open() is called. Since one of the msc test sequence is reset by simply Set Config(0) then SetConfig(1), and expect all the endpoints to be reset.
For boards without I/O, I think we can make bsp functions 'weak' to make it easier to override for testing purposes while keeping git workflow clean. |
It is not necessary, pin/port is fixed on individual board, If you have an custom nuc126 board, you should add your own board file that correctly reflect your hardware. |
Thank you for your comments. I will try to test with a jumper wire. |
Thank you very much for your comments and checking the patch! When USBCV was run, no other USB devices would work, so I did not get testing logs. |
You only need to test with normal operation (confirmed issue hapend on windows as well). The side-effect would be a decent delay before the device show up. The log with
The more I tried to alter the clear_stall() the more I think the edpt_clear_stall() does not do clear the stall response. Controller doesn't seem to update its knowledge when we do |
@kkitayam I merged from master since the current state has build error with LOG=2. Also take the chance to push minor clean up for the dcd. Mostly for adding volatile (_IO) to the bd filed that could be changed by controller. It does not help with this issue, but would still be better to add. |
@hathach I wasn't expecting |
I confirmed MSC test pass with fbe1bf3. But, Chapter 9 regarding suspend/resume/remote wakeup fail still. |
Superb !!! I confirmed it passed the MSC test suite. Yeah, I have read the KL25z manual back and forth and didn't see any mentioned about controller will set this bit and the need to clear it. Now, I feel this bit can cause race condition since we can potentially stall the other direction as well e.g stalled 0x83 can also cause 0x03 stalled if we don't clear this bit fast enough. Anyway, that is just the theory. the USB frame is 1ms and we surely could clear this fast enough. the TD 9.14 Suspend Resume test probably is dued to resume event detection. I will try to see if I could help with this. |
@kkitayam I confirmed that we couldn't detect the RESUME signal currently, suspend detection is fine. Btw, i found an new usb tool |
@kkitayam Update: I found and fixed the issue, just in case you are troubleshooting it, please wait for my next push :) |
@hathach Great! Thank you for your work. I am ready for your next push. |
@kkitayam I have pushed the new commit, it passed all the suspend/resume/remote-wakeup test now. The issue is due to the RESUME detection, it seems the ISTATW RESUME is never triggered. possibly used for host. The tranceiver resume_int is correct way to detect bus activity. Also it will be triggered when the PS: I also push up some minor clean up, please review and let me know if those makes sense to you, especially removing the short return in the ISR. I think there is high chance that multiple interrupt are triggered at once. |
@hathach Thank you for your commit. I have confirmed all Chapter 9 test pass. And, all modifications look good for me. Great! BTW, dcd_mm32f327x_otg.c is almost the same code. We should apply this patch to the dcd. |
@kkitayam Thank you for your testing. oh, I didn't know that mcu also use the same controller as khci. It is submitted by mcu vendor #869 . And I am unaware of the driver is based on yours. The license should name yours instead. I will correct that. Ideally, it should be the same common dcd file though, I am really bad of naming, I wish I know the USB IP name (like synopsys) to make it spot-on, but I will try. I haven't run tested on the mcu just yet, due to their sdk issue with case-sensitive file naming which cause failed to compile on Linux. zhangslice/mm32sdk#1 I made a PR, to correct that but they are not very responsive then I switch to other works. I will try to pull out mm32 board to try again later on. Thank you very much again. |
While trying to figure out the IP name of this controller, I just found out that this USB IP is also used by |
It is very interesting! I've also looked into PIC18F2455 too. It looks that this MCU has a similar USB IP. The IP has PPB(Ping-Pong Buffer) instead of BDT. And it seems that PPB had been applied as a patent in 2004. I found that the USB IP seems to be called as VUSB in HCC-embedded's USB stack. But I couldn't find the name on any other web site. |
@kkitayam I spent several hours to do a bit of research on this, here is my findout.
Overall, Freescale along with NXP seem to use the USB IP designed by TransDimension e.g lpc18xx/imxrt use highspeed version. However, since these are more commonly known as ChipIdea in other project such as linux https://github.com/torvalds/linux/blob/master/drivers/usb/chipidea/ci.h#L43 . So I intend to rename existing transdimension to chipidea highspeed, and this one to chipidea fullspeed. |
Describe the PR
dcd_edpt_close_all()
function.dcd_edpt_close_all()
function. This function worked for endpoint 0 but others.Additional context
with the exception of five tests: error-recovery/case 4,8,10/required-command. Not investigated yet.