SDIO fails on waiting for transfer state?

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Lupin
Posts: 7
Joined: Fri Jan 04, 2013 10:52 pm

SDIO fails on waiting for transfer state?

Post 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? :-)
Lupin
Posts: 7
Joined: Fri Jan 04, 2013 10:52 pm

Re: SDIO fails on waiting for transfer state?

Post 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"...
Lupin
Posts: 7
Joined: Fri Jan 04, 2013 10:52 pm

Re: SDIO fails on waiting for transfer state?

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

Re: SDIO fails on waiting for transfer state?

Post 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
Post Reply