cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 DMA stops after first transfer

JKuen.2
Associate II

I tested this example from the STM32CubeH7 repository and it works fine.

When I try the DMA1 instead of the BDMA, the DMA stops after the first transfer.

I made only the following changes to use the DMA1

__HAL_RCC_DMA1_CLK_ENABLE();		// Enable the clock for DMA1
DMA_Handle.Instance = DMA1_Stream0	// Instance = DMA1_Stream0 instead of BDMA_Channel0
DMA_Handle.Init.Request = DMA_REQUEST_GENERATOR0;	// DMA request instead of BDMA request
dmamux_ReqGenParams.SignalID = HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT	//  DMAMUX1 instead of DMAMUX2

7 REPLIES 7

> the DMA stops after the first transfer

How do you know there was the first transfer, and then how do you know it stopped?

Read out and checkpost DMA, DMAMUX and LPTIM2 registers content.

JW

Check for errors and status flags.

Check memory addresses are accessible, and suitably aligned.

Dump registers for all associated peripherals.

Check cache coherency.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JKuen.2
Associate II

Sorry I did not explain that more detailed.. Yes I check the register content..

The DMA.NDTR. register decrements by one and then stand still.

But what I also forgot to mention is the fact, that I tested the EXTI0 using (HAL_DMAMUX1_REQ_GEN_EXTI0 instead of the LPTIM2-timer. Indeed together with the timer it works with both DMAs (BDMA and DMA1) but with the EXTI0 input it works only with BDMA but not with DMA1.

Testing the EXTI0 input, I connected the related input (PE0) with an GPIO-output and toggle this output by software,

while (1) {
    HAL_GPIO_WritePin(DMA_TRG_GPIO_Port, DMA_TRG_Pin, GPIO_PIN_SET);
	HAL_GPIO_WritePin(DMA_TRG_GPIO_Port, DMA_TRG_Pin, GPIO_PIN_RESET);
    HAL_Delay (200);
}

When using the DMA1 I can see the first transfer, NDTR decrements by one and LED switches on due to the DMA transfer) but on the next trigger toggle nothing happens.

I’m wondering that EXTI0 works withd BDMA but not with DMA1

Try to put delay also between the two HAL_GPIO_WritePin().

JW

I tried that already, also tested with the debugger step by step.

Dump and post DMA registers

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Which STM32 exactly?

And read/post also the DMAMUX registers content.

Looking into RM0433, I see no EXTI0 request input to either DMAMUX. I see some extit0 (and I don't know what does that mean) trigger and synchronization input to DMAMUX1 but not to DMAMUX2. So I'm confused how did you get that working with BDMA.

JW