I am trying to integrate FreeRTOS with some other libraries which is
already using ARM Systick timer for its internal operation. The tick
rate is different from FreeRTOS configTICKRATEHZ. Which means i have
to configure another timer for Free RTOS to use as tick timer.
The Systick was intended for use by an RTOS, so your other option would
be to update the other libraries to use a different timer.
From https://www.freertos.org/low-power-ARM-cortex-rtos.html , steps
are given how to use another timer for FreeRTOS schaduler.
My question is in the second step, i.e. xPortSysTickHandler() function.
1. Should xPortSysTickHandler() only contian Timer interrupt handler
like clearing timer flag? if this is the case then how the FreeRTOS
schadular will know about tick? i.e.
define xPortSysTickHandler TIMx_IRQHandler
.
TIMx_IRQHandler () {
//clear timer flag for another interrupt.
}
It has been a long time since I read that page, and think it could be
clearer so will update it.
The ISR has to do two things: Call xPortSysTickHandler() and clear the
interrupt. This could be done in one of three ways. First, install the
timer interrupt normally, and have the timer interrupt clear the
interrupt and then call xPortSysTickHandler() as per the code below (it
may be necessary to clear the timer after calling xPortSysTickHandler()
rather than before, depending on the operation of the timer hardware).
void TIMx_IRQHandler( void )
{
//Clear timer interrupt here.
xPortSysTickHandler();
}
Second, you could install xPortSysTickHandler() as the actual timer
handler, as per the instructions on the page you reference, then use a
tick hook function to clear the timer interrupt. As above, whether that
is possible or not really depends on how the hardware timer is expecting
its interrupt to be cleared.
Finally, the code you post below will also work, but as you have copied
code from the FreeRTOS port layer into your interrupt handler, it may be
harder for you to update to future versions of FreeRTOS if that part of
the code got modified.
TIMx_IRQHandler () {
//clear timer flag for another interrupt.
//copied contents from SysTickHandler port.c:
uint32t ulDummy;
ulDummy = portSET_INTERRUPT_MASK_FROM_ISR();
{
if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
}
FreeRTOS ticks from Timer other than Systick-ARM
https://sourceforge.net/p/freertos/discussion/382005/thread/9056fbcd/?limit=25#7a26
Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/freertos/discussion/382005/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/