STM32F429 and sdcard

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
vahid4134
Posts: 4
Joined: Tue Dec 01, 2015 2:03 pm

STM32F429 and sdcard

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F429 and sdcard

Post 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
vahid4134
Posts: 4
Joined: Tue Dec 01, 2015 2:03 pm

Re: STM32F429 and sdcard

Post 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)
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F429 and sdcard

Post 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
vahid4134
Posts: 4
Joined: Tue Dec 01, 2015 2:03 pm

Re: STM32F429 and sdcard

Post 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

Attachments
RT-STM32F429-DISCOVERY.zip
(10.94 KiB) Downloaded 228 times
vahid4134
Posts: 4
Joined: Tue Dec 01, 2015 2:03 pm

Re: STM32F429 and sdcard

Post by vahid4134 »

I changed PIN setup in board.h and finally work.
Thank you
Post Reply