I need to include RTOS support in my NRF52840-based system. In order to obtain a good FreeRTOSConfig.h I've looked at the four examples in NRF5 that include FreeRTOS and, aside from choice of heap size (4 kbytes or 8 kbytes) and, in the case of usbd_ble_uart_freertos, use of the idle hook, they are identical, so I just picked 8 kbytes and no idle hook.
However, as soon as I call vTaskDelay() I end up in a hardfault in xPortPendSVHandler(), similar to this ticket:
https://devzone.nordicsemi.com/f/nordic-q-a/49587/freertos-context-switch-hardfault
Unfortunately I can't divine an answer from that ticket, so I'd like to ask for clarification on how interrupt priorities, which seem a likely cause of my problem, should be set. All four example FreeRTOSConfig.h files say the same thing on this topic:
...where app_util_platform.h sets _PRIO_APP_HIGH to 2 for a Cortex M4. The NRF5 v16 documentation says:
...but I've searched the entire NRF5 directory and I can't find NRF_APP_PRIORITY_LOW in it. Could this really mean _PRIO_APP_LOWEST, which I believe app_util_platform.h sets to 7 for a Cortex M, or maybe _PRIO_THREAD, which is 15 for a Cortex M and happens to match the value for configLIBRARY_LOWEST_INTERRUPT_PRIORITY in the example FreeRTOSConfig.h files (though setting an "interrupt" priority value to a thread priority value seems odd)?
Can anyone advise whether the example FreeRTOS configuration files are correct and I should look elsewhere for my hardfault resolution, or whether there is something I need to change, maybe connected with NRF_APP_PRIORITY_LOW?
In case it is of use the hardfault details are:
Rob