cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a specific PWM signal

Stefan Stark
Associate III

Hi ST community,

For a project I would like to generate two interdependent PWM signals (Sa and Sw in the attached figure) with the STM32G0. The constraints/tasks are as follows:

  • tSw,off = constant for ~100ns
  • tSw,on = in a time range from ~100ns to 20us and is limited cycle by cycle by an active break (peak control application).
  • tSa,off = set every 300us in a time range from ~100ns to 30us.
  • tSa,on = is set every 300us in a time range from ~100ns to 5us.

The times for tSa,off and tSa,on are thus adjusted every 300us. The time tSw,on is limited cycle by cycle by the active break.

Following limitations I had to mention:

  • I'm allowed to interrupt the software all 300us for a few us (so polling could be difficult).
  • Focus on the STM32G0 microcontroller series.
  • The on time tSw,on is limited cycle by cycle with an comparator.

I will not present my previous approaches now, in order not to influence your ideas.

I look forward to your feedback.
Br, Stefan

20 REPLIES 20
But if I understand you correctly, your idea was to run the Sa with the combined PWM function and the Sw with the PWM2 mode. I have tried this and it works as well. Why do you prefer this approach? Because with this approach one register less has to be written?

Yes.

JW