2011-07-17 12:55 PM
I've pored over the user guide and various app notes but cannot seem to get the RTC wakeup timer to start running, so no WU interrupt and I get stuck in halt mode.
Can someone give me a difinitive checklist of what register bits need to be set/reset to get the timer started. I need to check that what I think I should be doing from reading the user manual is right. Many thanks Jeremy2011-07-29 03:49 AM
I am using STM8L151 with external 32khz crystal ( LSE)
Here is the setup code, in my application used as a 50ms systick interrupt
CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);
RTC_ITConfig(RTC_IT_WUT, ENABLE);
RTC_SetWakeUpCounter(_50ms_TIMER_VAL);
RTC_WakeUpCmd(ENABLE);
then enable interrupts
RTC_ITConfig(RTC_IT_WUT, ENABLE);
In interrupt handler clear the interrupt source
if( RTC_GetFlagStatus(RTC_FLAG_WUTF) == SET )
{
RTC_ClearITPendingBit(RTC_IT_WUT);
}
2013-01-15 05:57 AM
Hello Patrick
Are you still working with this processor ?? Can you please send the smallest possible complete example for this ?? best regards Hakan2013-01-24 11:03 AM
I would use the firmware library as its already written,tested and documented. You can then spend time on your application instead of wasting time re-writing something which already works.
You can download the firmware library here:-http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm8l15x_stdperiph_lib.zipIf you really want to minimise the code size then for each of the function calls in the code strip out the lines of code you need.For example CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);Find this function, look at the code and strip out the lines of code which actually enable the peripheral.