SC card and ethernet issues on Lilygo T-ETH Lite (ESP32-S3) #17943
-
Hi all, EDIT: I finally managed to get both ethernet and the SD card working on my Lilygo T-ETH Lite. The code below runs fine once. But after a soft reboot (stop restart backend in Thonny) I get all kinds of errors on the SD and ethernet. If I unplug/replug the board, the code runs fine again, but just once. Does anyone know why this happens and how i can prevent it? Thanks Oh and : MicroPython v1.25.0 on 2025-04-15; Generic ESP32S3 module with ESP32S3 EDIT: import os, network, time, ntptime
from machine import Pin, SPI, SDCard
from time import sleep_ms as sms
# Ethernet ===============================================
eth_spi = SPI(1, sck=Pin(10), mosi=Pin(12), miso=Pin(11))
eth_cs = Pin(9)
nic = network.LAN(phy_type=network.PHY_W5500,
spi=eth_spi, cs=eth_cs,
int=Pin(13), phy_addr=0)
nic.active(True)
nic.ifconfig('dhcp')
# Wait for connection
while not nic.isconnected():
print(".", end="")
sms(500)
print("\nConnected! IP:", nic.ifconfig())
# NTP ===================================================
ntptime.host = "pool.ntp.org"
# SD Card ===============================================
sd = SDCard(slot=2, miso=5, mosi=6,
sck=7, cs=42)
os.mount(sd, "/sd")
print("SD Mounted")
for i in range(5):
try:
ntptime.settime()
with open("/sd/ntp_log.txt", "a") as f:
log = f'{time.localtime()}\n'
f.write(log)
print(f'Time logged: {log}')
except Exception as e:
print(f'Logging failed: {e}')
sms(5000)
# Unmount SD
os.umount("/sd")
print("SD unmounted") |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ok, the solution is actually not that complicated: nic = network.LAN(phy_type=network.PHY_W5500,
spi=eth_spi, cs=eth_cs,
int=Pin(13), phy_addr=0)
if nic.active():
nic.active(False)
sms(200)
nic.active(True)
nic.ifconfig('dhcp') |
Beta Was this translation helpful? Give feedback.
Ok, the solution is actually not that complicated: