Commit Graph

414 Commits (266d4c43a2e382d7013a98ca6a1cc14a5ffb83b5)

Author SHA1 Message Date
Marcus Chang fd088d2c4e Allow STDIO pins to be NC in NRF52 series
Prevent ASSERT from triggering when one of the STDIO pins is not
connected.
2018-07-11 17:19:18 -07:00
Marcus Chang 6f0bb757f4 Fix linker script for NRF52840/IAR
Add missing noinit section.
2018-07-11 15:48:51 -07:00
Marcus Chang 4bb84fdb71 Change NRF52 series UART to only use one SWI channel
This fixes conflicts with the SoftDevice.
2018-07-09 12:54:09 -07:00
Marcus Chang cfb99d689a Fix inconsistent SWI configuration in NRF52 series
All SWI channels except SWI0 is being used by the SoftDevice and
not only SWI1.
2018-07-09 12:54:09 -07:00
Marcus Chang 01135e30ce Remove white space in config files for NRF52 series 2018-07-09 12:54:08 -07:00
Marcus Chang a0224ed794 Fix interrupt initialization for NRF52 series
In some cases the UARTE interrupt would be enabled with pending
interrupts. This commit ensures that interrupts are only enabled
from a known state.
2018-07-02 11:13:50 -07:00
Martin Kojtal 44acaf587b
Merge pull request #7369 from marcuschangarm/fix-nrf52-serial
Fix race condition in serial_api.c for NRF52 series
2018-07-02 17:24:16 +02:00
Martin Kojtal 58fa28b9b2
Merge pull request #7313 from mprse/NRF52840_ticker_width_fix
NRF_52840: Fix us ticker counter size
2018-06-29 10:10:40 +02:00
Marcus Chang 2d71866028 Fix typo in NRF52 series README.md
UART configuration parameters mispelled.
2018-06-28 16:38:29 -07:00
Marcus Chang fc087ab32c Fix race condition in serial_api.c for NRF52 series
* Elevate RTC2 interrupt priority to same level as UARTE to prevent
race condition on shared variables.
* Remove unused TXDRDY event code.
* Fix typo in macro.
2018-06-28 16:36:16 -07:00
Przemyslaw Stekiel 9966110dd9 NRF_52840: Fix us ticker counter size
It has been noticed that there is a problem with us ticker on NRF_52840 board after 32 bit counter has been used for us ticker on NRF52 family boards.
Currently NRF52 symbol is defined only for MCU_NRF52832 (not for MCU_NRF52840) and based on this symbol 16 or 32 bit counter is selected (16 bit for NRF51 family and 32 for NRF52 family).
Since MCU_NRF52840 defines NRF52840_XXAA and provides 32 bit counters, 32 bit counter should be selected also when NRF52840_XXAA symbol is defined.
2018-06-27 15:33:07 +02:00
Marcus Chang 6346ba87c0 Improve serial performance for NRF52 series
Time sensitive user callbacks are called through lowest priority
SWI handlers instead of the highest priority UART handler.
2018-06-25 17:15:40 -07:00
Marcus Chang ddc709acec Make serial_putc non-blocking for the NRF52 series
Previous implementation would block until character had been
completely sent, which is not what the API specifies.
2018-06-25 13:19:15 -07:00
Marcus Chang a42f1d7a81 Remove whitespace from NRF52 serial_api.c 2018-06-25 13:16:11 -07:00
Cruz Monrreal 446de6947a
Merge pull request #7145 from drahnr/master
NRF52: add a separate .nvictable section and allow .noinit to be used…
2018-06-21 23:32:22 -05:00
Cruz Monrreal 0b8f46763a
Merge pull request #7220 from melvinvdb/fix_nrf5x_interrupt_pull_mode
Fix mbed::InterruptIn.mode() in NRF5x targets
2018-06-21 10:31:48 -05:00
Bernhard Schuster 124e15f196 NRF52: attempt to complete 86ce955d96 for ARMCC and IAR 2018-06-21 13:24:49 +02:00
Marcus Chang 6cec180d0b Fix SPI initialization for NRF52 series
New changes to Mbed error reporting in 5.9 exposed bug in SPI
driver where an instance was uninitialized twice which triggered
an ASSERT.

