Questions about FreeRTOS and RTC on nrf52832

Hi all,

I am having an issue with FreeRTOS on the NRF52832 (SDK 17.1.0).

I need precise time so I use the io to measure the time. the code like this:

    nrf_gpio_cfg_output(18);
    PRINTF("nrf_gpio_cfg_output 18.");
    while(1)
    {
        nrf_gpio_pin_write(18, 1);
        vTaskDelay(1);
        nrf_gpio_pin_write(18, 0);
        vTaskDelay(1);
        nrf_gpio_pin_write(18, 1);
        nrf_delay_us(500);
        nrf_gpio_pin_write(18, 0);
        nrf_delay_us(500);
        nrf_delay_ms(10);
        PRINTF("while loop.");
    }

#define configTICK_RATE_HZ        1024

But the oscilloscope waveform shows that the interval is abnormal.

The first pullup interval is 738 us, and the first pulldown interval is 910us, but the second pullup interval is exact time 500us.

That means delay time on rtos is not accurate, but nrf_delay is accurate.

Did I set something wrong about freertos?

The config file is here.

8508.FreeRTOSConfig.h

5432.sdk_config.h

Hope you can give me some suggestions.

Best regards

Lurn

Related