Skip to content

ESP-NOW error 0x306a if channel is not 1 #7903

@anecdata

Description

@anecdata

CircuitPython version

Adafruit CircuitPython 8.1.0-beta.0-80-g22636e056 on 2023-03-29; Adafruit Feather ESP32-S2 TFT with ESP32S2

Code/REPL

Code and initial testing commentary here (also some on Discord):
https://gist.github.com/anecdata/f46a1d07add5fc60cfbcf42dc7be6528

Behavior

The most limiting issue right now I think is that if peer channel is set to anything except 0 (default; becomes channel 1) or 1, send will result in espidf.IDFError: ESP-NOW error 0x306a. ESP-NOW should operate on any channel. This also prevents running wifi and ESP-NOW simultaneously unless the AP is on channel 1.

A couple of other initial questions or issues after testing ESP-NOW... we can put them into separate issues if warranted:

  • when encryption is used, RSSI is always returned as 0

  • ValueError: phy_rate must be 0-42 but should allow up to 54Mbps? 36 is allowed to be set, but 24 is the highest that seems to work between sender and receiver. edit: this is OK, I misinterpreted the enum

  • using broadcast peer address results in ESP-NOW error 0x3066 on send, not sure if this is intended to be supported right now

  • ESP-NOW error 0x306b if a peer is added more than once

  • packets are limited to 250 bytes, trying to send 251 results in espidf.IDFError: ESP-NOW error 0x306a but perhaps there's a friendlier input validation error that can be raised?

  • e = espnow.ESPNow() results in RuntimeError: Already running if done more than once, but RTD says it's a Singleton:

Allocate and initialize ESPNow instance as a singleton.

...also unexpected:

>>> import espnow
>>> 
>>> with espnow.ESPNow() as e:
...     pass
>>> e
<ESPNow>
>>> 
>>> e.deinit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Object has been deinitialized and can no longer be used. Create a new object.

Addendum: Two additional nice-to-have features:

  • Give user code a way to get the number of messages in the buffer. On PSRAM boards, large buffers can be allocated to accommodate high ESP-NOW traffic. Would be nice for user code to see how well it's keeping up. And how many messages have been lost. Monitor might be a good example for these.

  • allow configuring more than the default 7 encrypted pairs (can be up to 17, but trades off with SoftAP). Update: An issue has been filed with Espressif to allow runtime configuration of max encrypted pairs.

Addendum 2: Another issue:

  • ESP-Now receivers and senders will spontaneously reset with microcontroller.ResetReason.WATCHDOG numerous times per day.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions