cancel
Showing results for 
Search instead for 
Did you mean: 

''SD_TX_UNDERRUN'' error in BSP_SD_WriteBlocks()

Andrew1
Associate II
5 REPLIES 5
markb
Associate II
Posted on November 03, 2015 at 09:19

Hi,

I have posted this before but here it is again... I am using an STM32F405 and no RTOS but it should still be relevant.

You have to set up the SD to use DMA, I attach an .ioc file that will show you what is required.

You also have to edit sd_diskio.c to change the calls to BSP_SD_WriteBlocks() to

BSP_SD_WriteBlocks_DMA() and similar for the read functions.

Cheers,

Mark

________________

Attachments :

pb4.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htnn&d=%2Fa%2F0X0000000aX7%2F8zrANLPOTRhY5yKroDgaqFk6hCcur5dyjGR0w72e1qI&asPdf=false
ingwmeier
Senior
Posted on November 03, 2015 at 14:55

Thank you for the IOC file. Don't you have to set Maximum Output Speed of SDIO Pins

to Fast? Now Low is selected.

Regards

Werner

markb
Associate II
Posted on November 03, 2015 at 16:04

Hi Werner,

That's an interesting question. I am using an 8MHz SD clock and if I view the waveform on the scope the rising and falling edges are

curved rather than straight up and down. But there's no ringing. The scope says the rise and fall times are around 31 nS. If I change

the output speed to medium which (according to the datasheet) raises the max output frequency from 2 to 25 MHz, the clock

waveform looks almost identical with just a very small reduction in rise/fall times to around 29 nS. What is more, it works quite reliably.

I have a 12pF cap to ground on that clock signal to stop some ringing that was occuring.

One last thing, the datasheet for the STM32405 that I have, specifies the max GPIO freqs with 50pF of loading and doesn't actually

say what the max freqs are for lower loadings.

Cheers,

Mark

Andrew1
Associate II
Posted on November 05, 2015 at 15:00

Hi,

I still unable to get DMA working.

I've attached *.ioc project, generated sources, and test function.

Execution stops in HAL_SD_CheckReadOperation() waiting for DMA transfer complete.

Can anyone help me?

________________

Attachments :

sd_card3.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htnx&d=%2Fa%2F0X0000000aX8%2FDZKD9j3DrQC_NNB2tTSXdJlWADW_Sh6rcFabr51NmkA&asPdf=false

sd_card3.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtYF&d=%2Fa%2F0X0000000aRf%2FDmoGnLpDOwrB2sJJzNbNIH2_O4m1PRfZKGR6Lz0g4Zs&asPdf=false
benben91
Associate
Posted on December 03, 2015 at 20:30

Andrew,

Double check that the interrupt priority for the SDIO interrupt is logically higher (numerically lower in these ST chips) than the priorities for the DMA RX/TX interrupts.