This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52832 Calendar example issue

Hi,

I have added Calendar example application on top of nRF5_SDK_17.0.0_9d13099\examples\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay  example code and added following code in main . 

nrf_cal_init()  // where I have removed the lfclk start operation since I am using softdevice which starts the lfclk by itself .

void nrf_cal_init(void ){

CAL_RTCc->PRESCALER = 0xFFF;
CAL_RTCc->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
CAL_RTCc->INTENSET = RTC_INTENSET_COMPARE0_Msk;
CAL_RTCc->CC[0] = m_rtc_increment * 8;
CAL_RTCc->TASKS_START = 1;
NVIC_SetPriority(CAL_RTC_IRQnc, CAL_RTC_IRQ_Priorityc);
NVIC_EnableIRQ(CAL_RTC_IRQnc);

}

AND I AM SETTING TIME AS BELOW :

nrf_cal_set_time(2021,4 , 25, 11, 10, 2 ); // year , month,date,hrs,min,sec 

AND READING TIME AS BELOW : 

 void print_current_time(void)
{
NRF_LOG_INFO("Uncalibrated time:\t%s\r\n", nrf_cal_get_time_string2(false));
NRF_LOG_INFO("Calibrated time:\t%s\r\n", nrf_cal_get_time_string2(true));
}

But I am not getting whatever time I set , It prints  7/2/136 - 7:29:35 . and from here the clock starts . clock function increments the second counter properly ,only its causing  issue with setting proper date and time . 

How do I correct and what parameters  should I look into to fix this ?

Note :  I have configured RTC2 for calendar as below ( since RTC0 and RTC1 are taken by softdevice and app_timer ).

#define CAL_RTC                          NRF_RTC2
#define CAL_RTC_IRQn                RTC2_IRQn
#define CAL_RTC_IRQHandler    RTC2_IRQHandler
#define CAL_RTC_IRQ_Priority    4

Since My application requirements are satisfied with  ble_app_hrs_rscs_relay   example code ( multirole ) , so I cannot use any other example .

Parents Reply Children
Related