QUERY · ISSUE
espnow.irecv() fails silently in some low memory situation
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 1.26.1
bugport-esp32
Port, board and/or hardware
ESP32-C3 Super Mini
MicroPython version
1.26.1
Reproduction
import os
from platform import platform
from espnow import ESPNow
from network import AP_IF, STA_IF, WLAN
print(platform())
print(os.uname())
try:
print(f'INIT start')
if_ap = WLAN(AP_IF)
if_ap.active(False)
if_sta = WLAN(STA_IF)
if_sta.active(True)
if_sta.config(protocol=8) # WIFI_PROTOCOL_LR
esp_now = ESPNow()
esp_now.active(True)
esp_now.config(rate=0x29) # WIFI_PHY_RATE_LORA_250K
print('INIT complete')
except Exception as e:
print(e)
Expected behaviour
MPY: soft reboot
MicroPython-1.24.1-riscv-IDFv5.2.2-with-newlib4.3.0
(sysname='esp32', nodename='esp32', release='1.24.1', version='v1.24.1 on 2024-11-29', machine='ESP32C3 module with ESP32C3')
INIT start
INIT complete
MPY: soft reboot
MicroPython-1.25.0-riscv-IDFv5.2.2-with-newlib4.3.0
(sysname='esp32', nodename='esp32', release='1.25.0', version='v1.25.0 on 2025-04-15', machine='ESP32C3 module with ESP32C3')
INIT start
INIT complete
Observed behaviour
MPY: soft reboot
MicroPython-1.26.0-riscv-IDFv5.4.2-with-newlib4.3.0
(sysname='esp32', nodename='esp32', release='1.26.0', version='v1.26.0 on 2025-08-09', machine='ESP32C3 module with ESP32C3')
INIT start
[Errno 1] EPERM: ESP_FAIL
MPY: soft reboot
MicroPython-1.26.1-riscv-IDFv5.4.2-with-newlib4.3.0
(sysname='esp32', nodename='esp32', release='1.26.1', version='v1.26.1 on 2025-09-11', machine='ESP32C3 module with ESP32C3')
INIT start
[Errno 1] EPERM: ESP_FAIL
Additional Information
| micropython | IDF | esp_now.config(rate=0x29) |
|---|---|---|
| ESP32_GENERIC_C3-20241129-v1.24.1.bin | 5.2.2 | ✅ |
| ESP32_GENERIC_C3-20250415-v1.25.0.bin | 5.2.2 | ✅ |
| ESP32_GENERIC_C3-20250809-v1.26.0.bin | 5.4.2 | ❌ |
| ESP32_GENERIC_C3-20250911-v1.26.1.bin | 5.4.2 | ❌ |
Code of Conduct
Yes, I agree