Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post here first, or if you can't find a relevant section!
Post Reply
Jimbo1326
Posts: 4
Joined: Tue Mar 11, 2025 5:25 pm
Location: UK

Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by Jimbo1326 »

I have a windows 10 computer Running Visual Micro in Visual Studio 2026.

I am trying to develop an SD card data logger using the SDIO interface.

At the moment I have a BlackPill with an STM32F401CCU6 which according to the data sheet has an SDIO interface.

When I compile the STM32SD/examples/CardInfo.ino I get a string of errors like the following:
_sd.h: 182:28: error: un 'HAL_SD_CardInfoTypeDef'; did you mean 'HAL_SD_CardCIDTypedef'?
182 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
| ^~~~~~~~~~~~~~~~~~~~~~
| HAL_SD_CardCIDTypedef
bsp_sd.h: 187:24: error: unknown type name 'SD_HandleTypeDef'; did you mean 'PCD_HandleTypeDef'?
187 | void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
| ^~~~~~~~~~~~~~~~
| PCD_HandleTypeDef


I have on order a WeAct STM32F405RGT6 which also has an SDIO interface and If I compile for this board everyhing compiles OK.

Any advice on how to get the BlackPil to work please?

Jim
GonzoG
Posts: 516
Joined: Wed Jan 15, 2020 11:30 am
Answers: 37
Location: Prudnik, Poland

Re: Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by GonzoG »

F401Cx do not have SDIO. Page 11 of datasheet.
Jimbo1326
Posts: 4
Joined: Tue Mar 11, 2025 5:25 pm
Location: UK

Re: Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by Jimbo1326 »

OK GonzoG
I read the Features – SDIO interface on the front page of the data sheet and didn’t realise that depended on the package and as you say the UFQFPN package on the Black pill does not have the SDIO brought out.

Thanks for the clarification

Jim
ag123
Posts: 1974
Joined: Thu Dec 19, 2019 5:30 am
Answers: 31

Re: Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by ag123 »

get stm32f4{1}1
e.g.
https://github.com/WeActStudio/WeActStu ... iSTM32F4x1
note that I've not tried SDIO on this (yet), hence I can't tell for sure if it is possible on this board, review the specs for the board and stm32f411 datasheet and manual.

alternatives are stuff like this
https://github.com/greiman/SdFs/tree/master
but this is based on SPI interface.
it still works well though e.g. on stm32f401
note that the stm32 core SPI currently do not directly support DMA
if you are keen, you can try out my SPI libraries (experimental , untested)

https://github.com/ag88/stm32duino_spi_dma

viewtopic.php?t=2553

but again I've not tested it and more than likely some changes in the codes is needed both the FatFS library side and the SPI (DMA) side.
if you have DMA on SPI the transfer speeds is (very) fast.
but it may take some work to even get there

if you use my DMA library you can post in that thread or here with your own topic, I visit (every now and then) and I may respond, but that I do not visit here daily. you can also log an issue in github in that repo if you prefer.
olivia_49
Posts: 7
Joined: Mon Dec 29, 2025 6:25 pm

Re: Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by olivia_49 »

Hey Jim, the errors happen because the BlackPill’s STM32F401 doesn’t have full SDIO support in the Arduino/STM32 core you’re using, so the example won’t compile for that board. That’s why it works fine on your F405, which is fully supported. A practical workaround is to use the SD card in SPI mode, which works reliably on most STM32 boards without special drivers. For inspiration, you can check this STM32 data-logging project on PCBWay, it shows SD card logging with STM32 hardware and includes schematics and design files: https://www.pcbway.com/project/sharepro ... e.htmlAlso, the STM32SD library on GitHub is worth looking at if you plan to use SDIO on supported boards https://github.com/stm32duino/STM32SD
GonzoG
Posts: 516
Joined: Wed Jan 15, 2020 11:30 am
Answers: 37
Location: Prudnik, Poland

Re: Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by GonzoG »

olivia_49 wrote: Thu Feb 19, 2026 10:19 am Hey Jim, the errors happen because the BlackPill’s STM32F401 doesn’t have full SDIO support in the Arduino/STM32 core you’re using...
Completely wrong statement.
There is full SDIO support in STM32core for F401.
There's no SDIO hardware on STM32F401Cx chips.
fpiSTM
Posts: 1996
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 109
Location: Le Mans
Contact:

Re: Problem compiling STM32SD/examples/CardInfo.ino for STM32F401CCU6

Post by fpiSTM »

It seems to be ia/bot answer.
Post Reply

Return to “General discussion”