cancel
Showing results for 
Search instead for 
Did you mean: 

Hello! I m using uC STM32G491 and I want to use CH1 and CH2 from TIM1 for asymmetric PWM to command a H bridge. In RM says that I must use CH1 and CH3 (oc1refc and oc3refc) and nothing about CH1 and CH2. Can I use them?

OIoni.1
Associate II
 
6 REPLIES 6

In the older STM32 which have Combined/Asymmetric modes, oc1refc and oc2refc both combine oc1ref and oc2ref, thus are identical. That remark is probably from those models.

In 'G4, as a new feature, you can by setting TIMx_CCR5.GC5Cx combine oc5ref into oc1refc/oc2refc/oc3refc so you can achieve two different waveforms on oc1refc and oc2refc, but they will still share at least one channel's output (as they are ultimately combined out of 3 channels, 1, 2 and 5). This may or may not fulfill your requirements, but still using oc1refc and oc3refc provides two outputs combined out of two pairs of entirely independent channels.

JW

OIoni.1
Associate II

Thank you for response, but that doesn't help me...Another idea is to generate a pwm signal in edge aligned mode with the HIGH period set by some CCRx registers and other pwm signal to stay at the same limits. Is it possible?

I have no idea what do you want to accomplish. Draw a timing diagram. Why would CH3 not be sufficient?

JW

OIoni.1
Associate II

Sorry, that is what I should do:0693W00000BbOmSQAV.jpgThe problem is that the MOSFET gate is connected only at CH1, CH1N, CH2, CH2N. When I projected the system I didn't known that I need soft-start for H bridge.

OIoni.1
Associate II

I want to start from 0 phase shift to 180 phase shift.

OK so just leave CH1 as a plain PWM, and combine CH2's output out of oc2ref and oc5ref by setting TIMx_CCR5.GC5C2, which will cause those two PWMs to be ANDed into CH2's output. Position of one edge is then given by CCR2 and the other by CCR5, so for a pulse of constant length and changing phase against CH1, you must change both simultaneously.

This is probably better tested/learned on a Nucleo board, outputs observed using oscilloscope or LA, than on your live system. CH5 does not have an output, so to get a feeling of what you do, start with CH1 and CH2 to generate overlapping PWM, then switch one of them to the combined AND mode. After initial setup of the timer, the code can run into an infinite loop, while all the experimentation can be done directly by writing to registers in debugger.

JW