Many errors in the "STM32duino_STM32SD" library

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
ChPr
Posts: 25
Joined: Thu Jun 20, 2024 8:03 am
Answers: 1

Many errors in the "STM32duino_STM32SD" library

Post by ChPr »

Hello everybody,

I want to use the "STM32duino_STM32SD" library (last version 1.3.2) to connect a SD Card to my Blue Pill STM32F103C8 with 128 k.

In the Arduino IDE, to get this card, I selected :
  • STM32 MCU based boards --> Generic STM32F1 series --> BluePill F103CB(or C8 with 128 k)
  • Uploadmethod : "STM32CubeProgrammer (SWD)"
NOTE : This configuration works well to animate a blinking LED.

Now, I try an example of the library : "CardInfo.ino". This sketch includes <STM32SD.h>.

When I click to compile, I get the following errors, all belonging to this library :

Code: Select all

In file included from e:\Arduino\libraries\STM32duino_STM32SD\src/Sd2Card.h:40,
                 from e:\Arduino\libraries\STM32duino_STM32SD\src/STM32SD.h:22,
                 from E:\Arduino\libraries\STM32duino_STM32SD\examples\CardInfo\CardInfo.ino:12:
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:179:9: error: variable or field 'BSP_SD_GetCardInfo' declared void
  179 | void    BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
      |         ^~~~~~~~~~~~~~~~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:179:28: error: 'HAL_SD_CardInfoTypeDef' was not declared in this scope
  179 | void    BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
      |                            ^~~~~~~~~~~~~~~~~~~~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:179:52: error: 'CardInfo' was not declared in this scope; did you mean 'SD_CardInfo'?
  179 | void    BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
      |                                                    ^~~~~~~~
      |                                                    SD_CardInfo
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:184:9: error: variable or field 'BSP_SD_MspInit' declared void
  184 | void    BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |         ^~~~~~~~~~~~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:184:24: error: 'SD_HandleTypeDef' was not declared in this scope; did you mean 'SPI_HandleTypeDef'?
  184 | void    BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |                        ^~~~~~~~~~~~~~~~
      |                        SPI_HandleTypeDef
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:184:42: error: 'hsd' was not declared in this scope
  184 | void    BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |                                          ^~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:184:47: error: expected primary-expression before 'void'
  184 | void    BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |                                               ^~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:185:9: error: variable or field 'BSP_SD_Detect_MspInit' declared void
  185 | void    BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |         ^~~~~~~~~~~~~~~~~~~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:185:31: error: 'SD_HandleTypeDef' was not declared in this scope; did you mean 'SPI_HandleTypeDef'?
  185 | void    BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |                               ^~~~~~~~~~~~~~~~
      |                               SPI_HandleTypeDef
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:185:49: error: 'hsd' was not declared in this scope
  185 | void    BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |                                                 ^~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:185:54: error: expected primary-expression before 'void'
  185 | void    BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params);
      |                                                      ^~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:186:9: error: variable or field 'BSP_SD_MspDeInit' declared void
  186 | void    BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
      |         ^~~~~~~~~~~~~~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:186:26: error: 'SD_HandleTypeDef' was not declared in this scope; did you mean 'SPI_HandleTypeDef'?
  186 | void    BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
      |                          ^~~~~~~~~~~~~~~~
      |                          SPI_HandleTypeDef
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:186:44: error: 'hsd' was not declared in this scope
  186 | void    BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
      |                                            ^~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:186:49: error: expected primary-expression before 'void'
  186 | void    BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
      |                                                 ^~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/bsp_sd.h:62:25: error: 'HAL_SD_CardInfoTypeDef' does not name a type
   62 | #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
      |                         ^~~~~~~~~~~~~~~~~~~~~~
e:\Arduino\libraries\STM32duino_STM32SD\src/Sd2Card.h:135:5: note: in expansion of macro 'BSP_SD_CardInfo'
  135 |     BSP_SD_CardInfo _SdCardInfo;
      |     ^~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1
it's not normal for such a library to have such errors. i've tried earlier versions: same problem.

How can I solve this problem?

Best regards.

Pierre.
by fpiSTM » Thu Jun 20, 2024 2:38 pm
Library use default SPI instance. Sketch is already configured to use it.
Sketch:
https://github.com/arduino-libraries/SD ... rdInfo.ino

Library documentation:
https://www.arduino.cc/reference/en/libraries/sd/

As BluePill does not have a Arduino connect you can find in the variant which pin is used by default for SPI:
https://github.com/stm32duino/Arduino_C ... #L106-L114

Think to update the CS pin you used.
Go to full post
fpiSTM
Posts: 1944
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: Many errors in the "STM32duino_STM32SD" library

Post by fpiSTM »

Read the Readme.md on github . This library is for SD over SDIO or SDMMC interface. STM32F1 does not support this. I guess you have a SD over SPI in that case use SD library from Arduino.
ChPr
Posts: 25
Joined: Thu Jun 20, 2024 8:03 am
Answers: 1

Re: Many errors in the "STM32duino_STM32SD" library

Post by ChPr »

Thank you for this reply.

I tried the STM32 library because I had previously tried an Arduino library ... which gave no results.

Perhaps you have an Arduino library to recommend.

Sincerely your.

Pierre.
fpiSTM
Posts: 1944
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: Many errors in the "STM32duino_STM32SD" library

Post by fpiSTM »

Use the one provided in Arduino IDE: SD.
ChPr
Posts: 25
Joined: Thu Jun 20, 2024 8:03 am
Answers: 1

Re: Many errors in the "STM32duino_STM32SD" library

Post by ChPr »

I can't get a sketch using the SD library to work.

On the STM32F103C8 board, there are two groups of pins on the connector for the SPI1 bus.

How do you choose SPI1 over SPI2 ? Is it automatic ?

If SPI1 is chosen, which plug group is selected ? Is one or the other, automatic, and if so, which group is selected ?

If nothing is automatic, are there any special instructions?

Thank you for this information.

Best regards.

Pierre.
fpiSTM
Posts: 1944
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: Many errors in the "STM32duino_STM32SD" library

Post by fpiSTM »

Library use default SPI instance. Sketch is already configured to use it.
Sketch:
https://github.com/arduino-libraries/SD ... rdInfo.ino

Library documentation:
https://www.arduino.cc/reference/en/libraries/sd/

As BluePill does not have a Arduino connect you can find in the variant which pin is used by default for SPI:
https://github.com/stm32duino/Arduino_C ... #L106-L114

Think to update the CS pin you used.
ChPr
Posts: 25
Joined: Thu Jun 20, 2024 8:03 am
Answers: 1

Re: Many errors in the "STM32duino_STM32SD" library

Post by ChPr »

Thank you very much "fpiSTM" for this information.

I had already tried this code without being able to make it work. I think it was due to the fact that I was using PB3, PB4, PB5 and PA15 pins. Since I've been using PA4, PA5, PA6 and PA7, it works without a problem.
Thanks again.
Best regards.
Pierre.
fpiSTM
Posts: 1944
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: Many errors in the "STM32duino_STM32SD" library

Post by fpiSTM »

Welcome. See the wiki to know how change the default pins.
Post Reply

Return to “IDE's”