Developed and Ad Hoc Network over ESP Now Getting ESP_ERR_ESPNOW_NO_MEM while sending
Posted: Sat Apr 17, 2021 9:40 pm
Hi! All.
I am developing an Ad Hoc Network Dhyara over ESP Now using ESP-IDF. It provides send/receive/ping/traceroute functionality over multi hop network. It is connection-less and nodes are identified by their mac addresses only. The distributed routing table are built and maintained by repeated sending/receiving of beacons and neighborhood synchronization. So far it is working perfectly. With fix phy rate and maximum power I have achieved nearly 1MBps speed (Bytes not Bits).
Currently I am encountering a problem. If I send too much too frequently I am getting ESP_ERR_ESPNOW_NO_MEM error. I am aware that two parallel send operations over ESP Now may cause such issues.
So to avoid parallel sends the `transmit` function queues the frame instead of sending. Which is then dequeued (one) by `start_snd` task.
`esp_sent_cb` is set as send callback. which wakes up the `start_snd` task once a frame is delivered. This ensures strictly sequential send operations. Below is a diagram depicting the flow.
I am getting partial success with this. If I disable the queuing mentioned above then there are too many send failures. If I enable send queuing then obviously send failures decrease, but still happen. But I expect to have zero send failures (not few) because now there is no parallel send.
I need a little help is solving this issue. GitHub Issue Link
Thank You.
I am developing an Ad Hoc Network Dhyara over ESP Now using ESP-IDF. It provides send/receive/ping/traceroute functionality over multi hop network. It is connection-less and nodes are identified by their mac addresses only. The distributed routing table are built and maintained by repeated sending/receiving of beacons and neighborhood synchronization. So far it is working perfectly. With fix phy rate and maximum power I have achieved nearly 1MBps speed (Bytes not Bits).
Currently I am encountering a problem. If I send too much too frequently I am getting ESP_ERR_ESPNOW_NO_MEM error. I am aware that two parallel send operations over ESP Now may cause such issues.
Note that too short interval between sending two ESP-NOW data may lead to disorder of sending callback function. So, it is recommended that sending the next ESP-NOW data after the sending callback function of the previous sending has returned.
So to avoid parallel sends the `transmit` function queues the frame instead of sending. Which is then dequeued (one) by `start_snd` task.
`esp_sent_cb` is set as send callback. which wakes up the `start_snd` task once a frame is delivered. This ensures strictly sequential send operations. Below is a diagram depicting the flow.
I am getting partial success with this. If I disable the queuing mentioned above then there are too many send failures. If I enable send queuing then obviously send failures decrease, but still happen. But I expect to have zero send failures (not few) because now there is no parallel send.
I need a little help is solving this issue. GitHub Issue Link
Thank You.