On a NUCLEO-64-F030R8 STM32 Cube I am using Tim3 in toggle mode with variable ARR to output variable pulse widths on PA6. How can I know whether the Timer Int is happening on a digital HI or LOW edge?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-30 1:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-30 3:12 PM
It depends which timer interrupt you're referring to and how your pulse is configured. They happen at different times and an inverted pulse will give opposite results.
As a quick check, you could simple read the value of the pin in the interrupt.
Oh, in toggle mode you just need to read the value of the pin. GPIO->ODR register.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-30 5:00 PM
> GPIO->ODR register
Why not IDR?
Also, why toggle mode, how is it better than PWM?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-30 6:07 PM
I've used toggle mode quite a bit when I need to synchronize events between timers. Although it doesn't seem optimal for generating variable PWMs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-08 12:51 PM
Thanks for the feedback, as this is a new environment for me. I will look into the IDR mode, though I don't remember seeing it. Yes, I see where I can read the pin status, and simply exit the interrupt on one phase and process a new ARR value on the other. I just double the speed of the timer. It seems the low overhead for interrupt service in the ARM is really beneficial in that regard.
