I am trying to access a sd card with the adafruit feather rp2040 usb host microcontroller (http://adafru.it/2922) and the adafruit adalogger featherwing rtc+sd (http://adafru.it/5723) to store sensor values on it. However, I can not get the sd card to be identified (OSError: no sd card). I have tried three different sd cards, formatted them with the sd card memory formatter. I have also tried two adalogger wings with the same result. I also tested all cs pins (5,9,10,13,25) in the code. I hope someone can help me. Here is my test code
Code: Select all
# Bibliotheken
import os
import storage
import board
import busio
import digitalio
import sdcardio
import time
import microcontroller
import displayio
import terminalio
spi = board.SPI()
cs = board.D5
sdcard = sdcardio.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
# Start Logging
print("Logging temperature to filesystem")
# Log Time
log_time = 2
last_log_time = -1
# Loop
while True:
try:
now = time.monotonic()
if now >= last_log_time + log_time:
with open("/sd/test.txt", "a") as f:
t = microcontroller.cpu.temperature
print("Temperature = %0.1f" % t)
f.write("%0.1f\n" % t)
last_log_time = now
except Exception as e:
print("Error:\n", str(e))
print("Resetting microcontroller in 5 seconds")
time.sleep(5)
microcontroller.reset()