← index #18055PR #11747
Off-topic · high · value 2.275
QUERY · ISSUE

ESPNow doesn't recover from buffer error

openby mrichar1opened 2025-09-10updated 2026-03-23
bugport-esp32

Port, board and/or hardware

ESP32_GENERIC_C3-20250809-v1.26.0; ESP32 C3 Supermini

MicroPython version

MicroPython v1.26.0 on 2025-08-09; ESP32C3 module with ESP32C3

Reproduction

From the sender, send a too-large message via ESP32 (>250 bytes), followed by more 'correct' messages:

e.send(peer, "a" * 10)
e.send(peer, "a" * 10)
e.send(peer, "a" * 10)
e.send(peer, "a" * 251)
e.send(peer, "a" * 10)
e.send(peer, "a" * 10)
e.send(peer, "a" * 10)

Receive the messages, catching errors:

while True:
    try:
        print(e.recv())
    except Exception as err:
        print(err)

Expected behaviour

The first too-large message should raise an exception. Subsequent 'correct' messages should then continue as normal.

Observed behaviour

The first messages appear as expected - once the long message is received, the exception is printed repeatedly and no further messages are seen:

[b' n\xf1h\x98\x90', b'bbbbbbbbbb']
[b' n\xf1h\x98\x90', b'bbbbbbbbbb']
[b' n\xf1h\x98\x90', b'bbbbbbbbbb']
ValueError: ESPNow.recv(): buffer error
ValueError: ESPNow.recv(): buffer error
ValueError: ESPNow.recv(): buffer error
ValueError: ESPNow.recv(): buffer error
ValueError: ESPNow.recv(): buffer error
<repeats forever>

Additional Information

A workaround for this issue is to deinit on ValueError, i.e.:

try:
    e.recv()
except ValueError:
    e.active(False)
    e.active(True)

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

esp32: ESPNow.config() "buffer" option renamed to "rxbuf".

mergedby glenn20opened 2023-06-09updated 2023-06-11
docs

This PR renames the ESPNow.config() option to set the size of the buffer for incoming espnow messages from "buffer" to "rxbuf". This now matches the documentation and usage in the esp8266 espnow module.

This corrects the bug reported by @peterhinch in discussion #11691.

ports/esp32/modespnow.c: ESPNow.config(): correct "buffer" option to "rxbuf" to match documentation and esp8266 usage.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied