Timer Configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-20 9:23 PM
Hi, I got a small problem while configuring timers in NUCLEO-F072RB board. I want to configure one timer for 1ms and another for 1sec, Could you please explain me how to set the prescaler and period(ARR) values of both the timers. My HCLK is 48MHz.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-20 11:34 PM
So you can use same configuration with timer for 1ms and change ARR to 9 and it's trigger every 1ms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 12:57 AM
Tried, but not getting correct 1ms trigger.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 1:16 AM
Try to adapt this example to your needs. It should work.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 1:45 AM
I guess that you have problem with interrupt priority management.
I think some interrupt was occurred and it has higher priority than 1ms but it has less effect to 1s because it has long period.
do you use SystemTick in your system?
which it also has trig every 1ms too.
please check in stm32xxx_it.c. there are trig inside that file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 11:51 PM
Why I am getting a Hardfault Handler error when using two timers together?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-21 11:56 PM
Again that 1ms is not working correctly but i tried for 100ms and 500ms it is working properly, but when i am using 2 timers together and when running the code i am getting an hardfault error handler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 12:14 AM
I suggest you to explain more details about your problem.
How is it not working?
How you implement those timer together?
and what is the last function before hardfault.
I guess that you should have more details to get help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 10:08 PM
Thank you all for the replies.
I figured out my problem. Except for the more recent dual core MCUs, most STM32 are limited to running only one thing at a time, so i am trying to use FreeRTOS or similar to have the system switch between tasks as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-22 10:10 PM
Thank You.
Your timer calculations are correct and thanks for sharing the github code.

- « Previous
-
- 1
- 2
- Next »