cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to call callback function of RTC Alarm when waking up device from standby mode?

JKSah
Associate II

I am trying to call rtc alarm at regular interval and want to call some code in non polling mode at every rtc alarm is fired. I know this can be done with RTC alarm callback function. But when we are in standby mode this call back function is not fired i think. I have tried it callback function doesnt work in standby mode but it does work in run mode. Kindly help me to solve this issue.

MCU: STM32L412RB

Using CubeMX HAL

1 ACCEPTED SOLUTION

Accepted Solutions

Hmm isnt relevant how is calloback started, always will block main, then i dont see what is your idea.

And reset isnt performed by going to standby, but going from standdby.

View solution in original post

6 REPLIES 6

The device comes out of reset, it is basically powered off in stand-by

You could call a callback in code that manages the start up, at the point where it recognizes the device came out of standby mode, there's a flag it tests.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

But putting code there will make it polling and that is what i want to avoid. Basically i want to do something on every rtc alarm interrupt and before the alarm fires device can be in standby mode or run mode. In run mode rtc alarm interrupt can call that callback function of alarm in CubeMX HAL but when in standby mode it rtc alarm only wakes up device and doesnt call that callback function of alarm. And i want to call the callback function in every case.

Why you dont use only semantic example

void main()
{
if(resetflarg == standywake) call_stndbycallback();
 
...

, but you need understand mcu is this time after reset and nothing is initialized. When your callback use you need place this after init all you need.

But again this will run all the code inside this call_stndbycallback() function in polling mode which will block main function for the time taken for executing that code in call_stndbycallback() function. I want to avoid this. I guess this can't be done as i expected due to reset performed by going to standby.

Hmm isnt relevant how is calloback started, always will block main, then i dont see what is your idea.

And reset isnt performed by going to standby, but going from standdby.

Oh okay, sry i was little confused how interrupt works. Thanks, I have found some other way to solve my issue. I will mark it as best. Thanks again.