cancel
Showing results for 
Search instead for 
Did you mean: 

Phase shifted pulses using pwm

Stm325
Associate II

Hi, I have a b-l4s5i-iot01a board. I want to generate 2 different pulses with a phase difference from different output channels. I have my desired pulses using TIM15 channel 1 and 2 but I cannot delay one of them. TIM1  and TIM8 pins are not accesible on the discovery kit and I want pulses to have 10ms so I used slave trigger mode but CubeMX says for combined channels you must not use slave mode. Below are my configurations. I use TIM1 as a 10MHz trigger for TIM15.

Stm325_0-1741095067598.png

Stm325_1-1741095081790.png

 

 

6 REPLIES 6
Javier1
Principal

https://community.st.com/t5/stm32cubemx-mcus/how-to-generate-a-phase-shifted-pwm-in-asymmetric-pwm-mode/td-p/248894

What you need to dig deeper is a name: this functionality is called Asymetric mode.

 

 

Or use a mcu with HRTIM then is easy, STM32L4S5VIT6 doesnt have HRTIM

Available for consulting/freelancing , hit me up in https://github.com/javiBajoCero

First of all thank you. Maybe I did not dig enough but TIM15 doesnt seem to have asymmetric mode, other timers have it but they do not have RCR for multiple pulse creation. Should I try another pulse generation methods to use the asymmetric mode of the other timers?

Stm325_0-1741100354959.pngStm325_1-1741100371005.pngStm325_2-1741100392490.pngI tried these configurations in TIM8 CH1N and CH3N, I configured them like this, initialized TIM2(Trigger source) then Started One_Pulses of all 4 channels but there is nothing at the output. 

Stm325_3-1741100404553.png

 

If your requirements are a tad bit more complex than trivial, clicking in CubeMX is not likely to produce the desired result.

Maybe you could start with stating your exact requirements, together with a timing diagram (sketch).

JW

 

Stm325_0-1741103581857.jpeg

I basically want to generate something like this. I generated it without the phase difference using TIM15 in pwm multiple pulses mode by setting it as a slave and triggering it with a 10Hz timer. I just want to add phase difference to this. I think I used complementary channels of TIM8 because no other channel pins of TIM1 and TIM8 are available on the discovery kit board, therefore using complementary channels TIM8 CH1N and CH3N may not be working.

This appears to be trivial, but it is not, and can't think of any simple trick to pull this off using two channels of one timer with no software intervention.

I would perhaps try to output this from two different timers, triggering one from the other; and having triggered the former by the slow-running third timmer.

JW