cancel
Showing results for 
Search instead for 
Did you mean: 

Use Timer DMA burst to update *another* timer

JNiel.1
Associate II

Hi all!

I have a use case that seems like it's not supported. I have one timer (TIM3) running PWM with multiple channels, I would like to use a DMA burst to update the duty cycles of all channels and I have successfully done this by triggering on the TIM3 update event.

But, in the system there is another timer (TIM5) and I would very much like to synchronize the TIM3 duty cycle update along with a couple of other things on the TIM5 update event.

From reading reference manuals and the AN4776 "General-purpose timer cookbook" one can almost believe this would work but my trials are unsuccessful, I had hoped I could trigger the DMA on TIM5 update event and set DMA Burst Length (DBL in DCR register) in TIM5 to achieve this but I get no burst. TIM3 is behaving correctly though, all outputs are changed eventually but only one at a time at every TIM5 update

So can burst only be used by a timer to update itself?

(I am aware I can set RCR on TIM3 but that means I have to do synchronization every time I change the interval of TIM5)

Device is an STM32L4R9

3 REPLIES 3
JNiel.1
Associate II

I figured out an alternative solution:

Instead of trying to use burst on update event I can configure the "main" timer as master timer with its update event as TRGO, the pwm timer is slave timer and generates DMA burst on trig event. It would have been easier with the update event but close enough, problem solved

It took me much more time to answer than you've find your solution, so I just removed it to avoid further confusion.

Glad you got it working.

JW

My solution isn't good enough for this project though as I'm running out of timers that can be used for this... I would need the main timer to trigger the DMA burst but will have to add other features using the timers that are capable of being master, if there was a path to get this working without master/slave and relying only on the DMA trigger it would be helpful!