Difference between revisions of "STM32 bit bang PWM"

From Stm32World Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
On many of the cheaper [[STM32]] [[:Category:Development_Board|Development Boards]] there is a [[LED]] attached to PC13.  This is perfectly ok if you want to switch it on or off, but PC13 is not attached to any of the timer channels, so it will not be possible to control the brightness using [[PWM]].
 
On many of the cheaper [[STM32]] [[:Category:Development_Board|Development Boards]] there is a [[LED]] attached to PC13.  This is perfectly ok if you want to switch it on or off, but PC13 is not attached to any of the timer channels, so it will not be possible to control the brightness using [[PWM]].
  
Fortunately, while not ideal, it ''is'' possible.
+
Fortunately, while not ideal, it ''is'' possible to bitbang the [[PWM]] in a manner which doesn't require too much computation. Contrary to [[PWM]] using a [[Timer]] channel, it does require some computation in the [[MCU]]
  
 
== Miscellaneous Links ==
 
== Miscellaneous Links ==

Revision as of 02:26, 6 May 2024

On many of the cheaper STM32 Development Boards there is a LED attached to PC13. This is perfectly ok if you want to switch it on or off, but PC13 is not attached to any of the timer channels, so it will not be possible to control the brightness using PWM.

Fortunately, while not ideal, it is possible to bitbang the PWM in a manner which doesn't require too much computation. Contrary to PWM using a Timer channel, it does require some computation in the MCU

Miscellaneous Links