Skip to content

Allow using this library on esp boards #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gasagna opened this issue Nov 17, 2022 · 4 comments
Open

Allow using this library on esp boards #129

gasagna opened this issue Nov 17, 2022 · 4 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@gasagna
Copy link

gasagna commented Nov 17, 2022

I am trying to use this library on an esp32 dev board, since the SD library that comes with the arduino-esp32 library (mentioned in some other issues here) is not as feature-complete as this one and leads to random behaviour with some SD cards I have.

I have attempted to compile my project using this library (and other libs from arduino-esp32, e.g. SPI, ) and I got a

/Users/gasagna/Documents/Arduino/libraries/SD/src/utility/Sd2PinMap.h:524:4: error: #error Architecture or board not supported.
   #error Architecture or board not supported.
    ^~~~~

suggesting that my board is not supported. Well, OK, but ...

I then commented the compile #error directive at the end of Sd2PinMap.h to get

#else
  //   #error Architecture or board not supported.
#endif

and then initialised the SD card using the appropriate pins for my board, e.g. with

// sd card pins
#define SD_MISO  2
#define SD_MOSI  15
#define SD_SCLK  14
#define SD_CS    13

SPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
SD.begin(SD_CS);

The code not only compiles, but works like a charm.

I wonder what would be the consequences of removing that error directive, or maybe turning it into a more permissive compilation warning.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Nov 18, 2022
@ark02
Copy link

ark02 commented Dec 21, 2022

I too am trying to use this library with the esp platform and running into the same issues. Why was the compiler directive created for the esp chips? What should I be worried about?

@VeloSteve
Copy link

A reply here would be great. On Arduino Nano ESP32 I get an error every few hours with the 2.0.13 version of SD.h in the esp32 board package. Sometimes it even fails right after booting. SdFat.h is very reliable, but has conflicts with the FS.h library. If the SD library here would be the best of both worlds I would love to use it.

@dzalf
Copy link

dzalf commented Mar 10, 2025

Do you happen to have any updates on this?

I need to use the library with an ESP32 board too

@VeloSteve
Copy link

No update on the software, but I have a couple of comments. First, I have been using SdFat. It works very well for me.

Second, The only solution I found to my reliability problems was to not put two devices on the same SPI. It works fine on single core processors with two cores the approach is not thread safe. Rather than trying to write two thread safe libraries, I put my display on HSPI and the SD on VSPI. Now both are very reliable.

Steve

@arduino-libraries arduino-libraries locked and limited conversation to collaborators Mar 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

5 participants