Jump from ISR to task, timing problems
Posted: Fri Jul 09, 2021 9:38 am
Hey there!
I'am doing a quite simple project with ESP32 and can't handle some problem:
I have ISR handler:
And here it is a small part of my task which should handle xGPIOMutex mutex:
When ISR occurs, I give mutex and switch context to my high priority task. Almost always it works great, about 400us to jump from ISR to task, but some times something happened and this process takes more then 3000us. Ofc I would fix it, but nothing come to my mind anyway.
This is how I create gpio_task (24 the highest priority in this project):
Note that there are much more tasks and interrupts in this project.
And sorry for my eng
I'am doing a quite simple project with ESP32 and can't handle some problem:
I have ISR handler:
Code: Select all
static void IRAM_ATTR gpio_isr_handler(void *arg)
{
timer_get_counter_value(0, 0, &itr_time); /* fot count time */
BaseType_t xReturn = pdFALSE;
xSemaphoreGiveFromISR(xGPIOMutex, &xReturn);
if (xReturn == pdTRUE)
{
portYIELD_FROM_ISR();
}
}
Code: Select all
void gpio_task(void *arg)
{
TCA9535_Register last_data = {};
while (1)
{
xSemaphoreTake(xGPIOMutex, portMAX_DELAY);
{
timer_get_counter_value(0,0, &task_time);
TCA9535ReadInput(&inputRegister);
}
}
This is how I create gpio_task (24 the highest priority in this project):
Code: Select all
xTaskCreate(&gpio_task, "gpio_task", 4096, NULL, 24, NULL);
And sorry for my eng