For a low power application, we are keeping an ESP8266 powered down most of the time. Regularly, it will power up, take a measurement, and then use ESP-NOW to send the measured value to a gateway. After doing so, it gets powered down again.
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?
Possible to check when a packet has been transmitted?
Re: Possible to check when a packet has been transmitted?
Postby eyal » Fri Dec 18, 2015 12:56 pm
I use 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
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
Who is online
Users browsing this forum: No registered users and 19 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.