HI there.
I set a hardware timer work at 4000 hz. When the isr is triggered, I will read some gpio status to a buffer. When the buffer is full, send a messsge to a queue and then other tasks can do some data processing for example publishing these data through mqtt.
Well, the data I get is bad. I found some data lost somewhere. The isr seemes to be triggered less than 4000 times.
Is there any chance the isr not triggered because of other tasks?
I tried to set the isr to ESP_INTR_FLAG_HIGH, and this time the isr isn't triggered even once. Am I missing something?
is there a chance a hardware timer ISR not be triggered in a busy system?
-
- Posts: 18
- Joined: Tue Sep 14, 2021 2:18 pm
Re: is there a chance a hardware timer ISR not be triggered in a busy system?
Hello. Ive had this problem recently and it was because I was sending the Timer ISR event to a xQueue. What I did to fix it was handling the event inside the ISR and not sending it to xQueueRecive somewhere. My timer was 104 microseconds and it worked (My project was a bitbanged uart so i needed a very precise timer interrupt).
wrong example:
right example:
if you use a task to recive the queue events it might get suspended to run other tasks. Increasing its priority was not enogth for me
wrong example:
Code: Select all
void timer_isr() {
xQeueSend()
}
void task_loop() {
xQueueRecive()
DoStuff()
}
Code: Select all
void timer_isr() {
DoStuff();
}
Re: is there a chance a hardware timer ISR not be triggered in a busy system?
Thanks. It worked.
I've changed the code from
to
In fact, it is not the first time xXXXfromISR() functions of freeRTOS don't work as expected.
Hope these fetures can be tested thoroughly so developers can acknowledge more details.
I've changed the code from
Code: Select all
void timer_isr() {
xQeueSend()
}
void task_loop() {
xQueueRecive()
DoStuff()
}
Code: Select all
void timer_isr()
{
set_a_flag
}
void observer_task
{
loop()
{
check the flag
xQueueSend
clear the flag
}
}
void task_loop()
{
xQueueRecive()
DoStuff()
}
Hope these fetures can be tested thoroughly so developers can acknowledge more details.
Who is online
Users browsing this forum: atx823, brushlow18 and 212 guests