cancel
Showing results for 
Search instead for 
Did you mean: 

RTC as wakeup-source on C0 family

Panda
Associate III

Hello,

 

I have found various guides on how to configure the RTC as wakeup-source. However, they do not seem to apply to the C0 family.

In the CubeIDE I cannot find the depicted settings on RTC, (most notably, no option to select internal wakeup and configure wakeup counter and clock)

 

Is this not implemented on the C0 family?

 

I just want my MCU to wake up from sleep mode every x milliseconds. What else can I do to implement this on a C011?

 

Thanks

Lucas

10 REPLIES 10

Hello,

first off, thank you for the answer. I understand that there is no option for periodic alarms. To use it as a periodic alarm I would have to set the next alarm individually before going into sleep.

 

I have tried to implement this for some time now, hence my late reply. But I didn't get further than the once-per-minute (or once-per-second) blinking.

 

I was even unable to set an alarm (even only once at startup) at something arbitrary, like 5 seconds. I removed the part that puts the MCU in sleep and just monitored the time in the debugger. Interestingly, I can see that subseconds count down like expected, but seconds do not count up. They stay at 0.

 

I was going back and forth also with chatGPT, as sometimes I find it helpful, but I guess it didn't learn enough about STM's HAL to help here. However it suggested that this issue might be due to incorrect configuration and issues when using HAL to reconfigure the RTC (I also played around with different synch prescaler values)

 

Anyways, I will try to implement the register-level rtc_alarm_irq from your github and try to change it to my needs.

I basically want to have an implementation where I can set the alarm to now+0.125 seconds (granularity of eights of a second is enough) and then go to sleep. I don't want to go to sleep for too long as its a handheld device that needs to be responsive and go back into operating mode when a button push is detected. For this I want to check the button state at least a few times per second.

 

I know I'm using the RTC in a weird way. I don't want to use IWDG, as this would cause a complete reset everytime.

 

I will report back. In the meantime, have you encountered this issue that seconds are not counting up or have an idea why or a suggestions to try out?

Thanks

Lucas