Help with SDIO/FATFS on STM32F4 Discovery

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
gentijo
Posts: 11
Joined: Sat Jul 21, 2012 5:00 am

Help with SDIO/FATFS on STM32F4 Discovery

Post by gentijo »

I have a STM32F4 Discovery board that is attached to one of these expansion boards you can get on EBay, the Open407V-D, and my code is based off of the ARMCM4-STM32F407-LWIP-FATFS-USB demo project.

On startup I init the SDC stack and register my events with
sdcStart(&SDCD1, &sdccfg);
tmr_init(&SDCD1);
chEvtRegister(&inserted_event, &el0, 0);
chEvtRegister(&removed_event, &el1, 1);

The initial inserted_event occurs and it calls the InsertHandler...

but in sdcConnect(&SDCD1) it fails on the call to sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_APP_CMD, 0, resp)

resp = Hex:0x20005fa4, every call to send_cmd returns this response.

I have tried this with older 2GB cards and a newer 8GB SDHC card, neither work..
I am fairly sure I am missing something in my hal / mcu config, but nothing makes sense.

Any pointers on how to debug this ??

In the sdc_lld, I don't see any calls to configure the alternate functions for the SDIO pins, is this configured elsewhere ?

Thank You
John Gentilin


Other Info.
The SDIO expansion connector is directly connected to the SDIO pins on the processor.

I also have a SSD1289 Display which is working fine..

The version of fatfs 0.9-patched.

HAL settings
#define HAL_USE_SDC TRUE
Not sure if this needed to be enabled -> #define HAL_USE_EXT TRUE


ChibiOS Info (I am using current trunk as of a few days ago)
Kernel: 2.5.1unstable
Compiler: GCC 4.6.2
Architecture: ARMv7-ME
Core Variant: Cortex-M4
Port Info: Advanced kernel mode
Platform: STM32F4xx High Performance
Board: STMicroelectronics STM32F4-Discovery
Build time: Nov 25 2012 - 01:42:00
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Help with SDIO/FATFS on STM32F4 Discovery

Post by Giovanni »

Hi,

Probably it is a problem with pins setup, you should verify your board.h, note that the default board.h for the F4 discovery is not setup for SD.

Giovanni
gentijo
Posts: 11
Joined: Sat Jul 21, 2012 5:00 am

Re: Help with SDIO/FATFS on STM32F4 Discovery

Post by gentijo »

Grazie Giovanni, that was the issue..
Post Reply