This fix keeps track of which instance has been initialized and
only calls uninit when it is safe.
2018-06-20 15:09:14 -07:00
Cruz Monrreal 84d6b79dec
Merge pull request #7172 from mprse/NRF5x_updates
Unify RTC, lp ticker, and us ticker for NRF51 and NRF52 series
2018-06-20 16:08:05 -05:00
Melvin van den berg 4986daaa7d - Fixed coding style
- Set default pull mode to PullNone in gpio_irq_init
2018-06-19 13:11:31 +02:00
Przemyslaw Stekiel 02d7d25850 us_ticker_set_interrupt: fix bit-shift operation 2018-06-19 08:55:35 +02:00
Przemyslaw Stekiel 80fabcb125 Use lp_ticker.c for NRF51 and NRF52 boards 2018-06-19 08:47:06 +02:00
Przemyslaw Stekiel 4a8de084b9 Use common_rtc.h for NRF51 and NRF52 boards 2018-06-19 08:47:05 +02:00
Przemyslaw Stekiel b073720d62 NRF5x: Increase lp us ticker interrupt priority
Set the second highest user level, leaving the highest for UART (we are having constant overflows) and two levels below for everything else.
This should increase the timer accuracy.
2018-06-19 08:47:05 +02:00
Przemyslaw Stekiel 7e222f2994 NRF5x: Add bug fix for the first timer read.
It has been noticed that first read value can not be trusted.
2018-06-19 08:47:04 +02:00
Przemyslaw Stekiel 1583cbc78e Use common us_ticker.c for NRF51 and NRF52 boards 2018-06-19 08:47:04 +02:00
Przemyslaw Stekiel cca4090bf6 NRF51, NRF52: Implement us_ticker_free() function. 2018-06-19 08:46:44 +02:00
Melvin van den berg 5fadb26f14 Fixed broken InterruptIn.mode() in NRF5x target which didn't do anything: interruptIn always remained with pullup resistor enabled. 2018-06-14 16:54:03 +02:00
Cruz Monrreal b989afaf79
Merge pull request #6178 from andrewleech/nrf51_16k_s130_linker
Add target definition: nrf51 16k on MCU_NRF51_UNIFIED platform
2018-06-11 09:05:16 -05:00
Cruz Monrreal cbee41c6f7
Merge pull request #7150 from pan-/fix-armcc-nrf-sections
Nordic: Fix nrf sections on ARMCC
2018-06-11 08:52:10 -05:00
Cruz Monrreal bacf6a9dec
Merge pull request #6860 from andrewleech/nordic_ble_config
Nordic BLE: Allow configuration of softdevice parameters
2018-06-07 10:10:23 -05:00
Przemyslaw Stekiel 4d56b006d1 common_rtc_set_interrupt: Wrap <ticks_count> before comparisons
RTC counter is 24-bit. Upper layer handles counter size and wraps ticks count when interrupt is to be fired before passing it to common_rtc_set_interrupt(), but for consistency and safety reasons we can wrap it again in the NRF driver.
2018-06-07 16:06:08 +02:00
Przemyslaw Stekiel ccba52b45b NRF5x: Remove duplicate lp ticker initialization from I2C, flash, trng. 2018-06-07 16:05:56 +02:00
Przemyslaw Stekiel e5e53e5e48 NRF52_DK: Use 32 bit counter for us ticker (instead 16 bit counter) 2018-06-07 16:00:55 +02:00
Vincent Coubard 16ece66f95 Nordic: Fix nrf sections on ARMCC
The nrf section features has different implementations for each compilers supported by mbed-os. The header guard was ruling out compiler other than GCC by checking if __GNUC__ is defined. This check is not applicable on mbed os as the ARM compiler compile sources with gnu compatibility.

