Skip to content

Commit 6346ba8

Browse files
author
Marcus Chang
committed
Improve serial performance for NRF52 series
Time sensitive user callbacks are called through lowest priority SWI handlers instead of the highest priority UART handler.
1 parent ddc709a commit 6346ba8

File tree

2 files changed

+189
-134
lines changed

2 files changed

+189
-134
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,16 @@ The table must be placed in a C compilation file.
142142

143143
Because each DMA buffer must be at least 5 bytes deep, each buffer is automatically flushed after a certain idle period to ensure low latency and correctness. This idle timeout is implemented using 2 of the 4 channels on RTC instance 2. This leaves RTC0 for the SoftDevice and RTC1 for Mbed tickers.
144144

145-
The RTC2 ISR is set at the lowest interrupt priority to ensure that UARTE interrupts take precedence. The last 2 of the 4 RTC channels are used for decoupling UARTE ISR context from Mbed IRQ events. This ensures that any user code will only delay other user callbacks and idle flushing and puts an upper bound on the interrupt handling time for the UARTE ISR.
145+
146+
#### SWI2, SWI3, SWI4, and SWI5
147+
148+
To minimize the time spend in the highest priority interrupt handler all callbacks to the user provided IRQ handlers are deferred through Software Interrupts running at lowest priority. SWI 2-5 are reserved by the serial implementation.
146149

147150

148151
#### Asserts
149152

150153
The nordic asserts have been redirected to mbed error handling when building in debug mode.
151-
The SDK file `mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_14_2/libraries/util/nrf_assert.h` was modified to enable the asserts when NDEBUG is not defined.
154+
The SDK file `mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_14_2/libraries/util/nrf_assert.h` was modified to enable the asserts when NDEBUG is not defined.
152155

153156
The assert handler is defined in mbed-os/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5x/source/btle/btle.cpp : assert_nrf_callback() which forwards assert failures to thye mbed error() handler.
154157

0 commit comments

Comments
 (0)