Skip to main content
Explorer
December 18, 2024
Question

DMA -> MDMA chaining stm32h7

  • December 18, 2024
  • 1 reply
  • 651 views

Hello everyone,

Context

I am having troubles chaining the DMA1 and MDMA of the stm32h755, more precisely, I am looking for the following data flow when reading data from SPI, the SPI being regularly triggered  : 

SPI -> DMA1 Channel3 -> SRAM -> MDMA Channel 3 -> DTCM.

I transfer 4 halfwords between my SPI and my SRAM. I also want to move 4 halfwords between my SRAM and my DTCM thanks to the MDMA.

The connection between the DMA1 Channel 3 and the MDMA Channel 3 being the DMA1 Channel Transfer complete request.

Problem

I have no problem moving data from SPI to SRAM using DMA1 Channel 3 every time I read something on my SPI.
However my MDMA is only working on the first transfer, then he's not transfering no more, even if my DMA1 Channel 3 transfer complete has triggered. I could not figure why..

Code : 

 

hmdma_mdma_channel3_dma1_stream3_tc_0.Instance = MDMA_Channel3;
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.Request = MDMA_REQUEST_DMA1_Stream3_TC; // Requête déclenchée par DMA1_Stream3_TC
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.TransferTriggerMode = MDMA_BUFFER_TRANSFER;
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.Priority = MDMA_PRIORITY_LOW;
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.Endianness = MDMA_LITTLE_ENDIANNESS_PRESERVE;

hmdma_mdma_channel3_dma1_stream3_tc_0.Init.SourceInc = MDMA_SRC_INC_HALFWORD; // Incrémentation de la source
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.DestinationInc = MDMA_DEST_INC_HALFWORD; // Incrémentation de la destination

hmdma_mdma_channel3_dma1_stream3_tc_0.Init.SourceDataSize = MDMA_SRC_DATASIZE_HALFWORD;
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.DestDataSize = MDMA_DEST_DATASIZE_HALFWORD;

hmdma_mdma_channel3_dma1_stream3_tc_0.Init.BufferTransferLength = 4; // Transfert de 4 HALFWORDS

hmdma_mdma_channel3_dma1_stream3_tc_0.Init.SourceBurst = MDMA_SOURCE_BURST_4BEATS; // Burst de 4 HALFWORDS
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.DestBurst = MDMA_DEST_BURST_4BEATS; // Burst de 4 HALFWORDS

hmdma_mdma_channel3_dma1_stream3_tc_0.Init.SourceBlockAddressOffset = 0;
hmdma_mdma_channel3_dma1_stream3_tc_0.Init.DestBlockAddressOffset = 0;

 

And :

 

HAL_MDMA_Start_IT(&hmdma_mdma_channel3_dma1_stream3_tc_0,
 (uint32_t)adc_burst_sram, 
 (uint32_t)adc_burst_dtcm,
 sizeof(adc_burst_sram), 
 1)

 

If someone has an idea :)

Regards,

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    December 20, 2024

    Hello @MonsieurShann 

    Please refer to the example Projects/NUCLEO-H7A3ZI-Q/Examples/MDMA/MDMA_LinkedList to set your MDMA transfer.