Describe the bug
Connected to Serial Port!
Running: 10s
Traceback (most recent call last):
File "", line 93, in
KeyboardInterrupt:
import gc
gc.collect()
=== import M5
=== import os
=== import machine
=== import time
=== # Inicializar
=== M5.begin()
=== M5.Lcd.setRotation(1)
=== M5.Lcd.fillScreen(0x000000)
=== # Leer SD de forma SÚPER segura
=== mp3s = []
=== def safe_sd_read():
=== global mp3s
=== try:
=== # Resetear pines SD
=== import machine
=== cs_pin = machine.Pin(10, machine.Pin.OUT)
=== cs_pin.value(1)
=== time.sleep(0.05)
=== cs_pin.value(0)
=== time.sleep(0.05)
=== # Usar parámetros EXACTOS del Tab5
=== sd = machine.SDCard(
=== slot=3, # ¡IMPORTANTE! Tab5 usa slot 3
=== width=1, # 1-bit mode (más estable)
=== freq=2000000, # 2MHz (baja frecuencia)
=== cd=None,
=== wp=None
=== )
=== os.mount(sd, '/sd')
=== print("SD mounted")
=== # Leer
=== files = os.listdir('/sd')
=== print(f"Files: {len(files)}")
=== # Filtrar MP3
=== for f in files:
=== if f.lower().endswith('.mp3'):
=== mp3s.append(f)
=== print(f"MP3s found: {len(mp3s)}")
=== return True
=== except Exception as e:
=== print(f"SD fatal: {e}")
=== mp3s = []
=== return False
=== # Leer SD
=== sd_ok = safe_sd_read()
=== # Mostrar UI básica
=== def draw_ui():
=== M5.Lcd.fillScreen(0x000000)
=== M5.Lcd.setTextColor(0xFFFFFF)
=== M5.Lcd.setTextSize(2)
=== # Título
=== status = "SD OK" if sd_ok and mp3s else "SD Error"
=== M5.Lcd.drawString(f"MP3 Player - {status}", 10, 10)
=== if mp3s:
=== # Mostrar lista
=== y = 50
=== for i, song in enumerate(mp3s[:6]):
=== # Resaltar selección
=== if i == 0: # Primero seleccionado por defecto
=== M5.Lcd.setTextColor(0xFFFF00)
=== M5.Lcd.fillRect(5, y-5, 310, 30, 0x333333)
=== else:
=== M5.Lcd.setTextColor(0xFFFFFF)
=== # Texto
=== text = f"{i+1}. {song[:22]}" if len(song) > 22 else f"{i+1}. {song}"
=== M5.Lcd.drawString(text, 10, y)
=== y += 35
=== if y > 220:
=== break
=== else:
=== M5.Lcd.drawString("No MP3 files", 10, 50)
=== M5.Lcd.drawString("on SD card", 10, 85)
=== # Pie
=== M5.Lcd.setTextColor(0x00FF00)
=== M5.Lcd.drawString(f"Total: {len(mp3s)}", 200, 220)
=== # Dibujar
=== draw_ui()
=== print("UI drawn. Ready.")
=== # Loop pasivo (solo mantener vivo)
=== counter = 0
=== while True:
=== time.sleep(1)
=== counter += 1
=== # Indicador de vida
=== if counter % 10 == 0:
=== print(f"Running: {counter}s")
=== # Pequeño LED en pantalla
=== if (counter // 5) % 2 == 0:
=== M5.Lcd.fillRect(310, 10, 5, 5, 0xFF0000)
=== else:
=== M5.Lcd.fillRect(310, 10, 5, 5, 0x00FF00)
===
SD fatal: 16
UI drawn. Ready.
E (33817) sdmmc_io: sdmmc_io_rw_extended: sdmmc_send_cmd returned 0x107
E (33818) H_SDIO_DRV: sdio_write_task: 0: Failed to send data: 263 68 68
E (34819) sdmmc_io: sdmmc_io_rw_extended: sdmmc_send_cmd returned 0x107
E (34819) H_SDIO_DRV: sdio_write_task: 1: Failed to send data: 263 68 68
E (34821) H_SDIO_DRV: Unrecoverable host sdio state, reset host mcu
ESP-ROM:esp32p4-eco2-20240710
Build:Jul 10 2024
rst:0xc (SW_CPU_RESET),boot:0x20c (SPI_FAST_FLASH_BOOT)
Core0 Saved PC:0x4ff01060
Core1 Saved PC:0x4ff0ad04
SPI mode:DIO, clock div:1
load:0x4ff33ce0,len:0xd04
load:0x4ff2abd0,len:0xab4
load:0x4ff2cbd0,len:0x2f94
entry 0x4ff2abd0
sdio_mempool_create free:27089380 min-free:27089380 lfb-def:26738688 lfb-8bit:26738688
E (3226) i2c.master: this port has not been initialized, please initialize it first
_ ()/ | | _____ __
| | | | | || |/ _ \ \ /\ / /
| || | | | | () \ V V /
_,||| ||___/ _/_/ V2.3.8
To reproduce
Uiflow firmware V2.3.8
using SDIO to read SD files
Error Sequence:
Initialization Attempt:
text
sd = machine.SDCard(slot=3, width=1, freq=2000000)
os.mount(sd, '/sd')
Returns error: 16 (ENODEV - Device not found)
System Crash After Idle Period:
Even with NO SD card access, after 30-60 seconds of idle operation:
text
E (xxxxx) sdmmc_io: sdmmc_io_rw_extended: sdmmc_send_cmd returned 0x107
E (xxxxx) H_SDIO_DRV: sdio_write_task: 0: Failed to send data: 263 68 68
E (xxxxx) H_SDIO_DRV: Unrecoverable host sdio state, reset host mcu
System performs hard reset.
Key Findings:
- SDIO Driver Corruption:
The SDIO host driver enters an "unrecoverable state" spontaneously
Occurs even when SD card is NOT accessed after initial mount attempt
Happens during time.sleep() with no active code execution
- Timing Issues:
Crash occurs consistently 30-60 seconds after boot
Independent of user code complexity
Happens even with minimal MicroPython scripts
- Hardware State:
Occurs with or without SD card inserted
All tested SD cards (FAT32, various brands/sizes)
Multiple Tab5 units show same behavior (potential batch issue)
Expected behavior
There shouldn't be restarts every time I try to use the SDIO controller; the Tab5 restarts even without the SD card inserted and with error checking.
Screenshots
No response
Environment
- OS:
- IDE &IDE Version:
- Repository Version:
Additional context
Reproduction Code:
python
import M5
import time
Minimal reproduction
M5.begin()
M5.Lcd.fillScreen(0x000000)
M5.Lcd.drawString("SDIO Bug Test", 10, 10)
print("Testing SDIO stability...")
Attempt 1: Basic SD card init
try:
import machine, os
sd = machine.SDCard(slot=3)
os.mount(sd, '/sd')
print("SD mounted successfully")
except Exception as e:
print(f"SD init failed: {e}")
print("Entering idle loop...")
Crash occurs here after 30-60 seconds
counter = 0
while True:
time.sleep(1)
counter += 1
if counter % 10 == 0:
print(f"Alive: {counter}s")
Testing Performed:
✅ Different SD Cards: SanDisk, Kingston, Samsung (8GB-32GB, FAT32)
✅ Various Slot Parameters: slot=2, slot=3, width=1, width=4
✅ Frequency Variations: 1MHz to 20MHz
✅ With/Without SD Card: Crash occurs in both cases
✅ Different Power Sources: USB-C, external 5V
✅ Factory Reset/Re-flash: Issue persists
Issue checklist
Describe the bug
Connected to Serial Port!
Running: 10s
Traceback (most recent call last):
File "", line 93, in
KeyboardInterrupt:
=== import M5
=== import os
=== import machine
=== import time
=== # Inicializar
=== M5.begin()
=== M5.Lcd.setRotation(1)
=== M5.Lcd.fillScreen(0x000000)
=== # Leer SD de forma SÚPER segura
=== mp3s = []
=== def safe_sd_read():
=== global mp3s
=== try:
=== # Resetear pines SD
=== import machine
=== cs_pin = machine.Pin(10, machine.Pin.OUT)
=== cs_pin.value(1)
=== time.sleep(0.05)
=== cs_pin.value(0)
=== time.sleep(0.05)
=== # Usar parámetros EXACTOS del Tab5
=== sd = machine.SDCard(
=== slot=3, # ¡IMPORTANTE! Tab5 usa slot 3
=== width=1, # 1-bit mode (más estable)
=== freq=2000000, # 2MHz (baja frecuencia)
=== cd=None,
=== wp=None
=== )
=== os.mount(sd, '/sd')
=== print("SD mounted")
=== # Leer
=== files = os.listdir('/sd')
=== print(f"Files: {len(files)}")
=== # Filtrar MP3
=== for f in files:
=== if f.lower().endswith('.mp3'):
=== mp3s.append(f)
=== print(f"MP3s found: {len(mp3s)}")
=== return True
=== except Exception as e:
=== print(f"SD fatal: {e}")
=== mp3s = []
=== return False
=== # Leer SD
=== sd_ok = safe_sd_read()
=== # Mostrar UI básica
=== def draw_ui():
=== M5.Lcd.fillScreen(0x000000)
=== M5.Lcd.setTextColor(0xFFFFFF)
=== M5.Lcd.setTextSize(2)
=== # Título
=== status = "SD OK" if sd_ok and mp3s else "SD Error"
=== M5.Lcd.drawString(f"MP3 Player - {status}", 10, 10)
=== if mp3s:
=== # Mostrar lista
=== y = 50
=== for i, song in enumerate(mp3s[:6]):
=== # Resaltar selección
=== if i == 0: # Primero seleccionado por defecto
=== M5.Lcd.setTextColor(0xFFFF00)
=== M5.Lcd.fillRect(5, y-5, 310, 30, 0x333333)
=== else:
=== M5.Lcd.setTextColor(0xFFFFFF)
=== # Texto
=== text = f"{i+1}. {song[:22]}" if len(song) > 22 else f"{i+1}. {song}"
=== M5.Lcd.drawString(text, 10, y)
=== y += 35
=== if y > 220:
=== break
=== else:
=== M5.Lcd.drawString("No MP3 files", 10, 50)
=== M5.Lcd.drawString("on SD card", 10, 85)
=== # Pie
=== M5.Lcd.setTextColor(0x00FF00)
=== M5.Lcd.drawString(f"Total: {len(mp3s)}", 200, 220)
=== # Dibujar
=== draw_ui()
=== print("UI drawn. Ready.")
=== # Loop pasivo (solo mantener vivo)
=== counter = 0
=== while True:
=== time.sleep(1)
=== counter += 1
=== # Indicador de vida
=== if counter % 10 == 0:
=== print(f"Running: {counter}s")
=== # Pequeño LED en pantalla
=== if (counter // 5) % 2 == 0:
=== M5.Lcd.fillRect(310, 10, 5, 5, 0xFF0000)
=== else:
=== M5.Lcd.fillRect(310, 10, 5, 5, 0x00FF00)
===
SD fatal: 16
UI drawn. Ready.
E (33817) sdmmc_io: sdmmc_io_rw_extended: sdmmc_send_cmd returned 0x107
E (33818) H_SDIO_DRV: sdio_write_task: 0: Failed to send data: 263 68 68
E (34819) sdmmc_io: sdmmc_io_rw_extended: sdmmc_send_cmd returned 0x107
E (34819) H_SDIO_DRV: sdio_write_task: 1: Failed to send data: 263 68 68
E (34821) H_SDIO_DRV: Unrecoverable host sdio state, reset host mcu
ESP-ROM:esp32p4-eco2-20240710
Build:Jul 10 2024
rst:0xc (SW_CPU_RESET),boot:0x20c (SPI_FAST_FLASH_BOOT)
Core0 Saved PC:0x4ff01060
Core1 Saved PC:0x4ff0ad04
SPI mode:DIO, clock div:1
load:0x4ff33ce0,len:0xd04
load:0x4ff2abd0,len:0xab4
load:0x4ff2cbd0,len:0x2f94
entry 0x4ff2abd0
sdio_mempool_create free:27089380 min-free:27089380 lfb-def:26738688 lfb-8bit:26738688
E (3226) i2c.master: this port has not been initialized, please initialize it first
_ ()/ | | _____ __
| | | | | || |/ _ \ \ /\ / /
| || | | | | () \ V V /
_,||| ||___/ _/_/ V2.3.8
To reproduce
Uiflow firmware V2.3.8
using SDIO to read SD files
Error Sequence:
Initialization Attempt:
text
sd = machine.SDCard(slot=3, width=1, freq=2000000)
os.mount(sd, '/sd')
Returns error: 16 (ENODEV - Device not found)
System Crash After Idle Period:
Even with NO SD card access, after 30-60 seconds of idle operation:
text
E (xxxxx) sdmmc_io: sdmmc_io_rw_extended: sdmmc_send_cmd returned 0x107
E (xxxxx) H_SDIO_DRV: sdio_write_task: 0: Failed to send data: 263 68 68
E (xxxxx) H_SDIO_DRV: Unrecoverable host sdio state, reset host mcu
System performs hard reset.
Key Findings:
The SDIO host driver enters an "unrecoverable state" spontaneously
Occurs even when SD card is NOT accessed after initial mount attempt
Happens during time.sleep() with no active code execution
Crash occurs consistently 30-60 seconds after boot
Independent of user code complexity
Happens even with minimal MicroPython scripts
Occurs with or without SD card inserted
All tested SD cards (FAT32, various brands/sizes)
Multiple Tab5 units show same behavior (potential batch issue)
Expected behavior
There shouldn't be restarts every time I try to use the SDIO controller; the Tab5 restarts even without the SD card inserted and with error checking.
Screenshots
No response
Environment
Additional context
Reproduction Code:
python
import M5
import time
Minimal reproduction
M5.begin()
M5.Lcd.fillScreen(0x000000)
M5.Lcd.drawString("SDIO Bug Test", 10, 10)
print("Testing SDIO stability...")
Attempt 1: Basic SD card init
try:
import machine, os
sd = machine.SDCard(slot=3)
os.mount(sd, '/sd')
print("SD mounted successfully")
except Exception as e:
print(f"SD init failed: {e}")
print("Entering idle loop...")
Crash occurs here after 30-60 seconds
counter = 0
while True:
time.sleep(1)
counter += 1
if counter % 10 == 0:
print(f"Alive: {counter}s")
Testing Performed:
✅ Different SD Cards: SanDisk, Kingston, Samsung (8GB-32GB, FAT32)
✅ Various Slot Parameters: slot=2, slot=3, width=1, width=4
✅ Frequency Variations: 1MHz to 20MHz
✅ With/Without SD Card: Crash occurs in both cases
✅ Different Power Sources: USB-C, external 5V
✅ Factory Reset/Re-flash: Issue persists
Issue checklist