what are the initial values to be fed in rtc_tr and rtc_dr registers?
hello
I am new to stm series microcontrollers and am developing driver for my projects. for the rtc driver am stuck at this point for so long that am not able to put right values in rtc time and date register, am not using cubeMX or any built in hal or hal library, the controller am using is the discovery board with stm32f051x8. am done with previous initializations of rtc. but not getting that what values should to kept in rtc_tr and rtc_dr registers as initial values. I need to use 12H format so if any one can tell me about some more details of how to put values in those regs. and how to read those values to see the accurate time and date. I think that an example will be helpful with values in BCD tens and BCD units format.
here is my code
#include'stm32f0xx.h'
#include'stm32f051x8.h'void RTCInitialized()
{ RCC->CSR |= RCC_CSR_LSION; RCC->APB1ENR |=RCC_APB1ENR_PWREN; RCC->BDCR = RCC_BDCR_RTCEN; PWR->CR |= 0X00000100; RTC->WPR = 0XCA; RTC->WPR = 0X53; RTC->ISR |= 0X00000080; // entering INIT mode of rtc RTC->CR |= RTC_CR_FMT; RCC->BDCR |= 0X00000200; while((RTC->ISR & RTC_ISR_INITF) == 1) { RTC->ISR & RTC_ISR_INITF; } RTC->PRER = 0x007F0137; // given in trm code sample for lsi.// these are the trials
for setting up time/* RTC->TR = RTC_TR_PM | RTC_TR_HT_0 |RTC_TR_HU_0 |RTC_TR_MNT_0 |RTC_TR_MNT_1 |RTC_TR_ST |RTC_TR_SU; RTC->DR = RTC_DR_YT_0 | RTC_DR_YU_3|RTC_DR_WDU_2 |RTC_DR_MU_0|RTC_DR_MU_1|RTC_DR_MU_2 |RTC_DR_DT_0| RTC_DR_DU_1; */// RTC->TR = 10100100000001000000000;// these are the trials
for setting up time
// RTC->TR =0X521812; //0X00520800;// these are the trials
for setting up time
RTC->DR =0X182713; RCC->BDCR |= 0X00008200; RTC->ISR &= ~(RTC_ISR_INIT); RTC->WPR = 0XFE; RTC->WPR = 0X64;}