khoih-prog / STM32_TimerInterrupt

This library enables you to use Interrupt from Hardware Timers on an STM32F/L/H/G/WB/MP1-based board. These STM32F/L/H/G/WB/MP1 Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's mandatory if you need to measure some data requiring better accuracy. It now supports 16 ISR-based Timers, while consuming only 1 Hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based Timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks.
MIT License
32 stars 7 forks source link

STM32 2.4MHz PWM #2

Closed nflaum closed 4 years ago

nflaum commented 4 years ago

Hello,

I'd like to implement a very simple 2.4 MHz clock divider using STM32_TimerInterrupt. I'm able to achieve this simply in STM32CubeIDE. However I want to do the same thing in Arduino because I like all the other libraries that make programming my STM32 much easier than using the CubeIDE. The input clock is 72 MHz and I use a counter period of 29 and a pulse of 15 on TIM_CH1 in PWM Generation mode. I've been looking through the documentation to figure out how to achieve this with STM32_TimerInterrupt but I am having trouble. Is it possible?

image

Thanks Noah

khoih-prog commented 4 years ago

Thanks for your interest in the library.

Currently, it's designed to support only Timer Interrupt, not the PWM-related functions, although the programming code is very similar.

It can be achieved easily by programming directly and you can search the Servo or PWM-related documentations for guidance.

If there are many more interests in this feature, I'll think about develop such a library.

Good Luck,