This patch makes sure that the right implementation is selected for the right compiler . The previous patch has been reverted as it is not reliable.
2018-06-06 17:18:28 +01:00
Bernhard Schuster 86ce955d96 NRF52: add a separate .nvictable section and allow .noinit to be used by the application 2018-06-06 14:04:15 +02:00
Cruz Monrreal 20a4412082
Merge pull request #7089 from paul-szczepanek-arm/fix-master
BLE fixes (SM whitelist creation, Nordic scatter file fix, missing TLS initialisation)
2018-06-04 10:44:54 -05:00
Anna Bridge 2d0e5f04b1
Merge pull request #6022 from andrewleech/nrf_asserts_error
nrf5x: Enable asserts -> mbed_error
2018-06-04 12:24:58 +01:00
Vincent Coubard dfcdbbfb14 Nordic FIX: place observers sequentially in flash. 2018-06-01 16:59:09 +01:00
Andrew Leech bf313aa1db Move mbed_lib.json from targets folder to feature_ble folder
The functionality added all affects BLE features in use so this location is a better fit.
2018-06-01 13:37:16 +10:00
Andrew Leech c1c425af08 Expose softdevice configurations via new nordic-ble library definition file 2018-06-01 13:37:15 +10:00
Cruz Monrreal cb3f8a5ad3
Merge pull request #7022 from marcuschangarm/fix-gpio
Fix array overflow in gpio configuration code for NRF5x
2018-05-29 10:43:23 -05:00
Przemyslaw Stekiel 3850c80b43 Make common_rtc.c compatible with SDK 14.2 and move it common dir 2018-05-25 12:33:43 -05:00
Przemyslaw Stekiel 1d1b6cd571 NRF52_DK: disable us ticker in deep-sleep mode
This functionality is required by new sleep standards.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel 9ef0083f92 NRF52_DK: use new ticker driver designed for NRF51_DK 2018-05-25 12:33:41 -05:00
Przemyslaw Stekiel fac7d744d5 Disable us ticker in deep-sleep mode. 2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel 77f738baac Move common_rtc.c and us_ticker.h files to the valid directory.
I decided to move these files to the targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51 since us_ticker.h is for sure specific for NRF51_DK and common_rtc.c might be valid also for NRF52, but this needs to be checked while porting NRF52_DK board.
2018-05-25 12:29:55 -05:00
Przemyslaw Stekiel bdfbad8422 Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER. 2018-05-25 12:29:55 -05:00
Przemyslaw Stekiel af2863a9e5 Update lp ticker to be consistent with the new standards.
Provide the following modifications for lp ticker driver:
- According to NRF51_DK reference manual rtc interrupt cannot be controlled by rtc event. In the previous implementation interrupts were enabled permanently and specific interrupt was enabled/disabled by enabling/disabling the specific event. If event is enabled, then event signal is provided to Programmable Peripheral Interconnect (PPI). If interrupt is enabled, then interrupt signal is provided to Nested Vector Interrupt Controller (NVIC). Disable all events permanently. Enable lp ticker overflow interrupt permanently(needed for RTC), disable lp ticker capture/compare interrupt on init (lp_ticker_init) , enable lp ticker interrupt when lp ticker interrupt is set (lp_ticker_set_interrupt), disable lp ticker interrupt on disable request(lp_ticker_disable_interrupt).
- Provide lp ticker data for higher level (freq: 32kHz / len: 24 bits),
- Add the following features to init routine: disable lp ticker interrupt.
- Make ticker driver to operate on ticks instead of us.
- Simplify lp ticker read and set interrupt routines (upper layers handle conversion to us and interrupt scheduling).
2018-05-25 12:29:54 -05:00
Przemyslaw Stekiel 533ad59669 NRF5 - make us ticker to be driven by high speed 1MHz timer
According to new ticker standards the following requirements for us ticker are not met on RRF5 boards:
- has a frequency between 250KHz and 8MHz (currently is driven by 32kHz clock)
- ticker increments by 1 each tick (currently is scaled to 1 MHz by incrementing counter by ~31)

Since BLE softdevice uses TIMER0 the proposition is to use high speed TIMER1 for us ticker configured as follows:
- TIMER counter width: 16 bits (max)
- TIMER frequency: 1MHz
This solution also uses Timer's capture/compare register 0 to specify interrupt time and Timer's capture/compare register 1 to read current timer value.
2018-05-25 12:29:54 -05:00
Bartek Szatkowski 2d19ac1d60 Make sure LPTICKER symbols are not used for builds without it for Nordic 2018-05-25 12:20:09 -05:00
Bartek Szatkowski 6e9f04bf2f Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
That's to match DEVICE_USTICKER.
2018-05-25 12:20:09 -05:00
Steven Cartmell 18943a9693 Add lp/us ticker free() function implementation for NRF5 2018-05-25 12:17:49 -05:00
Marcus Chang 86f6054ea4 Fix array overflow in gpio configuration code for NRF5x
Reintroduce PR #6021

https://github.com/ARMmbed/mbed-os/pull/6021

which was accidentally removed by PR #6711

https://github.com/ARMmbed/mbed-os/pull/6711
2018-05-25 08:25:58 -07:00
Cruz Monrreal 791620c428
Merge pull request #6932 from paul-szczepanek-arm/security-manager-dev
BLE privacy, signing, persistent security database
2018-05-24 10:07:06 -05:00
Cruz Monrreal 2f86c152f0
Merge pull request #6794 from RonEld/cc310_porting
Cryptocell 310 support
2018-05-24 10:05:46 -05:00
paul-szczepanek-arm 80137be991 Merge https://github.com/ARMmbed/mbed-os into security-manager-dev 2018-05-23 09:47:06 +01:00
Andrew Leech 78d31cff5c Fix the flash length to use all of 256K part. 2018-05-23 09:50:52 +10:00
Martin Kojtal 585504f723
Merge pull request #6959 from marcuschangarm/remove-itm
Remove unused ITM implementation from NRF51 series
2018-05-22 14:40:57 +02:00
Andrew Leech 3300d2898b nrf51_16k_s130 Fix flash origin for APP_CODE_BASE
For details see: http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s130.sds%2Fdita%2Fsoftdevices%2Fs130%2Fmem_usage%2Fmem_resource_reqs.html

