How do I set the Timer (not task) stack size? And do all of the timers within a given application have the same stack size?
I tried setting up a FreeRTOSconfig.h file in the app directory (same directory as the "src" folder). That didn't seem to do anything.
I'm using Visual Studio with PlatformIO.
Timer Stack Size
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Timer Stack Size
It's in menuconfig, if I recall correctly somewhere under components -> freertos.
-
- Posts: 9
- Joined: Wed Mar 16, 2022 7:20 pm
Re: Timer Stack Size
Thanks for the reply! So, silly question, how/where do I run menuconfig? Does it run on my development computer and update config files there?
-
- Posts: 9
- Joined: Wed Mar 16, 2022 7:20 pm
Re: Timer Stack Size
Looks like I cannot run menuconfig because I'm using PlatformIO with the Arduino framework. Looks like a port to espidf framework would be a lot of work. Complicating it is the fact that I can't find compatible libraries to replace the ones I'm using.
Is there a way to run menuconfig (or equivalent) when using the Arduino Framework?
Is there a way to run menuconfig (or equivalent) when using the Arduino Framework?
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Timer Stack Size
Phew, it gets a lot more complicated then... Can I ask in what situation you're runnning into a timer stack overflow? If it's in your code, it may be fixed in some other way.
-
- Posts: 9
- Joined: Wed Mar 16, 2022 7:20 pm
Re: Timer Stack Size
I have a timer using xTimerCreate and xTimerStart. It fires every hour (probably once a day eventually). One of the things it does is check for a code update using the esp32fota library. That's what makes it crash. Error is:
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (Tmr Svc)
I had originally coded it with a task using xTaskCreatePinnedToCore. This worked fine with a stack size of 4096. I changed to the timer for a couple reasons; 1) I thought it would use fewer system resources, and 2) I hoped that it would fire with more accurate timing.
To expand on the more accurate timing...I would like to fire a task off at the same time every period. With the task I can't really do that because the delay is within the continuous loop. With the timer set to repeat, I'm hoping it fires at the same period regardless of the code it is running. In other words, with a timer set to auto reload do the follow on firings happen at (OrigTimerFire + TimerDelay) or does it fire at (OrigTimerFire + CodeExecutionTime + TimerDelay)?
I guess bottom line question is what is the best way to fire a task say every hour?
Thanks for your help!
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (Tmr Svc)
I had originally coded it with a task using xTaskCreatePinnedToCore. This worked fine with a stack size of 4096. I changed to the timer for a couple reasons; 1) I thought it would use fewer system resources, and 2) I hoped that it would fire with more accurate timing.
To expand on the more accurate timing...I would like to fire a task off at the same time every period. With the task I can't really do that because the delay is within the continuous loop. With the timer set to repeat, I'm hoping it fires at the same period regardless of the code it is running. In other words, with a timer set to auto reload do the follow on firings happen at (OrigTimerFire + TimerDelay) or does it fire at (OrigTimerFire + CodeExecutionTime + TimerDelay)?
I guess bottom line question is what is the best way to fire a task say every hour?
Thanks for your help!
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Timer Stack Size
I think you were on the right path with the separate task; you really shouldn't put intense and long-running things in a timer callback (as it stops other timer events from happening as long as the callback is running). You probably want to take a look at vTaskDelayUntil to solve your other problem.
-
- Posts: 9
- Joined: Wed Mar 16, 2022 7:20 pm
Re: Timer Stack Size
Yes, that looks like the ticket! Thanks.
Who is online
Users browsing this forum: Google [Bot] and 98 guests