Software Timers PIC32

Hello.

I am creating an application on PIC32MZ2064DAB169, recently I ran into a problem related to software timers.

I have created four software timers, all of them are working well as expected, however the problem occurs when I change the period of the forth timer from 500milliseconds to 2000 milliseconds, when I do so this timer stops working. I have checked whether xTimerStart() is working or not and I am satisfied that this function is working for this particular timer.

I am sharing the chunk of code that is relevant to this problem.

LCDFSMTemporalEvents        = xTimerCreate("LCDFSMTemporalEvents", pdMS_TO_TICKS(2000), pdFALSE, 0, OnFiveSecondTimerWrapper);
LCDFSMMsgFlashTimer         = xTimerCreate("LCDFSMm_MsgFlashTimer", pdMS_TO_TICKS(500), pdTRUE, 0, MsgFlashTimerWrapper);
BlinkBatteryLogoTimer       = xTimerCreate("BlinkBatteryLogoTimer", pdMS_TO_TICKS(500), pdTRUE, 0, BlinkBatteryLogoTimerWrapper);
DisplayOnlineDevicesTimer   = xTimerCreate("DisplayOnlineDevicesTimer", pdMS_TO_TICKS(2000), pdTRUE, 0, DisplayOnlineDevicesTimerWrapper);

FreeRTOSconfig,h files looks like this.

#define configUSE_TIMERS 1 // this has been set to 1 bcz we need software timer for LCD
#define configTIMER_TASK_PRIORITY 3 // sets the priority of Angel task
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH 500 // sets the stack depth of Angel task
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0

I appreciate your help in this problem.

Are these the only timers in your application or do you have more? When you say that the timer does not work, you mean the callback never executes? Can you check pxCurrentTimerList and see if this timer is on the list?

@aggarg Thank you for your response, I have resolved the issue however it is just a way around, so the problem was when I immediately started the timer right after the scheduler started the timer will run only if the period is set to less 500mS.

Now I have started the timers a little after the scheduler and it is working fine for larger periods.

Although the timers are working now but I am unable to understand this behavior.

Yes.

Yes callback never executes.

I had checked the return value of xTimerStart(), it is true so I conclude that the timer is in active list of timers.

I am not sure why that would fix your problem - it is possible that the problem is still there, just not manifesting itself. Can you share the code snippet where you start the timer?