cancel
Showing results for 
Search instead for 
Did you mean: 

SCTimer/PWM equivalent in STM32?

DPaul.2
Associate II

I have a circumstance where two PWM outputs are required, and they must be precisely coupled together. A number of the other big guy's LPC micros included an SCTimer/PWM (that's State Configurable Timer...) which, without too much magic, allows a first PWM to create events on other physical outputs at programmable delays. That is the SCTimer can generate its own PWM output and also a second but unique PWM output at an exact interval relating to the first PWM.

Is there any similar animal in the STM32 menagerie? If there is I'm sure it's called something other than SCTimer (which might be a trademark).

Otherwise, is there any way to accomplish the same thing? That is to generate a PWM (no biggie there) but also a second PWM related to but different from the first PWM?

Thanks for any thoughts!

5 REPLIES 5

Which STM32?

Timers in STM32 can be chained - one timer outputs a trigger (TRGO, see TIMx_CR2.MMS) and other acts upon it (TRGI, see TIMx_SMCR.TS and TIMx_SMCR.SMS). Not all timers connect to all other timers.

Get a cheap Nucleo or Disco board, read the Reference Manual to STM32 of your choice, and experiment.

JW

DPaul.2
Associate II

Thanks for your comments. I'm hot into the manuals at this moment and have noted repeated references to "timer synchronization" which sounds like what I am seeking to replicate but in STM-speak rather than NXP-speak. I've got some Nucleo's and will be trying to work through the technical details.

TDK
Guru

One PWM related to another PWM could be generated from a single timer if phase/duty is the difference. Would be useful to more precisely describe the output you want. Likely there is a way, or multiple ways.

If you feel a post has answered your question, please click "Accept as Solution".
DPaul.2
Associate II

Thanks all for your responses. Yes, the info is in the reference manual but I wasn't sure what it was called in STM32-speak and was looking for help zeroing in on it (or somebody knows it CAN'T be done, knowing that upfront would be good to know). So it looks like the functions are there in the reference manual but recalling my NXP foray into this topic found that NXP has a app note on the subject. One can argue app notes are superfluous as all the info is already in the reference manual but for we less ******** (or less proud) find them helpful. The app note format invites a more verbose discussion of the topic(s) at hand - perhaps even an example or two. Regardless, I at least now I have the previous experience and expect that should smooth the way toward implementing the functionality in the STM32.

Which STM32?

> app note format

  • AN2592
  • AN4013 for overview of timers in various STM32 families
  • interconnection subchapter in RM for the... interconnections; older families' RMs don't have this but may have a dedicated appnote (e.g. 'F4)
  • AN4776 chapter 6
  • this presentation (pp16-18)

[shameless self-advertisement] I have a few register-based examples at efton.sk/STM32/ [/shameless self-advertisement]

JW

PS. Note that LPTIM, if present in your STM32, are a very different beast to TIM.