Skip to content
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 USB Implementation #10526

Closed

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
This is a rebased version of this PR here: #10457

Pull request type

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

Reviewers

@0xc0170
@c1728p9

RFulchiero and others added 30 commits April 18, 2019 11:01
- top level files ported from TARGET_NORDIC/TARGET_NRF5x/

Also addressed:
- fixed linking issue for gcc
- added support for nRF52-DK builds, but reverted to using nRF52840 sdk_config.h (must be updated)
- introduced "RTC" to targets.json (might need to be removed eventually)
Also addressed:
- removed dependency on legacy config (excluded apply_old_config.h)
- removed legacy pwm and saadc headers
- Arm Compiler 5 linking issue (a band-aid for now... needs to
  be properly addressed for peripheral sharing)
- added missing header in SoftDevice file
- Missed some NRFX defines that needed to changed
- Set PWM base clock to 125kHz (needs to be reverted back to 1 MHz)
- Updated sdk_config.h for nRF52_DK builds
- Brought in updates from PR7779 (fix for nRF52 PWM issues)
Enable UART interfaces to enable serial debug prints.
Using the nrfx_get_irq_number only works with the handle. Since we
know the IRQ numbers for UART0, RTC2 and EGU0, use them directly.
- Use new NRFX header file
- Fix nRF52832 linker script/ld files (hardcoded addresses for now)
- Temporarily remove DEVICE_TRNG for nRF52832 (which broke the build)
- Improve serial_putc() fix so we don't rely on "extra" functions
- Added legacy nrf_drv_rng.c as there is no merit in fully adopting nrfx_rng.c
- Added nrf_queue library component
- Removed apply_old_config.h (unused for some time now)
- Updated sdk_config.h for queue and RNG support for nRF52832
- Brought back RNG into targets.json for nRF52832
Note: nRF52840 still uses CryptoCell 310 for TRNG
When the SoftDevice (SD) is enabled we need to set the app_offset
to 0x26000 to make room for the SoftDevice.  If we let the build
tools self-manage this, MBED_APP_START is coming out at 0x25000
which is not correct for the Nordic 15.0 SDK.

The app_offset value is translated to MBED_APP_START by the build
infrastructure.  We were hard coding MBED_APP_START in the scatter
and ld files as a temporary measure while testing.  This now sets
it properly if the SD is being brought in.
Ensure that vector table gets initialized properly. The table that we
initialize in startup_nrf52840.S gets wiped out as the section is
declared as noinit. Fix this by implementing the weak function mbed_sdk_init
that inits the vector table.
* Remove NRF_SDH_CLOCK parameters from mbed_lib.json
* Bring in QSPI for nRF52840
* Migrate legacy QSPI driver to SDK v15 (nrfx_qspi.h)
* Remove outdated comment in i2c_api.c
The 15.0 SDK doesn't support the nRF51 so it must continue to use the legacy
NRF drivers.  Thus the original common_rtc.c, gpio_api.c and us_ticker.c are
restored and placed under TARGET_NRF5x/TARGET_NRF51.

Likewise the modified common_rtc.c, gpio_api.c and us_ticker.c are moved to
TARGET_NRF5x/TARGET_NRF52 so they are excluded from nRF51 builds.
nRF5x PinNames.h never utilized PORT_SHIFT so removed for clarity after
user commented on it.
- Add MBR, NONE and OTA SoftDevice build options for S132 and S140
- Add S112 SoftDevice (single build option)
- Some folder restructuring in TARGET_SOFTDEVICE_COMMON was required
This reverts commit 3d2fa53.

This was a breaking change for the "MBR" and "NONE" builds.
After testing it was also determined that copying the vector
table a second time wasn't required for the "FULL" build.
* Update TARGET_NRF5x/README.md to improve "Changing SoftDevice" section
  and added section on NRF52840 CryptoCell310 Support
* Update the file list in TARGET_SDK_15_0/TARGET_SOFTDEVICE_COMMON/README.md
* Add missing CR-LF to Nordic-provided SDK file
* Rename a header file in the TARGET_SOFTDEVICE_S112 tree
 - Brought in new nrfx APIs
 - Brought in PPI additions
 - Removed dead code for RTC
@0Grit
Copy link

0Grit commented May 2, 2019

🤞

@maclobdell

@ciarmcom ciarmcom requested review from 0xc0170, c1728p9 and a team May 2, 2019 17:00
@ciarmcom
Copy link
Member

ciarmcom commented May 2, 2019

@AGlass0fMilk, thank you for your changes.
@c1728p9 @0xc0170 @ARMmbed/mbed-os-maintainers please review.

targets/targets.json Outdated Show resolved Hide resolved
@0xc0170
Copy link
Contributor

0xc0170 commented May 3, 2019

@AGlass0fMilk great work ! 💯

@AGlass0fMilk
Copy link
Member Author

@0xc0170 It seems the CI tests spuriously failed, can you restart it?

@j3hill
Copy link
Contributor

j3hill commented May 9, 2019

@AGlass0fMilk We are planning on merging the Nordic SDK 15 feature branch into Mbed OS master soon. Are these changes ready to be merged?

@AGlass0fMilk
Copy link
Member Author

@j3hill Yes, assuming all of your tests pass. If you want to merge the sdk15 branch in sooner I can retarget this PR to master once the sdk15 branch is merged in.

@AGlass0fMilk
Copy link
Member Author

@0xc0170 @j3hill Would you prefer to wait on this PR until the SDK15 feature branch has been merged into master? Can this code be run through your CI tests on the nRF52840_DK?

@AGlass0fMilk
Copy link
Member Author

@c1728p9 @0xc0170 @j3hill Any update on the SDK15 feature branch? This has been sitting here for a while with no review.

@j3hill
Copy link
Contributor

j3hill commented May 22, 2019

@AGlass0fMilk we are rebasing the Nordic SDK 15 feature branch over the next two days, and then it should go into Mbed OS master. Yes. I think it would be better to merge your excellent USB work once the SDK is in Mbed OS master.

@AGlass0fMilk AGlass0fMilk changed the base branch from feature-nrf52-sdk15 to master May 28, 2019 14:18
@j3hill
Copy link
Contributor

j3hill commented May 28, 2019

@AGlass0fMilk - Nordic SDK 15 has been merged into Mbed OS master in this PR: #10666. Do you have time to put in theses USB updates next?

@AGlass0fMilk
Copy link
Member Author

@j3hill I'm working on rebasing this PR to master now that SDK15 has been pulled in.

@AGlass0fMilk
Copy link
Member Author

Opening a new PR with the rebased branch.

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.

6 participants