Hello,
I am working on creating a countdown timer using xTimerCreateStatic.
xTimer = xTimerCreateStatic(
"timer30Sec",
pdMS_TO_TICKS(10),
pdTRUE,
(void*)0,
vTimerCallback,
&xTimerBuffer );
Time config is set to 1 as well as static allocation, so everything should be working fine. I am running numerous tasks and I am able to run a timer in my main when I start the scheduler. I am also able to have a working timer in the init task functions I have. However, when I try to create a timer and start it in one of my tasks, the callback is never reached. When I check the expiry time after starting the timer it is always 0 for some reason. I checked if the timer was running with xTimerIsTimerActive and it returns false. When I run (xTimerStart( xTimer , 1000 ) != pdPASS) , it never returns a failure and when I step through the timer.c file create functions it seems to be working properly. I do not have much freeRtos experience and kind of stuck. I am only trying to use one countdown timer in this task.
Test function I am using:
for( ;; ) {
if( xTimerIsTimerActive(xAssocTimer) == pdFALSE) {
for(;;); /* failure!?! */
}
xRemainingTime = xTimerGetExpiryTime( xTimer ) - xTaskGetTickCount();
vTaskDelay(100);
};
static void vTimerCallback( TimerHandle_t xTimer )
{
int i = 1; //jsut setting a break here
}