Teensy 4.1 SD card problems


I have been trying to access the SD card slot on a teensy 4.1 in order to follow the audio tutorial, so far, without success.

When I load Part_1_03_playing_music, the monitor prints, "unable to access the SD card". I have had the same response trying to use the SD card slot on the audio shield (rev D) and have also tried using a Teensy 4.0. The only alterations I have made to the code were to adjust CS, MOSI and SCK pins accordingly. Sketches appear to compile and load without problems and I have sound at the headphone socket.

I have now loaded CardInfo in order to try a different approach. I get the message, "initializing SD card...initialization failed. Things to check:
* is a card inserted? - Yes, a SanDisk Ultra 32gb, formatted fat32 and containing the four audio files required for the tutorial.
* Is your wiring correct? - I think so - I've only added headers...
* Did you change the chipSelect to match your shield or module? - Yes

I've included pics to illustrate these points.

I have seen that Paul recommends not formatting SD cards yourself, which I did using Ubuntu 22.04.4 before I read his post. Could this be the problem? Should I just buy a new SD card? Or am I missing something very basic? I would prefer to fix the SD card I have if possible, in order to learn my way around the problem. If this is the problem, can anyone help me to do this?

Any suggestions or help would be gratefully received.


  • Screenshot from 2024-03-15 12-31-54.png
    Screenshot from 2024-03-15 12-31-54.png
    531.2 KB · Views: 23
  • Screenshot from 2024-03-15 12-31-00.png
    Screenshot from 2024-03-15 12-31-00.png
    136.3 KB · Views: 24
  • Screenshot from 2024-03-15 13-22-16.png
    Screenshot from 2024-03-15 13-22-16.png
    961.5 KB · Views: 22
In the following block of (commented out) code in that audio tutorial example, did you uncomment the first #define line to activate the BUITLIN_SDCARD (enabling use of the SDcard slot on the T4) ??

// Use these with the Teensy 3.5 & 3.6 & 4.1 SD card
//#define SDCARD_MOSI_PIN  11  // not actually used
//#define SDCARD_SCK_PIN   13  // not actually used

Hope that helps . . .

Mark J Culross
Hi Mark. Thanks for the suggestion.

Sadly, I've done that:

I used these for the 4.1 -

#define SDCARD_MOSI_PIN 11 // not actually used
#define SDCARD_SCK_PIN 13 // not actually used

and these -

#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13

for the 4.0 with audio shield.

I had the same results with each...
Ubuntu likely didn't put an MBR/partition table at the beginning of the card. Teensy's libraries don't know how to properly handle that situation.
Last edited:
jmarsh - I think your diagnosis was correct.

I've just run the following command trawled from an Ubuntu forum:

sudo dd if=/dev/zero of=/dev/disk/by-id/{yourhdd, in my case, sdc1} bs=1MB count=1

which, from what I understand, has deleted the first 500mb of the disk, containing the MBR/partition table.

I'm now able to play audio from the SD card slot on my 4.1. Sweeeet! Thanks again for your help.