It is also possible with the current core you use (libmaple) if you know which register and which bit to set.
Here a short example: https://web.archive.org/web/20190317100 ... php?t=1153
Blue Pill counting number of pulses using timers
-
- Posts: 502
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
-
- Posts: 502
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Re: Blue Pill counting number of pulses using timers
I knew I have posted a similar example already somewhere.
Now i have found it: https://web.archive.org/web/20190316154 ... =18&t=3804
Now i have found it: https://web.archive.org/web/20190316154 ... =18&t=3804
Last edited by stevestrong on Wed Mar 18, 2020 2:00 pm, edited 1 time in total.
Re: Blue Pill counting number of pulses using timers
Looking at your code with my ignorant eyes I must say that it looks to be the solution to my troubles. I do seestevestrong wrote: ↑Wed Mar 18, 2020 1:38 pm I new I have posted a similar example already somewhere.
Now i have found it: https://web.archive.org/web/20190316154 ... =18&t=3804
Code: Select all
timer_init(TIMER2);
Thank you very, very much.
-
- Posts: 502
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Re: Blue Pill counting number of pulses using timers
It is the Libmaple (aka Roger's) core: https://github.com/rogerclarkmelbourne/Arduino_STM32
I think it is identical with the one installed from dan.drown.org.
[s]There you have TimerX.init(), too.[/s] - this applies to F4 family only.
I think it is identical with the one installed from dan.drown.org.
[s]There you have TimerX.init(), too.[/s] - this applies to F4 family only.
Re: Blue Pill counting number of pulses using timers
Hurray!stevestrong wrote: ↑Wed Mar 18, 2020 1:38 pm I knew I have posted a similar example already somewhere.
Now i have found it: https://web.archive.org/web/20190316154 ... =18&t=3804
It works with no modifications on Blue Pill!
When connected with a 9MHz PWM source it counts 9012 - 9013 pulses.
When connected to a digital audio FSCLK of 44100 Hz it counts 44-45, and counts for 96k and 192k is also off by just 1.
Perfect for my needs!
Thank you SO MUCH, you have (temporarily) saved me from going to the HAL jungle.
P.S. When you come to Croatia for u summer holidays, the dinner and drinks are on me. Give me a shout!
-
- Posts: 502
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact: