This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Key sdk_config.h items for FreeRTOS RTC operation

I need FreeRTOS operation in my build. I've adopted the FreeRTOS.h file from the blinky_freertos example, unchanged aside from a larger heap size and setting INCLUDE_xSemaphoreGetMutexHolder to 1 'cos I need that.  I have verified that the example build works as intended on my NRF52840-DK board; FreeRTOS running with tickless idle from RTC, LEDs flashing as intended.

The problem I have is that my build hangs after a few hundred milliseconds. If I change FreeRTOS.h so that it uses SysTick instead of RTC then no such problem occurs.  Disabling configUSE_TICKLESS_IDLE doesn't make things better.  If I run under the debugger and pause it once things have hung it shows that the code has entered the idle task then, for some reason, the SPIM2_SPIS2_SPI2_IRQHandler(), which is not something I've enabled or am using so I guess is an artefact of the debugger, and then done nothing afterwards.

I call nrf_drv_clock_init() in main(), just as the blinky_freertos example does, so the likelihood is that a setting in my sdk_config.h file is somehow different-in-a-bad-way from that of the blinky_freertos example.  My sdk_config.h, originally derived from a different example, has 1155 #defines in it, in a different order to that of the blinky_freertos example, so it is quite difficult to find the needle in the haystack.

Hence my QUESTION is: what are the key things one needs to configure in sdk_config.h to achieve stable FreeRTOS operation with RTC as time base?

In case it's useful, find below a complete ZIP file containing a standalone build which reproduces my problem.

test.zip

Rob

Related