cancel
Showing results for 
Search instead for 
Did you mean: 

HAL FreeRTOS change time base

Posted on October 06, 2015 at 11:28

Hello there,

I am using HAL library with FreeRTOS middleware. The minimum delay I can use for the osDelay() function seems to be 1 ms. I would like to turn on task periodically every 10 or 100 ns. Is that even possible? I would apreciate all help.
4 REPLIES 4
qwer.asdf
Senior
Posted on October 06, 2015 at 13:54

You should use one of the general purpose timers for that task. It will generate an interrupt every X ns, you then do what you want in the interrupt handler but you must be fast enough to complete your task in less than X ns.

Posted on October 06, 2015 at 13:59

Yes I understand the concept. The systick timer is responsible for the bit ticking of osDelay. But even though I change its timebase:

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/100);

The framework manages and adjusts, as the osDelay takes ms not ns and is recalculated. Thats why I am wondering either there is a way around it?
qwer.asdf
Senior
Posted on October 06, 2015 at 14:06

FreeRTOS requires your SysTick to be exactly 1ms to work correctly. Just use another timer, leave the SysTick timer to the OS.

Posted on October 06, 2015 at 14:41

I understand, thank you.