Showing results for 
Search instead for 
Did you mean: 

Schematic And Library For uSD Card Bootloader

Associate III


I need to implement a Bootloader for an STM32L452RET6 as follows:

- using a uSD card over standard SPI (not Quad SPI)

- using the BOOT0 pin option

- using the ready available ST libraries


My questions, if someone could please help out, are:

1) which library can I use? And is it literally plug and play or do I need some additional code?

2) in the uSD card do I put just a single .HEX file? i.e. how does the bootloader know which file from the uSD card to read to upload?

3) I assume I can use any SPI port, and just configure the code in CubeMX, correct?

4) OPTIONAL... is there a way to upload firmware to a blank micro with this uSD? If so, how?


Thank you 😊


ST has historically bundled FatFs, example applications for that.

ST provided some AdaFruit shield libraries supporting SPI SD Card. The L452 also supports SDIO connectivity

Example apps to do IAP from USB MSC, usually using binaries.

BOOT0=HIGH, the System Loader does not support update from media, however connected.

I've previously built .BIN and .DFU updaters using FatFS / SDIO, some HTTP based ones using .HEX

The System Loader should permit you to push a loader into RAM and you could execute that, on an otherwise blank MCU.


So there are bits and pieces, likely going to need to be able to glue things together and code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you,

at the moment I can still modify the hardware but, due to the tight timescale of the project and because I am new to the entire ST micros famliy, I am looking for a solution to implement as quickly as possible and as safely as possible to update the firmware from uSD card. Because I don't want to risk having to spend time debugging something I am not familiar with which might take a lot of time,

So following also your feedback, I will have to relax the constraints to the bare minimum. Which is just update firmware (not programming it for the first time) from the uSD card and no need to use BOOT0 (unless it is required).

What is the simplest fastest way to do that with a ST official library?

Also (following questions numbering from above):

5) do I need to connect pin 2 of the uSD card (CD/DATA3/SPI_CS) to the micro to use any ST official library?

6) if so, do I need a pull-up or pulldown on pin2 of the micro SD card

7) And how does the library know there is a card without a card detect? Is that done through pin 2 (CD/DATA3/SPI_CS) ?


Thank you as always! 😊