cancel
Showing results for 
Search instead for 
Did you mean: 

[solved]stm32f0 rtc pls help

aaslan
Associate II
Posted on August 21, 2015 at 17:08

I downloaded application note write code.my device(stm32f0discovery,stm32f051r8t6).the weird thing with cube generated code it doesnt work either.In addition if I put breakpoint on while loop when I look rtc I see RTC->ISR INIT(7.) not set it is weird if somebody knows answer thanks before hand

RTC->WPR = 0xCA;
RTC->WPR = 0x53;
RTC->ISR |= (1<<
ISR_INIT_BIT
);
while((RTC->ISR & (1<<
ISR_INITF_BIT
)) == 0){}//the program stucks here
RTC->PRER = 0;
RTC->PRER |= (127<<
16
);
RTC->PRER |= 255;
//here i will put time values
RTC->TR = 0;
RTC->TR = (5<<
0
);//second units
RTC->TR |= (1<<
4
);//second tens
RTC->TR |= (4<<
8
);//minute units
RTC->TR |= (2<<
12
);//minute tens
RTC->TR |= (5<<
16
);//hour units
RTC->TR |= (1<<
20
);//hour tens
//here i will put date values
RTC->CR &= ~(1<<
CR_FMT_BIT
);
RTC->ISR &= ~(1<<
ISR_INIT_BIT
);
RTC->WPR = 0xFF;

4 REPLIES 4
Posted on August 21, 2015 at 17:32

Is the PWR clock enabled, and then access to the backup domain enabled?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aaslan
Associate II
Posted on August 21, 2015 at 19:47

SORRY FOR crossposting.Thank a lot. I see how do I skip I focused I forget about clk and I didnt know I have to power up I see.Thanks a lot.I will look into it I hope I can solve

aaslan
Associate II
Posted on August 21, 2015 at 23:26

partly solved in debug mode I get it working at least now I can set rtc in normal mode it does not counts up seconds.I will look into it

__PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);
__HAL_RCC_RTC_ENABLE();

altough I didnt full understand I ll try
aaslan
Associate II
Posted on September 06, 2015 at 08:04

I noticed rtc is working I could not able display on the screen. Hal library function get time is not working some reason.I did not dig into it.I simply read RTC->TR register