I used all 4 timers on my ESP32-S3 project and I found out I'll need some more. I previously worked on some other MCU that had a similar number of timers, but had a MCP module that had it's own timers that were available. I can see that ESP32-S3 also has MCPWM module with timers so I was wondering if it's possible to use it (together with callback on timeout), I tried to write some code to utilize it, but it didn't work, and there are so little examples on the internet. If this is indeed possible, can anyone point me to where to find a code example? Or some other solution?
Thanks in advance.
Need more timers on ESP32-S3
Re: Need more timers on ESP32-S3
How about software timers?
https://docs.espressif.com/projects/esp ... l#overview
There is also new to me peripheral module
https://docs.espressif.com/projects/esp ... timer.html
https://docs.espressif.com/projects/esp ... l#overview
There is also new to me peripheral module
https://docs.espressif.com/projects/esp ... timer.html
Re: Need more timers on ESP32-S3
Thanks for your reply.
I would prefer to have a hardware timer, but if nobody offers a different solution, I'll have to use them.
I would prefer to have a hardware timer, but if nobody offers a different solution, I'll have to use them.
-
- Posts: 52
- Joined: Fri Aug 11, 2023 4:56 am
Re: Need more timers on ESP32-S3
The UNIX kernel, like a lot of other RTOSes, got away with a single timer source for a long time. I'm not saying that didn't have excuses, but it was workable.
Just brush up on having one montonically increasing value of "time" and a list of events scheduled to be serviced in the future. If you have lots of such events - and the discipline to unit test them, probably in user space, because locks matter - you can have multiple listss, like a short one of events that'll happen in the next couple of ticks and a longer oneof things you'll need to tend to "one of these days".
Think of one as the egg timer in the kitchen controlling the things you have to deal with NOW (ish) and the other as the list scribbled on the calendar of things that are upcoming, but not immediate. Once every once in a while, you have to grab events from that long list, sort them effectively, and THEN move them to the list of things to be checked on every timer tick or so.
Fiddly? Perhaps. But many of the world's OSes run on very similar schemes.
Just brush up on having one montonically increasing value of "time" and a list of events scheduled to be serviced in the future. If you have lots of such events - and the discipline to unit test them, probably in user space, because locks matter - you can have multiple listss, like a short one of events that'll happen in the next couple of ticks and a longer oneof things you'll need to tend to "one of these days".
Think of one as the egg timer in the kitchen controlling the things you have to deal with NOW (ish) and the other as the list scribbled on the calendar of things that are upcoming, but not immediate. Once every once in a while, you have to grab events from that long list, sort them effectively, and THEN move them to the list of things to be checked on every timer tick or so.
Fiddly? Perhaps. But many of the world's OSes run on very similar schemes.
Re: Need more timers on ESP32-S3
https://github.com/espressif/esp-idf/bl ... ple_main.cSlinisa wrote: ↑Tue Oct 01, 2024 3:15 amI used all 4 timers on my ESP32-S3 project and I found out I'll need some more. I previously worked on some other MCU that had a similar number of timers, but had a MCP module that had it's own timers that were available. I can see that ESP32-S3 also has MCPWM module with timers so I was wondering if it's possible to use it (together with callback on timeout), I tried to write some code to utilize it, but it didn't work, and there are so little examples on the internet. If this is indeed possible, can anyone point me to where to find a code example? Or some other solution?
Thanks in advance.
-
- Posts: 1727
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Need more timers on ESP32-S3
Which is why the IDF's "high resolution timer" implements exactly this for you.RandomInternetGuy wrote: ↑Sun Oct 20, 2024 11:23 am... having one montonically increasing value of "time" and a list of events scheduled to be serviced in the future. ...
Fiddly? Perhaps.
As do the lower-resolution FreeRTOS timers.
There's no need for microsecond accuracy to blink an LED, so different timer constructs can be used for different things, reducing potential contention on high-accuracy timers.
Who is online
Users browsing this forum: forrest, MicroController and 170 guests