← index #18055Issue #17181
Related · high · value 1.747
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 · ISSUE

esp32-c3 espnow restart!

closedby NEChinaopened 2025-04-24updated 2025-04-25
bug

Port, board and/or hardware

esp32-c3

MicroPython version

MicroPython v1.25.0

Reproduction

When using the official firmware versions 1.24.1 to 1.25.0 on the ESP32-C3, the device automatically restarts when the ESPNOW module is used.

firm
ware: https://micropython.org/resources/firmware/ESP32_GENERIC_C3-20250415-v1.25.0.bin
code:
import network
import espnow

sta = network.WLAN(network.WLAN.IF_STA)
sta.active(True)
sta.disconnect()
e = espnow.ESPNow()
e.active(True)
peer = b'\x9c\x9e\x6e\x31\x35\x6c'
e.add_peer(peer)
e.send(peer, "Starting...") <---restart!

Expected behaviour

No response

Observed behaviour

MicroPython v1.25.0 on 2025-04-19; ESP32C3 module with ESP32C3

Type "help()" for more information.

import network
import espnow
sta = network.WLAN(network.WLAN.IF_STA)
sta.active(True)
True
sta.disconnect()
e = espnow.ESPNow()
e.active(True)
True
peer = b'\x9c\x9e\x6e\x31\x35\x6c'
e.add_peer(peer)
e.send(peer, "Starting...")
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40048b82
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0xd9c
load:0x403cc710,len:0x9a8
load:0x403ce710,len:0x2c3c
PROBLEM IN THONNY'S BACK-END: Exception while handling 'execute_source' (ConnectionError: EOF).
See Thonny's backend.log for more info.
You may need to press "Stop/Restart" or hard-reset your MicroPython device and try again.

Process ended with exit code 1.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

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