cancel
Showing results for 
Search instead for 
Did you mean: 

Custom PWM Triggering in Center Aligned Mode

abuchholz91
Associate II
Posted on September 06, 2014 at 07:57

Hi, I am new to ST.

I have a STM32F405 MCU.

Can someone please advise on the best way to customise PWM Output. I need to create a wave that is 180 degrees out of phase both with the same Frequency, Duty Cycle adjustable and also be adjustable for any necessary Frequency Changes.

0690X000006059vQAA.png

I have looked at Dead Time insertion and got about a 2 degree change, unfortunately this is not enough.

Other options I am looking at are Encoder Mode, I cant get any output in this more I am guessing because its looking for an external Trigger.

I am also looking at Center Aligned mode.

I am wanting to use Timer 8 Channel 1 and Channel 2 to be able to achieve this, is this possible using the same Timer?

I am unfortunately a little lost and would appreciate some advice.

Thank You.

  Chris

P.S: Pin Inverting does not achieve what I need as the wave is not 180 degrees out of phase if Duty is adjusted.

#phase-shifted-frequency-between
1 REPLY 1
abuchholz91
Associate II
Posted on September 06, 2014 at 11:04

Ok, I see it. Timer Synchronisation. My goal can be achieved by Syncronising two separate Timers, one Master, one Slave and setting them via the Manual:

See Pages: P. 606, P. 554 for info…

// Configure Master Timer - Mine is Timer 8 Channel 1 
CR2.SetBits(1 << 5); // <--- Bits 6:4 MMS[2:0]: Master mode selection 
// Congifure Slave - My case is Timer 1 Channel 1 
SMCR.SetBits(7 << 1); // <--- Bits 2:0 SMS: Slave mode selection 
SMCR.ClearBits(7 << 4); // <--- Bits 6:4 TS: Trigger selection 

 Yes I am using the Microframework...

 All the best
 Chris