LitteFS and SdFat together issues?

Status
Not open for further replies.

jdredd

Active member
Using A Teensy 4.1

Windows 11 Platform

TeensyDuino 1.55 installed

Arduino IDE 1.8.16

I have 8mb ram and 16mb QSPI chip.

My plans was to have configuration files and things that don't change much stored on the QSPI chip.

SD card is for saving logging data.

The config is on the QSPI so don't loose settings quickly when swapping to other SD cards and such.

BUT, if you don't have A flashmem QSPI chip, then it will just use the SD card then to save settings AND logging data.

Anyways.. all my SD code worked up until I started playing with LittleFS and QSPI flashmem.

Using the SdFat ReadCsvFile demo for example

just add

#include <LittleFS.h>

Just having that, causes file access to fail.

Does not matter if before or after #include <SdFat.h>

I found this topic @ https://forum.pjrc.com/threads/67832-Using-LittleFS-and-SDFat-together

But nothing helped.

For testing, I even used my 2nd Teensy 4.1 with nothing plugged into it. Just SD card inserted. And same problem.

Looking for insight here on what I could me missing?
 
Looking at the Verbose Console output - does it show the LittleFS library being referenced?

If so is it coming from the TeensyDuino install folder and not an older copy in sketchbook folder - same for SdFat.
 
Update: When adding the "#include <LittleFS.h>" there is a conflict it seems using the SdFat example :{local install}\hardware\teensy\avr\libraries\SdFat\examples\ReadCsvFile\ReadCsvFile.ino
Code:
Type any character to start
error: open failed

It works here without that then fails as above.

Perhaps to use LittleFS.h use the SD.H style SD card access like this and examples for that library : {local install}\hardware\teensy\avr\libraries\SD\examples\listfiles\listfiles.ino
> this works and LittleFS uses the FS/FILE structs as shared with SD.H

SdFat was added not long ago using a wrapper in SD.H, but using SdFat directly is a whole different system. Other FS changes are under way as well minor edits in TD 1.55 and much more in beta with TD 1.56. So this may be resolved - or not with competing underlying 'FILE' types.
 
Update: When adding the "#include <LittleFS.h>" there is a conflict it seems using the SdFat example :{local install}\hardware\teensy\avr\libraries\SdFat\examples\ReadCsvFile\ReadCsvFile.ino
Code:
Type any character to start
error: open failed

It works here without that then fails as above.

Perhaps to use LittleFS.h use the SD.H style SD card access like this and examples for that library : {local install}\hardware\teensy\avr\libraries\SD\examples\listfiles\listfiles.ino
> this works and LittleFS uses the FS/FILE structs as shared with SD.H

SdFat was added not long ago using a wrapper in SD.H, but using SdFat directly is a whole different system. Other FS changes are under way as well minor edits in TD 1.55 and much more in beta with TD 1.56. So this may be resolved - or not with competing underlying 'FILE' types.

Thanks. Just removed SdFat all together and any unique code to it. And just use SD.h using the BUILTIN_SDCARD and all is working now it looks.
 
Thanks. Just removed SdFat all together and any unique code to it. And just use SD.h using the BUILTIN_SDCARD and all is working now it looks.

Good news. SdFat code IS being used for much improved performance ... it is just being used in a LittleFS compatible way as wrapped with wrapping in SD.H.

There is the other example that shows ...\SD\examples\SdFat_Usage\SdFat_Usage.ino - if needed that may present a way to directly use other 'unwrapped' elements directly if needed - and not break.
 
Status
Not open for further replies.
Back
Top