RTOS and Yield on nRF

I'm using an nRF52840 Adafruit Express + a LoRa module (RFM95W). The loop() currently runs at NORMAL priority on the Adafruit Express (via RTOS).

I was wondering if I add a yield() at the top of every loop execution, will RTOS execute lower priority tasks? Or do I need to use delay() instead?

I know this isn't exactly Arduino programming, but I am running in the Arduino IDE :slight_smile:


Under the Arduino IDE loop() runs at priority 1. The defined tasks should be given a priority higher then 1, with freeRTOS.

There should not be any code in loop() under freeRTOS.

Task creation. Note the task handle is normally a NULL.

 xTaskCreatePinnedToCore ( fGetIMU, "v_getIMU", TaskStack40K, NULL, Priority4, &xHANDLE_GetIMU, TaskCore0 );

loop() under freeRTOS

void loop() {} // loop

freeRTOS API: FreeRTOS API categories

Under freeRTOS do not use delay(x)!

Instead us the non-blocking vTaskDelayUntil or vTaskDelay. vTaskDelayUntil works quite well as a replacement for millis().

Thanks for the info. I answered my own question. If you use yield(), it will allow other tasks to execute.