Teensy 4.1 - BUILTIN_SDCARD and PlatformIO

Davidelvig

Well-known member
I'm doing a test project with a new Teensy 4.1 to upgrade my code from a working Teensy 3.2 project.

I want to use BUILTIN_SDCARD, where I was using a SPI-connected SD card on Teensy 3.2.

On standard TeensyDuino 1.53, I can run examples/SD/Cardinfo without errors, changing
const int chipSelect = BUILTIN_SDCARD;

I see the contents of the uSD card as expected.

When running my project on VS Code - and new PlatformIO project of teensy 4.1.
The compiler complains about not finding BUILTIN_SDCARD.

lib/dbLibs/dbSD.cpp:7:24: error: 'BUILTIN_SDCARD' was not declared in this scope
const int chipSelect = BUILTIN_SDCARD;
^
I expect I'm missing something simple.

Ideas?



VSCode; 1.74.3 (Universal)
PlatformIO 6.1.6 is currently the newest version available.

PlatformIO.ini
Code:
[env:teensy41]
platform = teensy
board = teensy41
framework = arduino

build_flags = -D USB_MIDI_SERIAL -D TEENSY_PLATFORM
lib_deps = 
	robtillaart/RunningMedian@^0.3.0
	sstaub/TeensyID@^1.3.1
	arduino-libraries/Madgwick@^1.2.0
	sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@^1.1.2
	adafruit/Adafruit GFX Library@^1.10.4
	adafruit/Adafruit ST7735 and ST7789 Library@^1.6.0
	adafruit/Adafruit BusIO@^1.7.1
	arduino-libraries/SD
	ivanseidel/LinkedList@0.0.0-alpha+sha.dac3874d28
lib_extra_dirs = 
	../dbLibraries

Builtin_SDCARD.png
 
Sorry I am not a platformerIO user, but your simple images/code do not show you including <SD.h>

You have some other <dbSD.h> which I don't know what that is.
It does show in your platform.ini file stuff that it depends on: arduino-libraries/SD
But not sure what version that is? If it is the old SD library it may not have it.
I don't see anywhere wher eyou depend on SDFat library which the newer SD library is a simple front end to.

The current SD.h file has:
Code:
...
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__)
#define BUILTIN_SDCARD 254
#endif
...

edit: paste the right section
 
I refer to <sd.h> in my own dbSD.h... but you were right.
I had an old library reference

arduino-libraries/SD

Which resolved to a 2010 library from Sparkfun.

Thanks so much!
 
Back
Top