Thanks for the reply davdav, any experience shared is good. I had given up on expecting any.
Now you are also confused (like me), so sorry for the big post that follows:
> regarding point 1. link tell that you need an "application layer" ackonwledge to be sure the transmission to a peer succeed.
> In my project I send data to a peer using
> <Code>
> esp_now_send
> API and wait for a reply "ACK" from peer.
This is what's being said on your link:
Call esp_now_send() to send ESP-NOW data and esp_now_register_send_cb to register sending callback function. It will return ESP_NOW_SEND_SUCCESS in sending callback function if the data is received successfully **on MAC layer**. Otherwise, it will return ESP_NOW_SEND_FAIL
The critical part is the MAC-layer. This is either the local MAC layer, and trivia, or the remote MAC layer and implies an ACK. So odds are this concerns the destination device, which implies there are multiple transmissions. The text continues to support this thesis:
There are several reasons failing to send ESP-NOW data, for example, the destination device doesn’t exist, the channels of the devices are not the same, the action frame is lost when transmiting on the air, etc. It is not guaranteed that application layer can receive the data
There is virtually no failing if the result of the call concerns the local MAC layer, and it makes no sense to about the fact that radio messages may not arrive. If a ESPNOW send results in a single transmission it is obvious it may be lost. The text seems to make the point that the remote device responds automatically, meaning there is no application involved (a good thing).
But hey, just say that a single ESPNOW send call results in multiple frames on the air, and please be specific about the number of frames, as it probably is 2: the sender frame to which the receiver responds with an ACK frame. Just one ACK, arrives or doesn't, determining the result of the call.
BUT... it then the text goes on to put us on the wrong foot:
If necessary, send back ack data when receiving ESP-NOW data. If receiving ack data timeout happens, retransmit the ESP-NOW data
This doesn't make much sense, except when there is no ACK behind the scenes. Or else it is lawyers talk, intended to avoid assuming responsibility (silly lawyers).
There are several posts on the net of folks who have investigated the issue, and they find the remote device responds. Sorry couldn't find those posts, maybe it's just one guy posting in a few sites.
The (other undocumented) LMK/PMK story also hints at a protocol: encryption requires some sort of protocol.
The bottom line is that:
- if you understand ESPNOW to be raw messages (which is how ESPNOW was received), in need of an ACK, you'd be wrong
- Expressif wants to tells the competition about the protocol
The difference between an ACK and no ACK is critical for example in the case of giving all devices a single MAC, which would allow private broadcasts between them, an issue I explicitly touched on.
To summarize my understanding as it stands: ESPNOW sends a (non-broadcast) frame and the receiver replies (as quickly as possible) with an ACK (from its "MAC layer").
If so Expressif should say loud and clear:
- do NOT, as an application, send (empty) ACK frames
- something got lost going from chinese to english (and back)
It should be clear then that:
- broadcasts are single frame (send only) but get processed by all nearby devices
- private broadcasts (with all devices sharing a single MAC) result in a mess with one sender and multiple easily corrupted ACKs
(Expressif, ) please correct me if I'm wrong.