Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 29, 2023. It is now read-only.
Discussion options

I am looking for a high-resolution STM32 timer library under Arduino and this one looks very good but my specific use case is I am looking to launch functions based on timers that are only .80ms to 23ms in the future. I will be turning GPIO pins on and off based on these "alarms". Can this library be used for this purpose? So specifically fast, one-shot events. I don't want them to repeat. I want to set it up, have it go off, and be gone. If this can be done, I can workout the setup time overhead and take that into account when I set the future timer value.

Also, what is the finest resolution for the hardware time interval supported (on an STM32F411CUE6)?

What should be the minimum software interval (as a multiplier of the hardware time interval)?

Thanks much!

You must be logged in to vote

Currently, the timer clock is set at 1MHz, meaning the resolution can be in 1uS range. So 800uS-23000uS is easily achieved, certainly depending on how your code is behaving.

Just use the Timer directly, see TimerInterruptTest example

Try testing to use these functions to stop /start the timer and verify which are OK for you to use

1. void stopTimer()
2. void restartTimer()
3. void disableTimer()
4. void detachInterrupt()

In the worst case, it's also easy to program the Timers directly using one-shot feature, which this library is not designed to use.

Read more about STM32 Timers or ask in the Arduino forum if you need further help.

Replies: 1 comment · 1 reply

Comment options

Currently, the timer clock is set at 1MHz, meaning the resolution can be in 1uS range. So 800uS-23000uS is easily achieved, certainly depending on how your code is behaving.

Just use the Timer directly, see TimerInterruptTest example

Try testing to use these functions to stop /start the timer and verify which are OK for you to use

1. void stopTimer()
2. void restartTimer()
3. void disableTimer()
4. void detachInterrupt()

In the worst case, it's also easy to program the Timers directly using one-shot feature, which this library is not designed to use.

Read more about STM32 Timers or ask in the Arduino forum if you need further help.

You must be logged in to vote
1 reply
@notahardwareguy
Comment options

Thank you so much! I am not used to "digging" into the Arduino libraries for these sorts of details, your reply should be more than enough to get me going!

I did try to reset the timer duration by changing it on the fly to 100 times the initial interval but that seemed to cause me erratic results and take a while to "kick in". Will need to review my code more to see if/where I made a mistake.

Can you execute the stopTimer from within the attached interrupt?

Thanks much!

Answer selected by notahardwareguy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.