FreeRTOS clock configurations

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS clock configurations

2,069 Views
fma23
Contributor II

I was running an example that runs a freeRTOS example. I used the pin configuration tool to add SPI1 peripheral. Afterwards, I noticed the timings on my FreeRTOS example changed. The function: vTaskDelay(pdMS_TO_TICKS(33)) runs every 100ms and vTaskDelay(pdMS_TO_TICKS(100)) runs every 300ms. Meaning that the clock needs to be divided by 3. Also noticed that the SPI baudrate is running at 425KHz while it should be running at 500 KHz.

Could anyone tell me which clocks I need to be looking at so that I can have a resolution of 1 ms for vTaskDelay, and have my SPI clock runs at 500 KHz when I set masterConfig.baudRate     = 500000u.

Thanks

Farid

Labels (1)
0 Kudos
4 Replies

1,890 Views
danielchen
NXP TechSupport
NXP TechSupport

One update:

The SysTick interrupt is a 24bit timer which is designed to be used by the RTOS as time base.Typical time bases are 10ms or 1ms.

Please refer to FreeRTOSConfig.h

#define xPortSysTickHandler SysTick_Handler

0 Kudos

1,890 Views
fma23
Contributor II

could you please say which clock or function is used to generate the ticks? there must be a timer used to control this 1 ms delay could you please tell me which timer is used?

Also is there any documentation for this MCU drivers ( iMX RT1062)

Thanks,

Farid

0 Kudos

1,890 Views
fma23
Contributor II

Can any one comment on my issue  please?

0 Kudos

1,890 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Farid:

The vTaskDelay(1) will delay for a tick count. The actual time that task remains blocked depends on the tick rate.

These settings in in FreeRTOSConfig.h

#define configCPU_CLOCK_HZ                      (SystemCoreClock)
#define configTICK_RATE_HZ                      ((TickType_t)1000)

So maybe you changed the core clock with the configuration tool? Are you using a low power spi?

Please refer to the lpspi demo with FreeRTOS in SDK.

SDK_2.6.1_EVKB-IMXRT1050\boards\evkbimxrt1050\rtos_examples\freertos_lpspi

Regards

Daniel

0 Kudos