cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G050 DMA problem

ENESK
Associate II

I use STM32G050C8T6 DMA for the timer PWM. For the IDE I use STM32CubeIDE. Also in my code block have usart 2 comunication line.

Timer PWM work with DMA interrupt. DMA and DMAMUX configuration generated by CubeIDE. 

When I start the code and if I use the USART2  , UART_WaitOnFlagUntilTimeout it calls HAL_DMA_IRQHandler.

The other problem; code generates  hardfault after the __HAL_DMA_DISABLE(hdma) in HAL_DMA_Start_IT when I use Timer PWM with DMA and I use USART2 at the same time.

4 REPLIES 4
Sarra.S
ST Employee

Hello @ENESK, thank you for posting, 

Try assigning higher priority to DMA for the timer PWM DMA request over the usart2 DMA request using the DMAMUX configuration. 

Or, you can also use separate DMA channels for the PWM and usart2 to avoid any interference between DMA transfers. 

Hope that helps!

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.

ENESK
Associate II

Thank you for your answer but I already tried this and also I dont use usart2 with DMA. DMA only works with TIM1 but still usart2 line triggers DMA interrupt.

Thank you for your answer

But I already tried this and also I dont use usart2 with DMA. DMA only works with TIM1 but still usart2 line triggers DMA interrupt.

ENESK
Associate II

@Sarra.S  

Thank you for your answer

But I already tried this and also I dont use usart2 with DMA. DMA only works with TIM1 but still usart2 line triggers DMA interrupt.