Skip to content

Conversation

AGlass0fMilk
Copy link
Member

Description

Implemented USBPhy on the Nordic nRF52840 target.

  • Added legacy driver files (nrf_drv_usbd.*)
  • Pulled in new errata fixes and driver changes from Nordic SDK version 15.3
  • Added implementation code for the USBPhy in 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

[ ] Fix
[ ] Refactor
[ X ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@0xc0170
@c1728p9

Filip Jagodzinski and others added 30 commits December 4, 2018 16:21
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
…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.
@ciarmcom ciarmcom requested review from a team April 25, 2019 11:09
@ciarmcom
Copy link
Member

@AGlass0fMilk, thank you for your changes.
@MarceloSalazar @0xc0170 @maclobdell @ARMmbed/mbed-os-crypto @ARMmbed/mbed-os-wan @ARMmbed/mbed-os-pan @ARMmbed/mbed-os-storage @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-test @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-core @ARMmbed/mbed-os-tls please review.

@adbridge adbridge requested review from bulislaw and removed request for a team April 25, 2019 15:07
@pan-
Copy link
Member

pan- commented Apr 25, 2019

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.

@AGlass0fMilk
Copy link
Member Author

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.

@AGlass0fMilk AGlass0fMilk changed the base branch from master to feature-nrf52-sdk15 April 26, 2019 15:32
@0xc0170
Copy link
Contributor

0xc0170 commented May 2, 2019

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?

@AGlass0fMilk
Copy link
Member Author

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.

@AGlass0fMilk
Copy link
Member Author

Closing, see new rebased PR: #10526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.