Set the ram start to 0x20002ef8 to be consistent with ATM_STD and IAR linker scripts
2018-05-22 11:40:10 +10:00
Andrew Leech 67140a2706 Redirect NRF asserts to mbed error() in TARGET_NRF5x and SDK 14.2
Add related details to TARGET_NRF5x Readme's
2018-05-22 11:36:31 +10:00
Andrew Leech 5bb3ede890 Comment out the assert test that requires non-existent symbols from linker 2018-05-22 11:36:30 +10:00
Andrew Leech 244b7a5c69 Only enable DEBUG_NRF_USER when NDEBUG is not set 2018-05-22 11:36:30 +10:00
Andrew Leech f49070c876 Address known typo in nrf sdk 11
ref: https://devzone.nordicsemi.com/f/nordic-q-a/14000/nrf_drv_adc-c-doesn-t-compile-with--ddebug_nrf
2018-05-22 11:36:30 +10:00
Ron Eldor 23ba8bc1f5 Change Cryptocell target to a feature
Change the Cryptocell310 target to `FEATURE_CRYPTOCELL310`
2018-05-21 13:40:43 +03:00
Marcus Chang d27c4c920c Remove unused ITM implementation from NRF51 series
NRF51 doesn't support SWO out.
2018-05-18 11:26:13 -07:00
Marcus Chang ef9bc9ccc9 Add NRF52 support for building bootloader and updateable firmware
New directory structure:

 * TARGET_SOFTDEVICE_COMMON
 * TARGET_SOFTDEVICE_S112
 * TARGET_SOFTDEVICE_S132_FULL (MBR + SoftDevice, default)
 * TARGET_SOFTDEVICE_S132_OTA (SoftDevice only, for firmware updates)
 * TARGET_SOFTDEVICE_S132_MBR (MBR only, for bootloader builds)
 * TARGET_SOFTDEVICE_S140_FULL (MBR + SoftDevice, default)
 * TARGET_SOFTDEVICE_S140_OTA (SoftDevice only, for firmware updates)
 * TARGET_SOFTDEVICE_S140_MBR (MBR only, for bootloader builds)
 * TARGET_SOFTDEVICE_NONE

The X_OTA and X_MBR binaries are obtained from the original x_FULL SoftDevice
by splitting it in an MBR part and a SoftDevice part. The MBR is needed for
the bootloader and the SoftDevice for firmware updates.

Build application without SoftDevice:

  "target_overrides": {
      "*": {
          "target.extra_labels_remove": ["SOFTDEVICE_COMMON", "SOFTDEVICE_X_FULL"],
          "target.extra_labels_add": ["SOFTDEVICE_NONE"]
      }
  }

Build application for firmware update using SoftDevice X:

  "target_overrides": {
      "*": {
          "target.extra_labels_remove": ["SOFTDEVICE_X_FULL"],
          "target.extra_labels_add": ["SOFTDEVICE_X_OTA"]
      }
  }

Build bootloader without SoftDevice X:

  "target_overrides": {
      "*": {
          "target.extra_labels_remove": ["SOFTDEVICE_COMMON", "SOFTDEVICE_X_FULL"],
          "target.extra_labels_add": ["SOFTDEVICE_X_MBR"]
      }
  }
2018-05-17 07:32:09 -07:00
Vincent Coubard 6c44a78166 Merge branch 'master' of https://github.com/ARMmbed/mbed-os into security-manager-dev 2018-05-16 15:55:15 +01:00
Vincent Coubard ca5a9f359a Nordic BLE: remove unecessary nordic ble libraries. 2018-05-15 14:51:19 +01:00
Vincent Coubard a22b4e5d5e Nordic BLE: Remove nordic gap init.
This initialization is already done in GattServer.
2018-05-15 14:51:18 +01:00
Vincent Coubard f5ac8d69ce Nordic: Adjust RAM requirements. 2018-05-15 14:51:16 +01:00
Vincent Coubard ed20b17d29 Nordic BLE: Fix link count 2018-05-15 14:51:16 +01:00
Ron Eldor c5ea8d71bb Change to DEVICE_CRYPTOCELL definition
Change `#if DEVICE_CRYPTOCELL` to `#if defined(DEVICE_CRYPTOPCELL)`
2018-05-14 18:34:10 +03:00
Ron Eldor 39973c8a8e Move trng code from target_nrf5 to target_nrf5x
After rebase, the build target NRF52840_DK is using TARGET_NRF5x,
instead of TARGET_NRF5. Moved Cryptocell TRNG related code from
`targets/TARGET_NORDIC/TARGET_NRF5/` to `targets/TARGET_NORDIC/TARGET_NRF5x/`
2018-05-14 13:15:57 +03:00
Ron Eldor 340f22e3cd Add support for CC trng
add support for HW entropy source
2018-05-14 13:15:27 +03:00
Marcus Chang 6af843fceb Trim white space and clean up NRF52 configuration files
Removed unused and duplicate macros.
2018-05-13 22:31:17 -07:00
Cruz Monrreal 2104d8ab5b
Merge pull request #6711 from marcuschangarm/cleanup-nrf5x
Cleanup TARGET_NRF5 and TARGET_NRF5x
2018-05-11 19:15:05 -05:00
Marcus Chang 34775d6431 Remove obsolete OS_IDLE_THREAD_STACK_SIZE from NRF52
Custom size is the same as the default size anyway.
2018-05-08 15:51:39 -07:00
Marcus Chang 1aebdcbee5 Reorganize TARGET_MCU_NRF51822_UNIFIED directories
The unified NRF51 target and feature BLE directories have been
reorganized to follow the naming and directory structure of the
NRF52 implementation.

