2026-01-03 5:43 PM
Hi all,
I am using the HRTIM unit of the STM32G474 to generate a PWM on channel A that depends on capture values of channel B. The channel B capture 1 value defines the channel A compare value and channel B capture 2 the channel A compare 2. The capture 1 event occurs during the first half of the switching period and capture 2 during the second half.
Additional, the compare values need to be loaded with a default value if no capture event occurs.
I am using two interrupts to copy the data from the capture to the compare at the moment but I would like to use the DMA for this.
My idea was to use Peripheral to Peripheral transfer but I have only Memory to Peripheral and Peripheral to Memory in CubeMX. Is this a hardware limitation of the STM32G474 or is that a CubeMX limitation? Or is there a workaround by using a memory location?
My second problem is understanding of the DMA request. Can one timer channel generate more than one DMA request (one for each capture event) and connect that to 2 DMA channels? CubeMX allows only to connect 1 DMA channel per timer channel.
My understanding at the moment would require to use DMA request triggers from 6 HRTIM channels:
2 events to copy the capture values to memory
2 slightly delayed events (triggered by the capture events) to copy from memory to capture
2 events to copy the default values from memory to the capture registers (that is overwritten if the capture event is triggered).
The controller has the 6 timer channels, but I hope there is a better solution.
Kind Regards
Thundernail