I have an Arduino program that can communicate between a controller and 2 slaves using ESP-NOW and I’d like to add encryption to it, but using the “esp_now_set_peer_key” function either doesn’t seem to work or causes the devices to stop communicating depending on whether I call it before or after the call to “esp_now_set_peer_role”.
After I could reliably transmit and receive messages between the controller and slave, I added calls to the ‘esp_now_set_peer_key’ function to set the encryption key for communication between modules.
I use a single encryption key so that all modules share the same key.
No matter where I put the call to the ‘esp_now_set_peer_key’ function relative to the ‘esp_now_set_peer_role’ function, either it doesn’t seem to set the key’; i.e., the encrypted module continues to communicate with the unencrypted module, or they fail to communicate even when both modules should be using the same key.
I can’t seem to find any example code using the “esp_now_set_peer_key” in the forum or on the web, only the Espressif’s API documentation on how to call it.
Has anyone had any success using this function?
Any help would be greatly appreciated.
Thanks