Page 1 of 1

SDIO fails on waiting for transfer state?

Posted: Sun Jan 06, 2013 11:34 pm
by Lupin
I am currently trying to get SDIO running on STM32F4 Discovery.

I have connected the SD conector with some wires (no pull-ups or series resistors) and cut the PC10/PC12 traces to the DAC. The DAC is now connected to other pins on Port B and still works fine :-)

I am trying to use SDIO with FatFS. The sdcConnect-Function works. I have a 2GB microSD-Card that gets detected with correct capacity (SDCD1 capacity value is 3862528 blocks, cardmode is 1). With another 8GB SDHC cart the sdcConnect fails.


When FatFS tries to read the first block from SD-Card i get an error from "sdc_lld_send_cmd_short_crc" (sdc.c). Call sequence is like this:

f_getfree (ff.c) -> chk_mounted (ff.c) -> check_fs (ff.c) -> disk_read (fatfs_diskio.c) -> sdcRead (sdc.c) -> sdc_lld_read (sdc_lld.c) -> sdc_lld_read_aligned (sdc_lld.c) -> _sdc_wait_for_transfer_state (sdc.c) -> sdc_lld_send_cmd_short_crc (sdc_lld.c)

Here is the call to sdc_lld_send_cmd_short_crc:

Code: Select all

sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_SEND_STATUS,sdcp->rca, resp)

"sdcp->rca" is "3861120288"
Don't really know what the rca value represents though.

Inside the "sdc_lld_send_cmd_short_crc" function it checks for errors and then calls the "sdc_lld_collect_errors function". The STA value is 0x4 - so this means the SDIO_STA_CTIMEOUT Bit is set. The RESP1 value is 2336.

If i disable the check for Timeout then it is going to fail in "sdc_lld_wait_transaction_end" (after setting up the DMA transfer) because the SDIO_STA_DATAEND bit is not set in STA (STA value reads 0x8 at this point - this mean Data timeout).

Any chance someone understands what is going on and can clear this up? :-)

Re: SDIO fails on waiting for transfer state?

Posted: Mon Jan 07, 2013 12:42 am
by Lupin
Just tried again with a fresh setup of ChibiOS 2.5.1 and the FATFS-USB demo code (but with my specific board.h file of course).

It still doesn't work, but i think i don't get the first error in "sdc_lld_send_cmd_short_crc" any more (maybe it is just sporadic, no idea), but still the same problem with "sdc_lld_wait_transaction_end"...

Re: SDIO fails on waiting for transfer state?

Posted: Mon Jan 07, 2013 1:01 am
by Lupin
Okay... i just tried to init the SDIO in a loop. After a while it would work. Then i noticed that PD2 (SDIO CMD) is sensitive to my touch (if i touch it the SD card wont be detected).

The pin configuration in board.h is correct, but maybe PD2 has another problem? Maybe it needs an external pull-up. But i think this topic can be closed as the problem does not seem to be software related :)


EDIT: Just activated the internal Pull-Up resistor on SDIO CMD. Now i can touch any of the pins and the SDIO still works stable. Does anyone know where i can find more specifications about the electrical interface (e.g. are series resistors required/recommended? Which lines should be pulled up/down?)?

Re: SDIO fails on waiting for transfer state?

Posted: Mon Jan 07, 2013 8:47 am
by Giovanni
Hi,

You could look at the schematic of the Olimex STM32-E407, it has several pull-up-down resistors.

https://www.olimex.com/Products/ARM/ST/STM32-E407/

Giovanni