4.1 Error - No SD Card - What am I doing wrong? Help Please!

Status
Not open for further replies.

DB1990

Member
Using Circuitpython on my first project, I followed this guide: https://learn.adafruit.com/micropython-hardware-sd-cards/tdicola-circuitpython

Here's my code, and below that the error messages.
import os
import board
import time
from adafruit_onewire.bus import OneWireBus
import adafruit_ds18x20
import analogio
import busio
import digitalio
import storage
import adafruit_sdcard
import adafruit_max31855

SD_CS = board.D44

# Next create the SPI bus and a digital output for the microSD card's
# chip select line (be sure to select the right pin name or number for your wiring)
spi = busio.SPI(board.D45, MOSI=board.D43, MISO=board.D42)
cs = digitalio.DigitalInOut(SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")

** line 19 is: sdcard = adafruit_sdcard.SDCard(spi, cs)

Traceback (most recent call last):
File "code.py", line 19, in <module>
File "adafruit_sdcard.py", line 116, in __init__
File "adafruit_sdcard.py", line 177, in _init_card
File "adafruit_sdcard.py", line 145, in _init_card
OSError: no SD card

I'm using a FAT32 formatted 32GB uSD card, formatted with SD Card Formatter. It's a cheap card, and the only one out of 5 that I confirmed works completely in my PC via a USB adapter. 2 other cards in the 5-pack worked in the PC, but were fried after trying them in the Teensy with this code.
 
Last edited:
You may need to adapt the board.DXX to the teensy you are using
(don't know the circuitPython convention)
 
Whether CircuitPython is able to use the built in SD socket on Teensy 4.1 is unknown to me. That socket uses the faster 6-signals SDIO protocol, not 4-signals SPI protocol. There's a good chance CircuitPython may only support SPI protocol, since (as far as I know) none of Adafruit's boards have SDIO.

On the 2 "fried" cards, can a PC still detect the card and give you the ability to reformat it?
 
Thank you both for quick replies! The PC will 'see' the SD USB drive, but can't format it, or anything else. Clicking it (I: USB SD drive) Windows says "please insert a disk in I:" SD Card Formatter hangs when the fired cards are in.

I actually think the problem is the cheap SD cards. 1 of the 5 I bought did not have any issue after trying it in the Teensy.

I did confirm that Circuitpython does not yet support SDIO, via support forums on the Adafruit website.

I just want to log a text data file. Can I log it to the internal Flash ram, and will it stay when power to the board is off? If so, can you point me toward more info on how to do this?

Thanks again.
 
Status
Not open for further replies.
Back
Top