2025-11-10 8:28 AM
Hello,
when enabling DMA for a Timer channel in PWM mode, the transfer direction is set to Memory to Peripheral.
This s very questionnable.
Is it a deliberate choice or a bug?
It does not make sense to select Peripheral to Memory for the DMA channel as it is used to wrtie to the device.
I fell in the trap several time, wasting time to look up for an issue in my code...
Very boring.
STM32 device is STM32F429, CubeIDE version 1.19.0 (same problem with all versions since I started using CubeIDE a couple of years before.)
2025-11-10 9:34 AM - edited 2025-11-10 9:35 AM
This allows the PWM duty cycle to be changed. That seems the only sensible option here. Intentional and not a bug.
Why should it go from peripheral to memory? Are you perhaps looking for input capture mode instead?
2025-11-10 10:17 AM
You’re right—this can be confusing at first. For PWM output, DMA is intentionally set as Memory → Peripheral because you’re writing the duty cycle values from memory to the timer. Peripheral → Memory would be used for reading input data, like in Input Capture mode. Understanding the direction helps avoid wasted debugging time.
2025-11-11 12:35 AM
Hello,
let me make things clear,
I know that the right direction is Memory to Peripheral.
My questionning was about CubeIDe which set the direction as Peripheral to Memory, requiring a change to make things work properly.