ESP8266 Developer Zone The Official ESP8266 Forum 2015-12-18T12:56:29+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1531 2015-12-18T12:56:29+08:00 2015-12-18T12:56:29+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1531&p=5083#p5083 <![CDATA[Re: Possible to check when a packet has been transmitted?]]> nodemcu-firmware which is lua over the SDK. I have the exact same problem with UDP packets, and now have a stupid 30ms wait before powering down (deep sleep) the module. I send a 150 bytes payload. For reference, my program takes only 250ms to read and send the data so a proper callback will be nice. Currently the 'sent' cb happens immediately.

Furthermore, I think that all buffers should be drained when a power down (or interface close) takes place.

Alternatively, functions to check for pending send data will allow me to wait only long enough.

TIA

Statistics: Posted by eyal — Fri Dec 18, 2015 12:56 pm


]]>
2015-12-17T15:30:08+08:00 2015-12-17T15:30:08+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1531&p=5074#p5074 <![CDATA[Possible to check when a packet has been transmitted?]]>
However, when we trigger the power-down as soon as the callback registered with esp_now_register_send_cb() is called, most of the packets are never received. If instead we wait another 300ms (using ets_delay_us(300000)), the transmission is successful. The needed wait appears to depend on the packet size used.

It appears that the sent-callback is called as soon as the CPU has submitted data to the radio, and thus potentially before the radio has actually sent the data. And once the ESP gets powered down, such not-yet-sent data is lost.
Unfortunately, our (extremely limited) power budget requires us to power down at the absolute earliest possible time, so simply delaying for a safe, maximum amount of time is not an option.

Obviously, the CPU must be able to check whether the radio is still buffering data or not (to decide whether submitting more data would result in overflow), but I have not seen that functionality exposed. Is there any API for it? Or possibly just a bit in a hardware register that can be read? Any indication at all which is accessible from a user application?

Statistics: Posted by umisef — Thu Dec 17, 2015 3:30 pm


]]>