Teensy 4.1: SD card IO error 5

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cpasto
 
Posts: 1
Joined: Mon Jun 14, 2021 11:56 am

Teensy 4.1: SD card IO error 5

Post by cpasto »

Hi there!
I'm a beginner user with python and boards and I'm having some issues with my project. I'm using Teensy 4.1 (cpython 6.3.0 version) and I'd like to write data on a SD Card (Kingstone SDHC 16gb Class 10).

I checked out https://learn.adafruit.com/micropython- ... s?view=all to sort it out, but with bad results.
When I run the code to print the list of files or read a *.txt file everything works fine, but when I try to write on a *.txt file, [Errno 5] Input/output error occours.

Can anyone help please?

Code: Select all

SCLK_PIN = board.CLK
MOSI_PIN = board.CMD
MISO_PIN = board.DAT0
CS_PIN = board.DAT3
spi = bitbangio.SPI(SCLK_PIN, MOSI = MOSI_PIN, MISO = MISO_PIN)
cs = digitalio.DigitalInOut(CS_PIN)

sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")

with open("/sd/test.txt", "w") as f:
    f.write("This is another line!\r\n")

User avatar
Franklin97355
 
Posts: 23938
Joined: Mon Apr 21, 2008 2:33 pm

Re: Teensy 4.1: SD card IO error 5

Post by Franklin97355 »

Another option is to post you question in the PJRC forum https://forum.pjrc.com/

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”