2021-11-09 12:01 PM
I am finding the documentation to be very difficult to parse through and had a few questions:
2021-11-09 12:16 PM
Which STM32?
There are two PWM modes, differing in polarity. Read description of TIMx_CCMR1.OC1M in TIM chapter of RM.
Moreover, polarity of PWM can be switched also by setting TIMx_CCER.CCxP. Again, read description of that bit in RM.
Examples are in the directory where Cube (the "library") is installed; there's a "Projects" subdirectory there, and there are examples organized by individual development board. Cube (the "library") is available also on github, for example for examples for the classic 'F4 Disco board you would go to https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F4-Discovery/Examples
JW
2021-11-09 01:02 PM
Some things are hidden, but I think channel polarity is pretty clearly displayed in the interface. Even if you don't know what "high" means exactly, it should be clear the "low" would flip it.
2021-11-09 02:33 PM
Yes I was able to 'guess ' HIGH or LOW but it seems that by changing to PWM1 or PWM2 you get the same results....Not sure why all the bells and whistles
As far as my directory I have no "library" where STM32CubeIDE resides:
2021-11-09 02:58 PM
> Not sure why all the bells and whistles
The timers are quite complicated. The reference manual, as JW suggests, will let you see the internals if that is what you're interested in.
The Cube repository is stored within C:\Users\USERNAME\STM32Cube\Repository by default.
Timer capabilities are different on different families of chips. It helps if you include your STM32 chip number in your question so the answers can be more relevant.
2021-11-09 05:19 PM
PMW1 vs PWM2 relates to the phase and whether the signal starts High or Low at zero degrees, and switches at the phase comparison point of the cycle
Tends to be of more consequence when you have multiple channels, and you need duty/phase relationships between them.
The TIM in the STM32 are both frustratingly complex and poorly executed.