2016-02-28 09:59 PM
Hi All,
I'm using Nucleo 152RE board with the following additional boards Click Shield -> MicroSD Click -> The SD Card pins connect to SPI pins of STM32L152 as: MicroSD STM32L152RE CD♯ PA0 (Pin 14) <-- I/O can be used for Card Detect CS♯ PB6 (Pin 58) <-- I/O used as Chip Select SCK PA5 (Pin 21) SPI1_SCK MISO PA6 (Pin 22) SPI1_MISO SDI PA7 (Pin 23) SPI1_MOSI I'm also using CubeMX to generate the initial code (SPI with FatFS). 1) May I know how to configure FatFS functions to use the SPI pins initialized earlier with the generated HAL_SPI_Init() ? 2) Do I need to include the HAL_SD library? If yes, how to include this in CubeMX? Thanks, Andy ** Sorry for simple questions. I'm new to this ** #microsd2016-02-29 08:53 AM
I've used SPI based MicroSD cards (SD, SDHC, SDXC) on a Nucleo-152RE, but in a somewhat less circuitous fashion. Using a GPS Shield with a MicroSD socket, and the SPL.
If you built your framework for the SPI + FATFS, I would suspect all the pieces are already there. The FatFs layer expects an abstraction to the card via it's ''diskio.c'' or equivalent file, and that should interface with the block level access routines for either the SPI or SDIO routines in another supporting file. For SPI access you won't need the SDIO ones, but as far as I'm aware ST's SPI implementation only supports older SD cards of 2GB and below, not the SDHC ones everyone in the world is actually using at this point.