2025-05-26 9:16 AM - last edited on 2025-05-27 1:36 AM by Andrew Neil
I've been working on a custom STM32U595 board which uses ADF1 to read from a digital MEMS microphone and store audio samples in a SRAM4 buffer using the LPDMA. A circular buffer is implemented where LPDMA1 reads samples from ADF1 and generates interrupts when the buffer is half full and full. I then wanted to write the SRAM4 buffer to a SD Card through the SDMMC1 interface. Below is a simple block diagram of what I'm trying to accomplish:
I can get everything working really well when using the GPDMA1 and a ram buffer located elsewhere then SRAM4. But I'd like to reduce overall power by utilizing the LPDMA and stop mode 2 while collecting audio samples from the microphone. Then wake up and write the samples to the SD Card using SDMMC and the associated IDMA.
However, I was disappointed to discover that LPDMA only works with SRAM4, and the SDMMC peripheral only works with RAM other then SRAM4 (page 133 of user guide). This limitation seemingly makes writing data buffered in SRAM4 to a SD card impractical because the SDMMC DMA operation no longer works
Does anyone know if there is a way around this problem? Or is what I'm trying to do unrealistic given the limitations of the peripherals?
Any advice would be greatly appreciated
2025-05-26 10:42 AM
If cpu anyway running for sdmmc writing, why not without Idma ? SDcard needs same time to write...
and cpu moves the data to the sdmmc.
2025-05-26 2:56 PM
Thanks for your suggestion, Ascha. I had considered this as well, but I can actually move data quite quickly to the SD card using the IDMA controller associated with SDMMC peripheral. The faster the data buffer is written to disk, the less time the processor spends out of stop mode. I'm afraid I would loose any power efficiency gains from the LPDMA in Stop 2 versus just using the GPDMA and sleep mode. Although, admittedly this isn't something I have tried yet, so some A/B testing would be useful
2025-05-27 12:04 AM
>but I can actually move data quite quickly to the SD card using the IDMA controller associated with SDMMC
What speed is "quickly" ? Did you check it, compare to transfer without DMA ?
SDMMC can transfer max. : in 4bit mode -> 200 Mbit, = 25MB/s ;
+ this is, what i got without IDMA .
+ the delay of the command time, 0.5...2ms , but this is same with or without dma on every card access.