Page 1 of 1

STM32F429/439 SD+DMA big trouble

Posted: Wed Apr 15, 2015 5:06 pm
by provincialex
First of all, I use STMcube HAL, but the STM's support is useless, so excuse me for bugging you guys here.

When write to SD card, SDIO controller ALWAYS stops exactly at the last 16 bytes of data (DCOUNT = 0x10), TXUNDERR flag raises in STA register.
At the same time, the corresponding DMA stops with NDTR = 4 (4 words = 16 bytes).

I've found that the cause of this stop is SDIO: when I charge DMA for say 1024 bytes and SDIO for 1024+16=1040 bytes, DMA finishes OK with all 1024 bytes transferred, whereas SDIO stucks at the last 16 bytes as before, thus sending 1024 bytes to the SD card.

I've even managed to get all this work normally with SD card (I write up to 100 Mbps continuously), but the problem still has to be understood. DMA-read does not work also with similar behavior.
Hardware: WaveShare board with STM32F429, 2 exemplars of my own board with STM32F439.

At least, I would be glad to hear something like "bullshit, everything works OK"...

Re: STM32F429/439 SD+DMA big trouble

Posted: Wed Apr 15, 2015 5:58 pm
by Giovanni
Hi,

The SDIO is a bit peculiar, we had problem too. You should look at the current implementation of the SDC driver and see how the DMA is used, I don't remember having to add 4 extra words.

Giovanni

Re: STM32F429/439 SD+DMA big trouble

Posted: Thu Apr 16, 2015 4:58 pm
by provincialex
Thanks Giovanni!

Digging chibios surprisingly gave me the only set of DMA and FIFO settings that works.

Re: STM32F429/439 SD+DMA big trouble

Posted: Thu Apr 16, 2015 5:46 pm
by Giovanni
Barthess worked a lot on that, he mentioned issues with DMA settings back then.

Giovanni