STM32 bit bang PWM

From Stm32World Wiki
Revision as of 04:20, 6 May 2024 by Lth (talk | contribs) (→‎Result)
Jump to navigation Jump to search

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.

Bit-banding

Result

Miscellaneous Links