STM32F030R8 PWM to LED (PA5)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 09:44 AM
Hi all,
I am looking into generating a PWM signal using the Timers and route it to the PA5 pin to blink the LED, but PA5 does not have a TIM routed to it. I thought about just having a timer work in my code and toggle the pin every second by checking the counter register, but is there any better / cleaner way to use PWM with the LED pin on this model?
Thank you!
Solved! Go to Solution.
- Labels:
-
STM32F0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 09:53 AM
Welcome @tolgaust, to the community!
I you don't want to connect an external LED to a GPIO with a timer, you can switch PA5 to analogue or digital input (should be the uninitialised default value) and connect the timer of another GPIO to it by wire. As PA5 is then high-impedance, the timer can apply any level to it (which must of course be within the permissible range).
Good luck!
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 09:53 AM
Welcome @tolgaust, to the community!
I you don't want to connect an external LED to a GPIO with a timer, you can switch PA5 to analogue or digital input (should be the uninitialised default value) and connect the timer of another GPIO to it by wire. As PA5 is then high-impedance, the timer can apply any level to it (which must of course be within the permissible range).
Good luck!
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 10:44 AM
For low speeds, up to 1 kHz or so, using an interrupt is straightforward and will work well.
For extreme speeds, say tens or hundreds of kHz, you could use DMA. But the code complexity required doesn't warrant using it for low speeds.
![](/skins/images/7538BDC9E95ED3EEB274102A302A21E6/responsive_peak/images/icon_anonymous_message.png)