From 1f2af24118817158385dea1947c2c696ef2edc32 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 9 Apr 2021 20:36:01 +0200 Subject: [PATCH] esp_eth: Recover the w5500 driver from missed io interrupt If the GPIO interrupt is re-asserted too quickly it could be missed. If this happens the driver goes silent and never receives any data. Recover by periodic checks of the IO signal level --- components/esp_eth/src/esp_eth_mac_w5500.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/esp_eth/src/esp_eth_mac_w5500.c b/components/esp_eth/src/esp_eth_mac_w5500.c index 1f97d7fd68..55dcafe5c6 100644 --- a/components/esp_eth/src/esp_eth_mac_w5500.c +++ b/components/esp_eth/src/esp_eth_mac_w5500.c @@ -322,8 +322,12 @@ static void emac_w5500_task(void *arg) uint8_t *buffer = NULL; uint32_t length = 0; while (1) { - // block indefinitely until some task notifies me - ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + // check if the task receives any notification + if (ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(1000)) == 0 && // if no notification ... + gpio_get_level(emac->int_gpio_num) != 0) { // ...and no interrupt asserted + continue; // -> just continue to check again + } + /* read interrupt status */ w5500_read(emac, W5500_REG_SOCK_IR(0), &status, sizeof(status)); /* packet received */