This reorganization does not include TARGET_MCU_NRF51822 and
derived targets.
2018-05-08 10:10:01 -07:00
Marcus Chang 1360920e77 Remove unused NRF52 SDK and MCU files
Superseded by new SDK 14.2 in https://github.com/ARMmbed/mbed-os/pull/6547
2018-05-07 12:18:29 -07:00
Cruz Monrreal e023bb67c4
Merge pull request #6771 from marcuschangarm/fix-uart-init
Fix UART initialization for NRF52
2018-05-07 10:35:40 -05:00
Martin Kojtal 5a77f42882
Merge pull request #6796 from marcuschangarm/fix-nrf52-tick
Fix us_ticker for NRF52 series
2018-05-07 08:17:58 +01:00
Marcus Chang 41c1654a49 Fix bug in MBR for NRF52 series
The MBR VTOR state depends on how the application is booted.
This makes it difficult to initialize the MBR correctly since a
bug prevents the MBR from being initialized more than once.

This commit resets the MBR and SoftDevice to a known state before
initializing the MBR and setting the VTOR through the SoftDevice.
2018-05-02 21:10:41 -07:00
Marcus Chang b8f22bbec1 Fix us_ticker for NRF52 series
Changed comparison function when setting ticker timeout to fix
tickers not set correctly.
2018-05-02 16:10:14 -07:00
Marcus Chang a1a329606b Fix UART initialization for NRF52
Delayed initialization can cause problems when both UARTE instances
are in use. This change causes each UART object to initialize the
underlying UARTE instance immediately.
2018-05-02 15:07:13 -07:00
Jimmy Brisson d08c819830
Merge pull request #6746 from marcuschangarm/fix-vector-relocation
Fix vector table relocation for NRF52
2018-04-30 13:51:22 -05:00
Cruz Monrreal e1cc4559cf
Merge pull request #6748 from andrewleech/nrf52_serial_match_assert
nrf5x: Fix assert test on SERIAL_RESERVED_CHAR_MATCH
2018-04-30 11:50:05 -05:00
Marcus Chang bb14051588 Fix vector table relocation for NRF52
The vector table relocation sequence depends on:

1. Whether the SoftDevice is present.
2. The Application is a bootloader or not.

If the SoftDevice is present and the application is a bootloader
the MBR must be initialized to trap SoftDevice service calls
before setting the new vector table address.

The SCB->VTOR must be set to point at the MBR as well.

If the SoftDevice is not present the SCB->VTOR can point at the
new vector table directly.
2018-04-27 13:40:50 -07:00
Cruz Monrreal 487576972b
Merge pull request #6720 from marcuschangarm/fix-sdk-spi
Fix bug in Nordic SDK 14.2 SPI driver
2018-04-26 20:17:36 -05:00
Cruz Monrreal 9d6d8c7273
Merge pull request #6721 from marcuschangarm/fix-sdk-i2c
Fix bug in Nordic SDK 14.2 I2C driver
2018-04-26 20:17:25 -05:00
Andrew Leech 627d028f3e nrf5x: Add description to assert on SERIAL_RESERVED_CHAR_MATCH 2018-04-27 11:05:47 +10:00
Marcus Chang 3edfc77949 Fix bug in Nordic SDK 14.2 I2C driver
Interrupts were not enabled before transmitting data leading to
missed interrupts.
2018-04-23 16:38:31 -07:00
Marcus Chang cba7e0df06 Fix bug in Nordic SDK 14.2 SPI driver
Interrupts were not enabled before transmitting data leading to
missed interrupts.
2018-04-23 16:08:44 -07:00
Marcus Chang 6db4425351 Fix NRF52 SPI pin initialization
SPI pins are not initialized correctly according to the current
SPI mode.

This commit changes how the SPI instance is configured and ensures
that:

