Page 1 of 1

SDIO with STM32L4 (Nucleo-64 board)

Posted: Thu Mar 17, 2016 12:35 pm
by jms23134
Hi,
First of all, let me congratulate you Giovani for your excelent work with ChibiOS RTOS.
I am developing an application with an SD card and I was using the SPI peripheral to read/write the card. But now with this new board, I was trying the SDIO interface (4 bits), but unfortunately I was unable to read or write from the card. The SD cards are 8GB class 10 and 8GB class 4.

So is there any particular option to set in this microcontroller to make this working properly?
Thanks in advance for your help.

I attached the chibios project that I was using. It is adapted from the STM32F4 discovery board. To test the code, the CHIBIOS var in makefile must be set to the proper path (I am using chibios 16.1.4).
In this particular board, I had to set the SDIO pins to their alternate functions (12, according to the datasheet)

palSetPadMode(GPIOC, 11, PAL_MODE_ALTERNATE(12));
palSetPadMode(GPIOD, 2, PAL_MODE_ALTERNATE(12));
palSetPadMode(GPIOC, 12, PAL_MODE_ALTERNATE(12));
palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(12));
palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE(12));
palSetPadMode(GPIOC, 10, PAL_MODE_ALTERNATE(12));

The shell outputs the following text after sending this command "sdc all".

ChibiOS/RT Shell
ch> sdc all
Connecting... failed
ch> sdc all
Connecting... failed
ch> sdc all
Connecting... failed
ch> sdc all
Connecting... OK

Card Info
CSD : 400E0032 5B590000 3B377F80 0A4040AE
CID : 03534453 4C303847 8029795F 7100F89C
Mode : SDV20
Capacity : 7580MB
Single block aligned read performance: failed
ch> sdc all
Connecting... failed
ch>

Re: SDIO with STM32L4 (Nucleo-64 board)

Posted: Thu Mar 17, 2016 12:54 pm
by Giovanni
Hi,

It is hard to test for me, I have not a connector to attach. You could try to step in sdcConnect() and see where it fails.

Note that a common problem are wires, this happened a lot in the past using SDIO. Another source of problems is card clock, you could try to measure it.

Giovanni

Re: SDIO with STM32L4 (Nucleo-64 board)

Posted: Sun Mar 20, 2016 7:19 pm
by rew
Yeah. Sounds very much like a "hardware problem". Think clock signals not working (e.g. a whip like effect can clock the stuff on the other end twice on each clock cycle), or corruption on the data lines.