cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-152RE + Arduino Click Shield to MikroBus + MicroSD Click

andrew239955_stm1
Associate
Posted on February 29, 2016 at 06:59

Hi All,

I'm using Nucleo 152RE board with the following additional boards

Click Shield ->

http://www.mikroe.com/click/arduino-uno-shield/

MicroSD Click ->

http://www.mikroe.com/click/microsd/

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 **

#microsd
1 REPLY 1
Posted on February 29, 2016 at 17:53

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.

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