Hi. I want to start and stop a timer inside a task function. So that I use vTaskStartScheduler() in setup(). But it seems that the time hasn’t started yet.
It looks like you are calling xTimerStart() continuously in a loop. That will fill the timer command queue and may cause the timer task to spend all its time draining the queue.
Does the timer callback execute once? Or not at all?
I recommend taking a look at the FreeRTOS book, which is a free download from here: Free RTOS Book and Reference Manual. It is a bit (a lot) out of date, but still very relevant.
That code is really convoluted. Anytime I see tasks being suspended and resumed my immediate thought is there is a misunderstanding - I really suggest you read the book i already posted a link to and get a development environment that has a debugger.
What are you trying to achieve? If I know that I may be able to suggest an answer.
One thing I can see wrong is the #define that sets the priority of the timer task at the top of the C file. Any #defines that configure the kernel have to be in the configuration header file which normally is FreeRTOSConfig.h, but I don’t know about Arduino.