Teensy 3.6 Internal SD card reader with Platform IO

Hello everyone,

One I want to say I’m really new at coding and havn’t coded in 2 years, but I have a new project that I want to start.

It starts with me reading in a folder in an SD and then a file within that SD and I will have multiple folders and files in the SD but all the same format.

I can’t seem to find any library that will let me use my internal SD card reader on my teensy. I know I can use the Arduino IDE + Teensyduino but I really like the Platform IO.

Does anyone know of a library I can use?

Let me know,
Thank you,

What exact problem do you have, in compilation or code?

The SD library is builtin to the Arduino-Teensy core package (this one, also see C:\Users\<user>\.platformio\packages\framework-arduinoteensy\libraries). No need to get another one.

The example sketch also explicitly talks about which pin changes have to be made to use the internal SD card reader

When I use the platformio.ini

platform = teensy
board = teensy36
framework = arduino

with the file above as src\main.cpp, with the changes

  • adding #include <Arduino.h> at the top
  • changing to const int chipSelect = BUILTIN_SDCARD;

it builds.

Scanning dependencies...
Dependency Graph
|-- <SD> 1.2.2
|   |-- <SPI> 1.0
|-- <SPI> 1.0
Building in release mode
Linking .pio\build\teensy36\firmware.elf
Building .pio\build\teensy36\firmware.hex
Checking size .pio\build\teensy36\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.9% (used 4900 bytes from 262144 bytes)
Flash: [          ]   2.0% (used 21116 bytes from 1048576 bytes)
========================== [SUCCESS] Took 1.81 seconds ==========================
1 Like


Wow thank you for the quick replay during my lunch break I will try and get this going.

During the quick read it seems like I have to download the SD library from Adafruit Industries on the platform IO IDE and then change the pins to make it work with the internal SD card reader.

I will read your replay in more detail later but thank you for a path forward.


Reread it carefully later, but you do not need to install any additional libraries, since the SD library is builtin to the Arduino-Teensy core package. In fact it would be harmfull to install another SD library that doesn’t fit the target board.

Bon appétit :smiley:

Hope you are having a good day Maxgerhardt,

I just wanted to let you know I was able to read the volume with the above example.

Next I’m going to figure out how to open the file and read from it. !

And also organize my code a little bit so I don’t have a big setup file in main.

Thanks again,

1 Like