cancel
Showing results for 
Search instead for 
Did you mean: 

External memory + SD-Card intermittent write failure

ERROR
Senior

Hi,

On the STM32N6570-DK board, I’m running an application that uses TouchGFX and FileX.

Both the TouchGFX frame buffer and FileX temporary buffers are located in external memory (XSPI1).

I’m observing intermittent write failures when SDMMC IDMA is used for direct transfers from external memory to the SD card. The issue appears as incorrect data being written — typically affecting the entire transfer block (a few kilobytes), as shown in the image below.

External memory is attributed as non-cacheable all the time. Selecting various shareability options for the ext memory introduces very strange behavior, so it's been disabled finally.

However, when the write operation is performed from internal SRAM (either via an intermediate buffer in SRAM or the FileX driver’s scratch buffer), the transfers are always successful.

ERROR_0-1761115631875.png

I’ve also found a very similar case involving the TouchGFX frame buffer and SD card buffer in external memory on the STM32F7 platform.

https://community.st.com/t5/stm32-mcus-embedded-software/sdram-sd-card-intermittent-write-failure/m-p/790629#M61979

3 REPLIES 3
AScha.3
Super User

Hi,

>intermittent write failures when SDMMC IDMA is used 

And if set SDMMC without DMA , then working fine ?

If you feel a post has answered your question, please click "Accept as Solution".

Hi @AScha.3 

I bet it works, but I did not try, beacuse it is the less acceptable approach for my multi-threaded application.

Regards.

Saket_Om
ST Employee

Hello @ERROR 

Is your external memory configured in memory-mapped mode?
Before launching the DMA transfer, you should insert a DSB() (Data Synchronization Barrier) instruction in your code to ensure that all memory accesses are completed and the memory is up to date.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om