Getting started with FreeRTOS on nrf52

Hi, I'm trying to use FreeRTOS on a custom board featuring a nRF52832. I've started adapting the blinky_freertos example in the SDK 17.1.0 and replacing the code in led_toggle_task_function with the following snippet:

static int myVar;

static void led_toggle_task_function (void * pvParameter)
{
    UNUSED_PARAMETER(pvParameter);
    myVar = 0;
    while (true)
    {
        myVar++;
        vTaskDelay(100);
        myVar++;
    }
}

I'm using IAR (with low optimization) and a jlink and, apparently, the code never reaches the increment after the first vTaskDelay (i.e., myVar stays at 1). Or rather, sometimes it works as expected but it mostly doesn't.

Do you have any hint at what might be causing this? Is it the fact that I'm using a custom board (I doubt it, since there is no board specific initialization in the example, aside from the LEDs and the button), or is it maybe this bug still looming around?

I should probably mention that I already had a more serious try with the SDK 13.0.0, where I successfully started some tasks and communicated over SPI, but I noticed that some timers were not firing when they should have.

Thanks in advance for any feedback

Parents Reply
  • The clock driver is in the project. In the sdk_config.h, I've changed only some RTT-related stuff (NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED, NRF_LOG_BACKEND_RTT_ENABLED, NRF_LOG_BACKEND_UART_ENABLED, NRF_LOG_DEFAULT_LEVEL and NRF_LOG_DEFERRED).

    I'm just wondering if the example would work as-is on the development board (which I haven't tried), or if it is necessary to add the lines above in the main. Anyway for my part the issue is solved, thanks for your help!

Children
No Data
Related