DM9051 stop communication after a period networking

josright123
Posts: 3
Joined: Sat Mar 20, 2021 1:28 pm

DM9051 stop communication after a period networking

Postby josright123 » Sat Mar 20, 2021 2:54 pm

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!?

rpress
Posts: 2
Joined: Mon Mar 22, 2021 7:22 pm

Re: DM9051 stop communication after a period networking

Postby rpress » Mon Mar 22, 2021 7:29 pm

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

josright123
Posts: 3
Joined: Sat Mar 20, 2021 1:28 pm

Re: DM9051 stop communication after a period networking

Postby josright123 » Wed Apr 07, 2021 9:23 am

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.)
Attachments
esp_eth_mac_dm9051.c
original source file,
committed on Jan 12 (753a929525)
(32.3 KiB) Downloaded 273 times
esp_eth_mac_dm9051 - Improved.c
delete 1 line, add 2 lines
(32.39 KiB) Downloaded 275 times

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 232 guests