nRF5 SDK v17.1.0
Blinky RTC FreeRTOS Example

The Blinky RTC FreeRTOS example shows how to properly use hardware interrupts with FreeRTOS.

When the application starts, two GPIO pins are configured using the BSP module as outputs to drive the LEDs. Then, a new thread is started.

From the created thread, RTC is configured to generate an interrupt. Task negates the LED 1 state and starts waiting for the semaphore that will be set from an RTC interrupt.

The example presents the correct interrupt runtime construction that should be used with FreeRTOS:

Because of the Cortex-M functionality of PendSV, this function can be also called in the event handler that is not the real last instruction in the current ISR. It can be also called multiple times - the task scheduler will be processed only once, when all the interrupts have been processed.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\blinky_rtc_freertos

LED assignments:

Testing

Test the Blinky RTC FreeRTOS Example application by performing the following steps:

  1. Compile and program the application.
  2. LED 1 and LED 2 blink alternately.
Note
See FreeRTOS support for more information about FreeRTOS.

Documentation feedback | Developer Zone | Subscribe | Updated