I thought I could figure this out... but since I am asking here, you know that I didn't
I can't get SdFat to work.
Setup:
• STM32F103C8 BluePill clone
• Official ST Core
• Arduino IDE 1.8.13
• No bootloader installed
• Use Serial connection and STM32CubeProgrammer to program
• SD module wired to SPI1 (SS = PA4, SCK = PA5, MISO = PA6, and MOSI = PA7)
• SdFat v2.0.4
On the latest version of SdFat (v2.0.4) there is a example program that allow you to switch between SD.h and SdFat.h for SD card support using SPI.
Setting USE_SD_H to 1 uses SD.h. In this example, the SD card works without any issues:
Using SD.h. Set USE_SD_H zero to use SdFat.h.
Type any character to begin.
Initializing SD card...initialization done.
Writing to test.txt...done.
test.txt:
testing 1, 2, 3.
testing 1, 2, 3.
testing 1, 2, 3.
testing 1, 2, 3.
Then I set USE_SD_H to 0 to use SdFat and it doesn't work.
Using SdFat.h. Set USE_SD_H nonzero to use SD.h.
Type any character to begin.
Initializing SD card...initialization failed!
After much testing, any SD example program using SD.h works. Any example program that uses SdFat.h doesn't work.
I had the same issue when using SdFat v1.1.4 then I upgraded to v2.0.4 hoping it worked, but it didn't.
Am I doing something wrong? I have tripled checked the wiring and since it does work on SD.h, it must be something else.
(Yes, I could just use SD.h, but I am excited to use some of the new features in SdFat v2, like long file names )