STM32F429/439 SD+DMA big trouble

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

Moderator: RoccoMarco

Post Reply
provincialex
Posts: 5
Joined: Sat Nov 29, 2014 12:08 pm

STM32F429/439 SD+DMA big trouble

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

Re: STM32F429/439 SD+DMA big trouble

Post 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
provincialex
Posts: 5
Joined: Sat Nov 29, 2014 12:08 pm

Re: STM32F429/439 SD+DMA big trouble

Post by provincialex »

Thanks Giovanni!

Digging chibios surprisingly gave me the only set of DMA and FIFO settings that works.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F429/439 SD+DMA big trouble

Post by Giovanni »

Barthess worked a lot on that, he mentioned issues with DMA settings back then.

Giovanni
Post Reply