Page 1 of 1

DM9051 stop communication after a period networking

Posted: Sat Mar 20, 2021 2:54 pm
by josright123
After build the examples of 'basic' or 'eth2ap' with DM9051 module,
It can get a dynamic IP from a DHCP server.
It can work for ethernet good, But it stop communicate after quite a while.
No helpful message log can be found in the printed-out monitor,
How can we improve the DM9051 network support function!?

Re: DM9051 stop communication after a period networking

Posted: Mon Mar 22, 2021 7:29 pm
by rpress
I have found the same problem, but I also seem to have a workaround.

Replace this line in "/components/esp_eth/src/esp_eth_mac_dm9051.c": https://github.com/espressif/esp-idf/bl ... 051.c#L411

Code: Select all

ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
with

Code: Select all

ulTaskNotifyTake(pdFALSE, pdMS_TO_TICKS(50));
This will poll every 50ms if an interrupt edge is lost. I don't know why interrupts are lost, and this fix adds additional latency and CPU usage, but at least it keeps working.

Maybe it is related to this: viewtopic.php?t=10124

Re: DM9051 stop communication after a period networking

Posted: Wed Apr 07, 2021 9:23 am
by josright123
When I test the rpress' replaced workaround as below:
ulTaskNotifyTake(pdFALSE, pdMS_TO_TICKS(50));
Its 50ms polling is too long, Try reduce to 10ms still work OK and get better performance for ethernet (but with additional CPU usage).
If reduce to less then 10ms, The IDF keep print 'CPU CUT' messages?

I also try to develop another solution, by change the control to DM9051 chip. It looked good.
(1)
Comment(remove) this line in "/components/esp_eth/src/esp_eth_mac_dm9051.c":
https://github.com/espressif/esp-idf/bl ... 051.c#L414
(2)
Add the line "dm9051_register_write(emac, DM9051_ISR, 0xFF);" in emac_dm9051_task() function.
https://github.com/espressif/esp-idf/bl ... 051.c#L403
(3)
Add the line "dm9051_register_write(emac, DM9051_ISR, 0xFF);" in emac_dm9051_receive() function.
https://github.com/espressif/esp-idf/bl ... 051.c#L663

It tests ok and is not bad in IDFv4.3-dev ! (Test is not complete, Test to various your IDF version yourself is recommended.)