MDMA & internal FLASH R/W on STM32H7

1.8k views Asked by At

Good morning,

We're using an STM32H7 to acquire simoultaneously 3 ADC channels 16-bit @ 5MSPS, and we store data in an external eMMC. Everything worth seamlessly as follow : 3 slave-SPI with 3 DMA to internal flip/flop buffers ; MDMA to interleave data to 2 flip flop eMMC buffers ; IDMA of SDMMC peripheral to eMMC. We have some unexpected wait-times introduced by the eMMC that requires to buffer more data internally than expected, and, as we do not have enough internal RAM to buffer enough during eMMC waits (and cannot add external RAM on FMC, or nvSRAM on Quad-SPI, ... due to integration constraints), we looked at using MDMA with internal FLASH memory to buffer data temporarily. Is this such a bad idea ? FLASH on STM32H7 is splitted in 2 banks, the first one can be used for program memory (so no conflict and no processor halt during DMA access), and there is 2 AXI controllers, MDMA is also an AXI peripheral...Maybe excessive slowness ? Has any of you ever tried this ?

As we read the reference manual (chapter 13 : MDMA controller (MDMA)) :

The master direct memory access (MDMA) is used in order to provide high-speed data transfer between memory and memory or between peripherals and memory. Data can be quickly moved by the MDMA without any CPU action. This keeps the CPU resources free for other operations.

But MDMA may only be able to move data from AXI to AHB or AHB to AXI, not AXI to AXI ?

Best regards, Clément

2

There are 2 answers

0
followed Monica to Codidact On BEST ANSWER

Looking at the datasheet, I don't think the internal flash would be up to the task.

H743 Flash memory programming

So, writing 266 bits (32 bytes+ECC) takes 100-200 microseconds. It's about 2.66 Mbits/s, nowhere near your incoming data rate. Then the flash sectors must be erased before reuse, which takes seconds for a 128 KByte block. On top of that, you can expect the flash starting to wear out after mere 10000 write cycles.

0
0___________ On

Save data to the SRAM, then you can actually program the FLASH. If you need to store a lots of data - external S(D)RAM will be needed.