Teensy LC + SdFat library

Jerware

Well-known member
I realize there are several libraries left to port, but is there a ballpark ETA for SdFat? I just received my LC's today and I'm anxious to get my project up and running. I make extensive use of SdFat, and would like to avoid converting to the (much older and less efficient) SD library, but I will if need be. Thanks.

EDIT: Attached compile error output.
 

Attachments

  • teensyLCsdfat.txt
    56.2 KB · Views: 231
Last edited:
I am not an expert in SDFAT, but played with it a little awhile ago. My guess is it will take some work, to add Teency LC to SdSpiTeensy3.cpp, which is very specific to SPI of the Teensy 3.x. It directly uses the SPI registers, which are considerably different on the Teensy LC.

I was able to make a test example compile, but forcing it to use software SPI.... This was done by edigint SdFatconfig.h and change: #define TEENSY3_SOFT_SPI 0
from a 0 to a 1...

Again this looks like a reasonable amount of work. Not sure how well it would work (if at all), if you could basically force it to use the SPI library or use the AVR register emulation...
 
Teensy-LC would require lots of changes so I won't support custom SPI for Teensy-LC.

I will probably drop support for custom SPI for Teensy 3.0 and 3.1 also and just use the standard SPI library.

You can use the current SdFat-beta with the following changes.

Edit SdFatConfig.h and set SD_SPI_CONFIGURATION to one at about line 81.
Code:
#define SD_SPI_CONFIGURATION 1

Edit SdSpiTeensy3.cpp and at about line 21 make this change.

From this:
Code:
#if defined(__arm__) && defined(CORE_TEENSY)
To this:
Code:
#if defined(__arm__) && defined(CORE_TEENSY) && !defined(__MKL26Z64__)

There will be several compiler warnings. I will soon fix these and make the above change to SdSpiTeensy3.cpp on GitHub.
 
Thank you so much! I made the edits you suggested and I'm so close. I only appear to have compile errors surrounding getFilename calls like this one...

Code:
myFile.getFilename(folder);

...results in...

'class SdFile' has no member named 'getFilename'

UPDATE: I think I got it! Solution was to change "SdFile" class to "File" at the top of the project sketch, and then use the getName() function instead of getFilename(). For example:

Code:
myFile.getName(folder, 13);
 
Last edited:
The new SdFat supports long file names which can be up to 255 bytes long so getName() has a size. getFileName() was one of the few functions that could not be used with long file names.

getName() should also work with the SdFile class.
 
The new SdFat supports long file names which can be up to 255 bytes long so getName() has a size. getFileName() was one of the few functions that could not be used with long file names.

getName() should also work with the SdFile class.

Ah, you're absolutely right. SdFile class works fine. My project is working great -- THANK YOU!
 
Back
Top