diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index 29b8c4ccbf..1b7b93b109 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -2027,17 +2027,13 @@ static void stm32_interrupt_work(void *arg) stm32_putreg(ETH_DMAINT_NIS, STM32_ETH_DMASR); } - /* Handle error interrupt only if CONFIG_DEBUG_NET is eanbled */ - -#ifdef CONFIG_DEBUG_NET - - /* Check if there are pending "anormal" interrupts */ + /* Check if there are pending "abnormal" interrupts */ if ((dmasr & ETH_DMAINT_AIS) != 0) { /* Just let the user know what happened */ - nerr("ERROR: Abormal event(s): %08x\n", dmasr); + nerr("ERROR: Abnormal event(s): %08" PRIx32 "\n", dmasr); /* Clear all pending abnormal events */ @@ -2046,8 +2042,23 @@ static void stm32_interrupt_work(void *arg) /* Clear the pending abnormal summary interrupt */ stm32_putreg(ETH_DMAINT_AIS, STM32_ETH_DMASR); + + /* As per the datasheet's recommendation, the MAC + * needs to be reset for all abnormal events. The + * scheduled job will take the interface down and + * up again. + */ + + work_queue(ETHWORK, &priv->irqwork, stm32_txtimeout_work, priv, 0); + + /* Interrupts need to remain disabled, no other + * processing will take place. After reset + * everything will be restored. + */ + + net_unlock(); + return; } -#endif net_unlock();