Timer waking from Sleep mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-31 7:27 AM
MCU is writing data to ext flash once every 15 minute. I have set Timer in interrupt mode with one minute callback and incrementing the flag. In main while loop, the flag is being check . Once flag has reached 15, the MCU writes data to ext flash and sets flag back to zero.
I am trying MCU to go in sleep mode using WFI. But now the problem is Timer with one minute callback will be waking up MCU every minute. Please suggest. I want this Timer to wakeup MCU only once in 15 minute.
Solved! Go to Solution.
- Labels:
-
STM32F0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-31 8:52 AM
Hello @Nico3
I suggest you to set Timer in interrupt mode with 15 minutes callback and forget about the incrementation. That will do the job.
Hope this is helpful for you. If this answers your questions please mark it as best answer to be diffused.
Best regards
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-31 8:52 AM
Hello @Nico3
I suggest you to set Timer in interrupt mode with 15 minutes callback and forget about the incrementation. That will do the job.
Hope this is helpful for you. If this answers your questions please mark it as best answer to be diffused.
Best regards
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-31 8:57 AM
Hello @Nico3,
I'm not sure why you're using interrupt every 1minute, and I don't understand the point of increasing the flag.
The flag is generally used as a boolean variable to know whether a criteria has been met or not, so I wouldn't recommend incrementing a flag. In your case, it's the timer's job to count! So in the callback, you should be handling the interrupt and once the count reaches 15, the flag should be set,
So you can test on the flag to write to ext flash, or to enter sleep mode
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-08-31 9:35 AM
thanks, I was thinking 15 min setting in Timer not possible. But I am wrong. I will set it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-01 8:09 PM
please let know how to set time for 15 min. clock is 48MHz. pls let know Prescaler and ARR values
I am using STM32F0 series ..having 16bit prescaler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-02 12:19 AM
Hello again
You can use this: Time to count (in second)=(1/48MHz) * (prescaler+1)*(ARR+1).
Best regards.
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-02 6:29 AM
It is not possible to set a 15 minute timer on a 16-bit timer with a timer tick rate of 48 MHz. You can use chained timers instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-02 7:41 AM
Hello again,
You can also use the TIMER 2 wish has 32-bits ARR register.
Best regards.
II
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-02 11:27 PM
please suggest the settings. I set prescaler and ARR but not sure about other setting. i just need to use as basic timer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-03 12:22 AM
Hi, your parameters will work fine if you keep them as shown in the picture.
Best regards.
II