1. SPI pins are initialized on each object initialization.
2. SPI pins are reinitialized on each mode or object change.
3. SPI instance is only initialized when a change has occured.
2018-04-23 14:27:33 -07:00
Marcus Chang b964420bbc Reorganize targets.json for NRF52 based targets
* Consolidated device_has and macros to the main MCU targets.
* Moved errata configuration to mbed_lib.json for HAL implementation.
* Moved clock configuration to mbed_lib.json for HAL implementation.
* Moved UART configuration to mbed_lib.json for HAL implementation.
2018-04-19 09:41:05 -07:00
Marcus Chang 2c651afd11 Updated target MTB_LAIRD_BL652 to use SDK 14.2 2018-04-19 09:40:41 -07:00
Marcus Chang b9f91b3839 Fix off-by-one error in NRF52 serial implementation 2018-04-19 09:40:41 -07:00
Marcus Chang 18fa9414cd Add resource management for serial for the NRF52 family
Instance counter keeps track of how many objects have been
initialized and freed. On the first object the instance is
enabled and on the last object the instance is disabled.
2018-04-19 09:40:41 -07:00
Marcus Chang cafa8ae752 Fix serial_putc bug in NRF52 family
serial_putc didn't work when called with interrupts disabled.
2018-04-19 09:40:41 -07:00
Marcus Chang 3663494bd9 Serial re-implementation for the NRF52 series
Serial implementation uses UARTE instead of UART peripheral:

* EasyDMA is used for reading and writing data.
* Triple buffering for receiving data.

See README for full description.
2018-04-19 09:40:41 -07:00
Marcus Chang 9502011d96 README file for NRF52 HAL implementation
Added SPI and I2C section.
2018-04-19 09:40:41 -07:00
Marcus Chang fc8f0e1aa4 I2C HAL update for NRF52
When possible, the I2C HAL will now use the TWI driver in SDK 14.

The manual I2C API still maps onto the old TWI peripheral directly
because the TWI driver doesn't provide the needed low-level functionality.
2018-04-19 09:40:41 -07:00
sarahmarshy c9d16e9e89 Implement SPI API for NRF52x
Implement spi_api.c for NRF52X boards using SDK14.

This driver does not implement SPI slave functions and does not use SPIM.
2018-04-19 09:40:41 -07:00
Marcus Chang d11f74cb4c NRF52 series PWM reimplementation for SDK 14.2
Driver uses new API in SDK 14.2
2018-04-19 09:40:41 -07:00
Marcus Chang cfb480447a NRF52: fix us_ticker IRQ handler
Applying PR to NRF52 SDK 14.2:
https://github.com/ARMmbed/mbed-os/pull/5046
2018-04-19 09:40:41 -07:00
Marcus Chang 8dd627621e Fix ISR stack size inconsistencies on NRF52 series
GCC and IAR ISR stack sizes have been set to 0x800.
(ARM compiler does not set stack size explicitly).
2018-04-19 09:40:41 -07:00
Marcus Chang 6db7e68db5 Helper functions for sharing hardware peripherals on NRF52
Common functions for getting and setting the instance owner of a
hardware peripheral. Used for reconfiguring SPI/I2C after change
of ownership.
2018-04-19 09:40:41 -07:00
Blackstone Engineering ea6c0078c7 Extended PeripheralPins and pinmap for NRF52 series
The NRF52 series can map digital signals to any physical pin which
makes it challenging to associate pin names with hardware instances.

pinmap_ex:
  Keep track of which hardware instance is in use and what pins are
  associated with it. Currently only supports I2C and SPI, but
  provides a mechanism for allocating the shared I2C/SPI hardware.

PeripheralPinsDefault:
  Optional pin map for pre-assigning hardware instances at compile
  time. This makes it easier to optimize hardware utilization.
2018-04-19 09:40:41 -07:00
Marcus Chang f0d1424768 Update analogin_api.c for NRF52 SDK 14.2
Use new SDK API and fixed return value to be normalized to 16 bit
as per the Mbed HAL specification.
2018-04-19 09:40:41 -07:00
Donatien Garnier 64baf717e8 Upgrade NRF52 BLE API to version 5
* Add NRF_SD_BLE_API_VERSION=5 macro to MCU_NRF52832 target
* Added initial Softdevice v5 API support for nRF5XPalGattClient.cpp
* Added initial Softdevice v5 API support for nRF5xGap.h
* Added initial Softdevice v5 API support for nRF5xGattServer.cpp
* Make sure the ah() hash function used by the security manager is declared with C linkage
* Removed 'ARM porting pending' checks in Nordic SDK
* Added BLE configuration to mbed_lib.json for NRF52x targets
* Migrated APIs and events model for Nordic SDK14.2 & SD API v5 in btle.cpp; adopted polling dispatch model
* Migrated APIs and events model for Nordic SDK14.2 & SD API v5 in nRF5xn.cpp
* Migrated APIs and events model for Nordic SDK14.2 & SD API v5 in nRF5xGap.cpp
* Added const qualifier to hwCallbacks's p_ble_evt parameter in nRF5xGattServer
* Add workaround to enable Radio Notification module from Nordic SDK
  * Disabled SWI1 interrupt manually from SWI driver module
    * Added missing include directive for "nrf_nvic.h" in ble_radio_notification.c
