I am using STM32F103C8 and I am triing to compile a code with SDFat library. The problem is I need to use the second channel of the SPI1 (pins PB5,PB4,PB3, PA15):
I found out that is possible to use SDFat lib and include SPIClass inside its constructor. Then I could use this code:
SPIClass SPI_1(PB5,PB4,PB3, PA15);
SdFat sd(&SPI_1);
The problem is this compliation error:
no matching function for call to 'SdFat::SdFat(SPIClass*)'
Do you have any idea how to solve this error or how to work with SD card on different pins?
Here is source code of this library: https://github.com/greiman/SdFat/blob/master/src/SdFat.h
-
is IMPLEMENT_SPI_PORT_SELECTION or DOXYGEN defined anywhere? What is it defined as?Delta_G– Delta_G2020年07月09日 23:26:01 +00:00Commented Jul 9, 2020 at 23:26
-
That´s inside SDFat library. I am not sure what does it meanLucasN– LucasN2020年07月10日 11:15:46 +00:00Commented Jul 10, 2020 at 11:15
-
Well if it is defined as 0 or isn’t defined then that constructor you underlined is not part of the code. That preprocessor directive decides if that line will be included or not. You’ll have to look and see if you can find it.Delta_G– Delta_G2020年07月10日 12:22:49 +00:00Commented Jul 10, 2020 at 12:22
-
Can you share your schematic? I am trying to do the same but it is always failing to initialize.Shubham Jain– Shubham Jain2020年09月20日 18:35:14 +00:00Commented Sep 20, 2020 at 18:35
1 Answer 1
Ok, I found out that the sdFat library is not supported on stm32 bluepill (sd card HAL peripherals are not enabled), so I decided to use basic Arduino SD library (it uses SPI commands, not HAL).
Also I have to change pins (from SPI1_1 to SPI1_2) in variant.h and PeripheralPins.c files of bluepill board. - And finally it works (SPI1_2).