← index #18224Issue #18217
Off-topic · high · value 0.768
QUERY · ISSUE

espnow.irecv() fails silently in some low memory situation

openby QuirkyCortopened 2025-10-08updated 2025-10-08
bug

Port, board and/or hardware

ESP32

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Generic ESP32 module with ESP32

Reproduction

Sender code

import network
import espnow
import time

wifi = network.WLAN(network.STA_IF)
wifi.active(True)
esp_now = espnow.ESPNow()
esp_now.active(True)
esp_now.add_peer(b'\xff\xff\xff\xff\xff\xff')

while True:
    esp_now.send(b'\xff\xff\xff\xff\xff\xff', b'hello')
    time.sleep(1)

Receiver code

import network
import espnow
import json

wifi = network.WLAN(network.STA_IF)
wifi.active(True)
esp_now = espnow.ESPNow()
esp_now.active(True)

# Allocate some memory
a = [0] * 8000  # Bug goes away if this is reduce to say 5000
b = json.dumps(a)
c = json.loads(b)

while True:
    print(esp_now.irecv(-1))

Expected behaviour

Expect the receiver to either print out the received message continuously, or throw an error (...if it is out of memory).

Observed behaviour

esp_now.irecv(-1) does not return. Nothing is printed out. No error messages. On some occasions, the first received message is printed, but nothing after that.

If a = [0] * 8000 is changed to a = [0] * 5000, the problem goes away.

Additional Information

I am unable to replicate the problem without using json.dumps/loads, so maybe a memory fragmentation issue?

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Changing espnow rate fails on IDFv5.4.2

closedby AmirHmZzopened 2025-10-06updated 2025-11-25
bugport-esp32

Port, board and/or hardware

ESP32, ESP32C3

MicroPython version

1.26.1

Reproduction

Run this snippet:

import espnow
import network
sta = network.WLAN(network.STA_IF)
sta.active(True)
sta.config(protocol=network.MODE_LR)
e = espnow.ESPNow()
e.config(rate=0x2A)

Expected behaviour

It should be executed successfully without any exceptions being raised.

Observed behaviour

An OSError will be raised: OSError: [Errno 1] EPERM: ESP_FAIL

Additional Information

It seems the problem is related to IDF v5.4.2. I've rebuilt micropython against IDF v5.4.1 and everything worked correctly.

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