Hi,
I have some code written in arduino, running on esp32-s3 (Arduino board).
Im reading data from a IMU via I2C. To run things correct regarding timing, I have an ISR which notifies a task with high priority. From what I have read this would be a good way to do things. And it works. Well it works almost all the time, the problem is sometimes it stops working for a short period.
The IMU ICM42688 runs all the times, and gives INT signal every 2 ms. This seems to be OK, as I can see the ISR gets run all the time. The problem is every now and then, the task (priority 2) doesn’t get called. It seems its stopped for always circa 1 second. (I have put counters in the ISR, and in the task, the counter in the task suddenly circa 500 behind or 1 second). The “stuff” in the task is some short I2C com, measured to avg. take 0,18 ms.
Would anyone have some idea what could be going wrong?
xTaskCreatePinnedToCore(
gyroTask,
"gyroTask",
4096,
NULL,
2,
&gyroTaskHandle,
1);
void IRAM_ATTR myinthandler1() { // ISR for ICM42688
vTaskNotifyGiveFromISR(gyroTaskHandle, NULL);
}
void gyroTask(void *parameters) {
while(1) {
if (ulTaskNotifyTake(pdTRUE, portMAX_DELAY) != 0) {
// “stuff”
}
}
}
ISR and task notification
-
MicroController
- Posts: 2667
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ISR and task notification
Your task has a priority of 2, while 0 is the lowest possible priority and (configMAX_PRIORITIES-1) is the highest.I have an ISR which notifies a task with high priority.
...
xTaskCreatePinnedToCore(
gyroTask,
"gyroTask",
4096,
NULL,
2,
&gyroTaskHandle,
1);
Who is online
Users browsing this forum: Qwantbot and 2 guests