Hello,
I am trying to implement the nrf5-calendar-example for the nrf connect SDK for the board nrf9160dk_nrf52840. I am able to compile the code for this board with the nrf connect SDK by changing some functions (strftime, mktime and localtime) as well as adding a prj.conf and a CMakeLists.txt. But the code crash everytime the IRQ handler should be called. You can see below the initialization done as well as the IRQ callback that should be called:
#define CAL_RTC NRF_RTC0
#define CAL_RTC_IRQn RTC0_IRQn
#define CAL_RTC_IRQHandler RTC0_IRQHandler
#define CAL_RTC_IRQ_Priority 3
void nrf_cal_init(void)
{
// Select the 32 kHz crystal and start the 32 kHz clock
NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos;
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);
// Configure the RTC for 1 minute wakeup (default)
CAL_RTC->PRESCALER = 0xFFF;
CAL_RTC->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
CAL_RTC->INTENSET = RTC_INTENSET_COMPARE0_Msk;
CAL_RTC->CC[0] = m_rtc_increment * 8;
CAL_RTC->TASKS_START = 1;
NVIC_SetPriority(CAL_RTC_IRQn, CAL_RTC_IRQ_Priority);
NVIC_EnableIRQ(CAL_RTC_IRQn);
}
void RTC0_IRQHandler(void)
{
if(CAL_RTC->EVENTS_COMPARE[0])
{
CAL_RTC->EVENTS_COMPARE[0] = 0;
CAL_RTC->TASKS_CLEAR = 1;
m_time += m_rtc_increment;
if(cal_event_callback) cal_event_callback();
}
}Here is my prj.conf:
#---- Stack and Heap CONFIG_MAIN_STACK_SIZE=16384 CONFIG_HEAP_MEM_POOL_SIZE=4096
Is there something else to modify in the code to make this example work for the nrf connect SDK ? Or should a specific configuration be added in the prj.conf for this example to work ? And where can we know that the RTC will call a function named RTC0_IRQHandler for its handler ?
Best regards,