-
Notifications
You must be signed in to change notification settings - Fork 3k
nRF52840 USBPhy Implementation #10457
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
nRF52840 USBPhy Implementation #10457
Conversation
Use the USB device SN instead of VID & PID to find the device port name on the host system.
This delay eliminates the possibility of the device detecting the port being closed when still waiting for data.
Despite having ECHO and ECHOCTL POSIX lflags disabled by default by pyserial, a delay is needed for host to properly handle data received from USB serial/CDC device. With no delay host would echo 0x00-0x31 characters prefixed with '^'.
Setting to 1 ms to be on the safe side. The USB spec defines this delay to be at least 200 us.
This ensures the flow control is tested.
Update the serial host test to set DTR low before opening a serial port. Set DTR high once the serial object is ready. This ensures that no data is sent by the device until the host is ready.
Remove TX_DELAY_MS and all the places it was called since it is not needed when DTR flow control is used.
Double the number of attempts that are made to open a serial port. This makes tests run more reliably on Windows.
Remove the USB disconnect delay since there is no reason this is needed. Failures which occur without this indicate a device or host problem.
A DTR line is used to signal that the host has configured a terminal and is ready to transmit and receive data from the USB CDC/Serial device. When this test suite is run with the use of a Linux host, a workaround has to be used to overcome some platform specific DTR line behavior. Every time the serial port file descriptor is opened, the DTR line is asserted until the terminal attributes are set. As a consequence, the device receives a premature DTR signal with a duration of 200-500 us before the correct, long-lasting DTR signal set by the host-side test script. (tested on the Linux kernel 4.15.0) The solution is to wait for the first DTR spike, ignore it, and wait for the correct DTR signal again.
tests-usb_device-basic are OK on the following platforms: NUCLEO_F412ZG NUCLEO_F413ZH NUCLEO_F429ZI NUCLEO_F446ZE DISCO_F413ZH DISCO_F469NI
…c EP0STATUS task triggering at end of DMA transfer
…e hardware expects. First working example!
…bed/mbed-os into nrf52840-usb-hal
…he soft reset test.
…ccess state information.
…aring the Nordic HW for the status stage of a control transfer would sometimes cause the HW to automatically ACK an "invalid" command during the control stall test. This would cause the test to fail (because an invalid request was not stalled).
Add the USBPhy and USBPhyEvents abstract classes, the HAL header using this class and the EndpointResolver utility class.
Copy the USBDevice code out of unsupported and into a top level USB folder in preparation for development. squash
Update USB licenses from MIT to Apache 2 and run astyle on the code.
Update the USBDevice class API so it matches mbed-os's naming conventions, has a more robust API and uses USBPhy as its backend.
Add a USB test and the class USBTester.cpp to go along with it.
@AGlass0fMilk, thank you for your changes. |
The scope of the change is way too large; there is change on BLE that shouldn't be here. I think it would be better to wait for #10441 to be merged and see what's left. |
Yeah, I mistakenly thought #10441 had already been merged in. I can rebase once that has been merged into master and this PR should become a lot smaller. |
It was merged, can this be rebased? |
Yeah I have a rebase done (it was complicated by rebasing on a rebase and all the commit hashes changed) but I want to run the tests on it before I submit a new PR. There wasn’t an MSD or HID test when I originally tested this implementation. Hopefully I can get some time today to test it and submit a new PR. |
Closing, see new rebased PR: #10526 |
Description
Implemented USBPhy on the Nordic nRF52840 target.
nrf_drv_usbd.*
)usb/device/targets/TARGET_NORDIC/...
Extensive testing has been done and the basic USB test suite has passed hundreds of times. Admittedly, I have only been building with the
GCC_ARM
toolchain.See comments on #7674 for test results
See original PR here: https://github.com/TacoGrandeTX/mbed-os/pull/10
Pull request type
Reviewers
@0xc0170
@c1728p9