Skip to main content
nicolas
Senior II
June 27, 2025
Solved

STM32U5 + PWM + DMA

  • June 27, 2025
  • 1 reply
  • 1127 views

I'm able to generate a simple PWM signal but I wasn't able to generate arbitrary waveform with DMA (HAL_TIM_DMABurst_MultiWriteStart).

How should be configured the DMA ?

Is there an example that use PWM with DMA on STM32U5 ?

Best answer by nicolas

Looks like RCR and CCR1 are preloaded and my config was using an ARR not preloaded.

With a preloaded ARR, my ARR values doesn't need to be shifted.

htim.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;

 

1 reply

Technical Moderator
June 27, 2025

Hello @nicolas 

Please refer to the application note AN4776 to generate arbitrary waveform with DMA.

Also see the article below:

Custom Signal generation using PWM and DMA - STMicroelectronics Community

"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.Saket_Om"
nicolas
nicolasAuthor
Senior II
June 27, 2025

Thanks for the reply. I have already looked at this document but it's old (2019) so it doesn't account of the new GPDMA found in STM32U5. It also directly access register instead of using the HAL (does ST recommend to not use HAL ?).

The article also don't use GPDMA.

nicolas
nicolasAuthor
Senior II
June 27, 2025

I'm now able to use HAL_TIM_PWM_Start_DMA() with GPDMA configured with SrcDataWidth = DMA_SRC_DATAWIDTH_BYTE;

But it's only works with byte, so it's very limitative for a 16 bits timer.