* Set correct number of custom UUIDs
* Adjust Softdevice RAM requirements for NRF52832/S132
  * RAM settings for the application were adjusted as follow:
    * Start: 0x20003800
    * Size: 0xC800
* Adjust Softdevice RAM requirements for NRF52840/S140
  * RAM settings for the application were adjusted as follow:
    * Start: 0x20003700 (was 0x20003000)
    * Size: 0xC900
* Added 3dBm as a permitted TX Power value for NRF52832
* Fix address type recovery in GAP
* Return min non-connectable adv interval compatible with infrastrcture's expectations
* Moved BLE driver from TARGET_SDK_14_2/FEATURE_BLE to TARGET_SDK_14_2/TARGET_SOFTDEVICE_COMMON/ble
2018-04-19 09:40:41 -07:00
Marcus Chang fa79e685fc Fix TRNG for NRF52
* When multiple TRNG objects are initialized, destroying the first
  object will turn the TRNG off for the other objects. This fix
  adds a counter to ensure that only when the last object is
  destroyed will it cause the TRNG to be disabled.

* The corner case where a user request 0 bytes is correctly handled
  and will now return immediately.
2018-04-19 09:40:41 -07:00
Marcus Chang 3b9ec4932c Flash storage for NRF52
Add fstorage and fds from Nordic SDK for SoftDevice compatible
flash storage. Mbed HAL flash API mapped to use fstorage API
to ensure write and erase doesn't conflict with BLE operation.
2018-04-19 09:40:41 -07:00
Marcus Chang 2e7b5ba27b Fix linker scripts and startup code for NRF52
Various bug fixes:

 * Moved SPIM3 location in vector table based on new location in SDK 14.2.
 * Updated vector table entries and size in startup code and linker scripts.
 * Added missing vector table RAM section to IAR linker script.
2018-04-19 09:40:41 -07:00
Marcus Chang 00713342b9 Switch to managed bootloader for SoftDevice merge on NRF52
SoftDevice can be swapped even easier now:

    "target_overrides": {
        "*": {
            "target.extra_labels_remove": ["SOFTDEVICE_COMMON", "SOFTDEVICE_S140"],
            "target.extra_labels_add": ["SOFTDEVICE_NONE"]
        }
    }
2018-04-19 09:40:41 -07:00
Marcus Chang 39c69f146c Optional SoftDevice for the NRF52 series
Ability to swap SoftDevices using the mbed configuration system.

For example, build NRF52840_DK without SoftDevice:

    "target_overrides": {
        "*": {
            "target.MERGE_SOFT_DEVICE": false,
            "target.extra_labels_remove": ["SOFTDEVICE_COMMON", "SOFTDEVICE_S140"],
            "target.extra_labels_add": ["SOFTDEVICE_NONE"]
        }
    }

Pinned down vector table to beginningn of RAM.
2018-04-19 09:40:41 -07:00
Marcus Chang 770b1a326e Simplified critical_section_api.c for NRF52 series
Critical section enter/exit is now delegated to Nordic SDK's

sd_nvic_critical_region_enter
sd_nvic_critical_region_exit

When the SoftDevice is not included these functions map to

__disable_irq
__enable_irq
2018-04-19 09:40:41 -07:00
Marcus Chang 5c3e494a7e Renamed MCU_NRF52832 inheritance in MTB_UBLOX_NINA_B1 2018-04-19 09:40:41 -07:00
Marcus Chang c049921064 Add GCC linker sections for NRF52 SoftDevice 2018-04-19 09:40:41 -07:00
Marcus Chang cf61c240bf Update critical section for NRF5x 2018-04-19 09:40:41 -07:00
Marcus Chang efa3461fd4 Change target.json to use new SDK and folder structure for NRF52 2018-04-19 09:40:41 -07:00
Marcus Chang 3940d3abaf Default SDK configuration for NRF52832 and NRF52840 2018-04-19 09:40:41 -07:00
Marcus Chang 0b40ddc530 Initial mbed HAL implementation for NRF5x family
Copied from previous location in targets/TARGET_NORDIC/TARGET_NRF5

Core functionality is working but some peripherals do not.
2018-04-19 09:40:41 -07:00
Marcus Chang d861bda214 Pin configurations for NRF52840 based boards 2018-04-19 09:40:41 -07:00
Marcus Chang 56cf0921ad Pin configurations for NRF52832 based boards 2018-04-19 09:40:41 -07:00
Marcus Chang ad1b986913 Linker scripts and startup files for NRF52840
Flash and RAM offsets have been modified to fit new SoftDevice
2018-04-19 09:40:41 -07:00
Marcus Chang bff552de6c Linker scripts and startup files for NRF52832
Flash and RAM offsets have been modified to fit new SoftDevice
2018-04-19 09:40:41 -07:00
Marcus Chang fc2760ad04 NRF52832 and NRF52840 upgraded to Nordic SDK 14 and SoftDevice 5.0
Initial commit for separating NRF52 code from the NRF51 and for
combining the NRF52832 and NRF52840 SDK to version 14.

