cancel
Showing results for 
Search instead for 
Did you mean: 

How to use two or more timers independently from each other using the stm32h7?

ACand.3
Associate II

Hello everyone,

I am still relatively new to STM32 especially the stm32H7. ( I am using the stm32h755)

I have one timer with DMA that outputs a PWM signal, I am controlling an ARGB strip.

For this I have Timer4 connected with Channel 1 and it does work!

But If I add another Timer, say Timer3 with Channel 1, I do not get anything from timer3. No output, just a flat line on my oscilloscope.

I have both Timers setup as internal Clock. In my RCC, I do have HSE disabled. and my timers(apb1 and apb2) are running at 150mhz.

I am just using CM7 for now.

Prescalers for timer 4 is 0, with up counting and have counter period at 250-1. The same setting for timer3, where I have counter period at 1000-1( for testing, just making sure I get an output). Everything is set to default.

Things I've tried, I tried running Timer3 by turning on by using HAL_TIM_PWM_START() and of course I tried with DMA so I used HAL_TIM_PWM_Start_DMA().

anything helps!

4 REPLIES 4

These TIM should work concurrently.

Too fast/frequent update interrupts will bog down the processor (ie 100's KHz)

For pins double check the AF setting to ensure the right TIM is associated with the pins.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LCE
Principal

Have you tried to copy the TIM4 settings?

Anyway, check that you are using another free DMA channel than TIM4, check the GPIO (there might be an alternate function used by another peripheral).

ACand.3
Associate II

Thanks for the help, after redoing the project and setting the proper DMA streams between timers, I am able to get two PWM outputs via DMA.

Now I still do not understand why PWM without DMA does not work with timer3. If I remove the DMA settings on timer3 PWM channel 1, shouldn't I be able to see PWM signal if I call HAL_TIM_PWM_START() ?

I don't know what HAL_TIM_PWM_START() is doing, so take a look into that macro / function.

I cannot really imagine why DMA should not be used...