cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS, Systick and Timer2 ?

antonius
Senior
Posted on March 26, 2017 at 00:01

Everybody,

I have a question in regard, FreeRTOS, Systick and Timer2 ?

How can I use Timer2 as Systick in FreeRTOS ?

And what is the relation between SDIO preemption priority global interrupt with FreeRTOS ?

Thanks and have a good weekend0690X00000603dVQAQ.jpg

#stm32f1xx #freertos #sdio #interrupt #preemption
4 REPLIES 4
Barry.Richard
Associate III
Posted on March 26, 2017 at 05:22

Are you using GCC?  If so then all you need to do is

1) define a function with the following prototype to setup the timer you want to generate the tick interrupt

void

vPortSetupTimerInterrupt

(

void

);

2) Install the existing xPortSysTickHandler() function as the timer's interrupt service routine,

3) Set the priority of the timer's interrupt to the lowest possible.

In answer to your second question - and the priority bits for an interrupt that uses the FreeRTOS interrupt safe API should be set to be pre-emption priority bits, not sub-priority bits.  See the following link for more information: 

http://www.freertos.org/RTOS-Cortex-M3-M4.html

 

antonius
Senior
Posted on March 27, 2017 at 08:23

Probably this one is related :

HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
 RCC_ClkInitTypeDef clkconfig;
 uint32_t uwTimclock = 0;
 uint32_t uwPrescalerValue = 0;�?�?�?�?�?

Posted on March 27, 2017 at 09:56

My toolchain is Keil MDK, is it GCC based ?

.

void

vPortSetupTimerInterrupt

(

void

);

Which file is it located ?

Posted on March 27, 2017 at 16:49

If you are using Keil then you need the additional step of ♯ defining configOVERRIDE_DEFAULT_TICK_CONFIGURATION to 1 in FreeRTOSConfig.h.