Page 1 of 1

STM32F429 and sdcard

Posted: Tue Dec 01, 2015 2:07 pm
by vahid4134
I used testhal to test sdcard(SDIO). But fail on connecting.

I try to change Pal Model to

Code: Select all

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


and then waiting on connection.
I'm tested my device with stm32fcube and work good.

Re: STM32F429 and sdcard

Posted: Tue Dec 01, 2015 2:23 pm
by Giovanni
That demo is done to run on a F407. There are differences in the board files and configuration files.

You don't provide sufficient info for a suggestion.

Giovanni

Re: STM32F429 and sdcard

Posted: Tue Dec 01, 2015 2:55 pm
by vahid4134
I just use main.c functions. I use stm32f429 configuration file.
I checked with gdb and my program waiting on

Code: Select all

//ChibiOS/os/hal/ports/STM32/LLD/SDIOv1/sdc_lld.c:574
while (((sta = sdcp->sdio->STA) & (SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT |
                                     SDIO_STA_CCRCFAIL)) == 0)

Re: STM32F429 and sdcard

Posted: Tue Dec 01, 2015 3:38 pm
by Giovanni
There are two possible causes:

1) Clocks to SDIO.
2) Pins setup (or wrong board file).

Please verify settings in one of those board files that have SDIO.

Giovanni

Re: STM32F429 and sdcard

Posted: Wed Dec 02, 2015 5:33 pm
by vahid4134
Thank you for response and sorry Im begginer in Chibios.
My hardware with stm32fcube work good.
I attach my code. Please check my code
I dont know why waiting in connection.

this is my bt of gdb

Code: Select all

#0  0x0800185e in sdc_lld_send_cmd_short_crc (sdcp=sdcp@entry=0x20000a04 <SDCD1>, cmd=cmd@entry=16 '\020', arg=arg@entry=512, resp=0x20000798, resp@entry=0x200007b0)
    at ../../../os/hal/ports/STM32/LLD/SDIOv1/sdc_lld.c:574
#1  0x08000bd8 in sdcConnect (sdcp=sdcp@entry=0x20000a04 <SDCD1>) at ../../../os/hal/src/sdc.c:711
#2  0x080022d8 in main () at main.c:89


Re: STM32F429 and sdcard

Posted: Thu Dec 03, 2015 8:16 am
by vahid4134
I changed PIN setup in board.h and finally work.
Thank you