nRF5_SDK_14.2.0_17b948a.zip has been used as baseline.

The folders in SDK/components:
 * ble
 * boards
 * device
 * drivers_nrf
 * libraries
 * softdevice

have been copied to TARGET_NORDIC/TARGET_NRF52/TARGET_SDK14.

Each folder contains a README.md file describing any modifications
made to that particular folder. Most common operation is deletion
of files.

If the need arise in the future the missing files can be added again.

The SoftDevices have been moved to TARGET_SOFTDEVICE_x folders for
flexible selection.

ble.h has been renamed to nrf_ble.h to avoid namespace clash with
mbed OS BLE.
2018-04-19 09:40:41 -07:00
Martin Kojtal cf4c7a5d35
Merge pull request #6164 from ashok-rao/br-BL652
Adding Laird BL652 as new target
2018-03-08 17:45:01 +01:00
Marcus Chang 812b9be6d3 NRF5: Customize STDIO pins from config system 2018-03-05 10:12:18 -08:00
paul-szczepanek-arm 8e41de2e25 Merge branch 'master' of https://github.com/paul-szczepanek-arm/mbed-os 2018-02-27 17:23:25 +00:00
Cruz Monrreal 3d37d819e9
Merge pull request #5046 from fkjagodzinski/timerevent_tests
TimerEvent tests
2018-02-26 15:02:52 -06:00
Cruz Monrreal c9cefccbdc
Merge pull request #6116 from marcuschangarm/fix_trng_nrf52
Add TRNG for NRF52832
2018-02-26 12:09:43 -06:00
Maciej Bocianski cd539e3e38 us_ticker_irq_handler call optimization 2018-02-23 09:21:37 +01:00
Martin Kojtal 2661f6fe40 us ticker: fix fire interrupt handling
Few targets need more than just pending IRQ set. They include some flags to be
set that are checked in IRQ handler. This is the case for targets in this
commit.
2018-02-23 09:13:40 +01:00
Cruz Monrreal ee64c9cf0b
Merge pull request #6021 from andrewleech/gpiote_uninit
nrf5x: fix array overflow in gpio configuration code
2018-02-22 21:21:35 -06:00
Ashok Rao 65f210288c Adding Laird BL652 as new target 2018-02-22 11:49:58 +00:00
Marcus Chang 9439c191de Add TRNG for NRF52832
Use SoftDevice API to get random numbers when present and active,
otherwise read random numbers directly from TRNG peripheral.
2018-02-21 12:06:12 -08:00
Cruz Monrreal 80082278b8
Merge pull request #6124 from marcuschangarm/nrf52_flash_fix
Make NRF52 flash work with SoftDevice
2018-02-20 13:31:45 -06:00
Marcus Chang 0a1cae9352 Make NRF52 flash work with SoftDevice
How you write and ersae the flash on the NRF52 changes depending on
whether the SoftDevice is enabled or not.

This change does a runtime check before erasing and writing, and
then chooses the correct function to perform the action.
2018-02-16 13:54:27 -08:00
Marcus Chang 6aa0975d71 itm_api.c implementation for Nordic NRF52 series
SWO frequency: 4000 kHz
2018-02-16 08:24:42 -08:00
Cruz Monrreal ee52f9044a
Merge pull request #5892 from OSHChip/master
add OSHChip as an mbed target
2018-02-14 15:19:26 -06:00
Ashok Rao 6c8b9b5005 Added MTB aliases & default SPI 2018-02-06 13:44:24 +00:00
Andrew Leech f639777dce nrf5x: gpiote uninit only needs to be run if input pin is configured for irq (or output) 2018-02-06 12:51:03 +11:00
Ashok Rao 2e9c3340de Adding LAIRD_BL600 MTB 2018-02-01 17:21:37 +00:00
Cruz Monrreal b08e1b3078
Merge pull request #5837 from ashok-rao/br-ublox-NINA
Adding MTB ublox NINA-B1 as a new target
2018-01-30 14:55:43 -06:00
Ashok Rao e1d901204b Add license info 2018-01-29 12:20:00 +00:00
drewcassidy 5547a09f20
fix typo 😖 2018-01-25 08:24:39 -08:00
drewcassidy e06d1db8ac
Add pinout diagram 2018-01-25 08:24:39 -08:00
drewcassidy a6c69567ee
add board header files 2018-01-25 08:24:38 -08:00
Cruz Monrreal 671c2d7e90
Merge pull request #5346 from scartmell-arm/feature-hal-spec-critical-section
Add Critical Section HAL API specification
2018-01-16 12:49:38 -06:00