ESPNow send and receive with dedicated addresses
# help
i
I try to run the espnow implementation with toit which works fine as broadcasting but when I try to set the address where the data should be send to I revceive an unknown error:
Copy code
jag decode WyNVBVVYU1UQdjIuMC4wLWFscGhhLjEzNFNVAFskVSNVEBeZ9UO/CVDXk6Icr6uwT6ZbI1UEVUVTVQlFWENFUFRJT05TVRtVTktOT1dOIEVSUk9SIDB4MzA2OSgxMjM5MylbI1UCVVNbI1URWyNsAAAAA1VGVQBJA3lbI2wAAAADVUZVAUl6tFsjbAAAAANVRlUCSVTPWyNsAAAAA1VGVQNJTvNbI2wAAAADVUZVBElPUVsjbAAAAANVRlUFSVTkWyNsAAAAA1VGVQZJeu9bI2wAAAADVUZVB0kDIFsjbAAAAANVRlUISQJZWyNsAAAAA1VGVQlJCihbI2wAAAADVUZVCkkLgFsjbAAAAANVRlULSQuXWyNsAAAAA1VGVQxJOyVbI2wAAAADVUZVDUk7PVsjbAAAAANVRlUOSTphWyNsAAAAA1VGVQ9JOulbI2wAAAADVUZVEEkKPA==
EXCEPTION error. 
UNKNOWN ERROR 0x3069(12393)
  0: espnow-send_              <sdk>\esp32\espnow.toit:191:3
  1: Service.send.<block>      <sdk>\esp32\espnow.toit:145:7
  2: Mutex.do.<monitor-block>  <sdk>\monitor.toit:28:27
  3: __Monitor__.locked_.<block> <sdk>\core\monitor_impl_.toit:123:12
  4: __Monitor__.locked_       <sdk>\core\monitor_impl_.toit:95:3
  5: Mutex.do                  <sdk>\monitor.toit:28:3
  6: Service.send              <sdk>\esp32\espnow.toit:143:17
  7: send-task                 src\toit\espnow\bouy-espnow.toit:33:13
  8: main.<lambda>             src\toit\espnow\bouy-espnow.toit:19:10
all I changed was setting the address to the service send to be the address of the receiver side.
Copy code
service.send buffer 
      --address=Address #[0x8C, 0x4B, 0x14, 0x16, 0x64, 0x60]
I also changed the address on the receiver side to be the one from the sender:
Copy code
service := espnow.Service.station --key=null
service.add-peer (Address #[0x8C, 0x4B, 0x14, 0x16, 0x6A, 0x6C]) --channel=1
ESP_ERR_ESPNOW_NOT_FOUND (0x3069): ESPNOW peer is not found I am pretty sure I am doing something wrong but what is it? If I am only sending I do not need to add a peer, right?
so I DO have to set the peer even tho I am adding the address already when sending. Not sure if I get this right. As far as I understand there is 2 different modes for espnow: broadcasting - where it will just send data and anyone listening will receive it and peer-mode where I explicitly send data to a device with a defined address I am adding. The last mode also works in both directions and I assume setting a peer will make it bidirectional, which is not really needed here... but I guess it also does not hurt
f
I think you need to add the peer before you do anything with it. (sending or receiving).
But not 100% certain. Long time since I played with espnow.
i
@floitsch did you ever tested the range possible with ESPNow using toit or know any reference for it? The code says that 1Mbps is default - that should be the lowest setting, right? and therefor the one with max range?
I try to test it but jaguar lost connection and complained, that way I was not able to run in properly. Can I disable jaguar for that?
f
I never tested the range. I don't think the default is the max range.
i
any other option seems to be higher in value like 2Mbps or 16Mbps
f
Ok. Maybe we picked the lowest then
k