Hello , I am working on a project, Which which currently working fine , but my job is to add some feature to it. So it is a Mesh application i need some kind of custom sleep mode , so I need an RTC_Event that will be triggered after some time, I try to achieve this using Compare event . The build very well but when I try to debug and run. It jumps to Disassemble section and throws me an error. I am currently using RTC Instance 0, I don't know why this is happening, Also I am little new to this , Any help regarding this?.
Thanks
#define COMPARE_COUNTERTIME (5UL) #define COMPARE_COUNTERTIME_1 (10UL) /**< Get Compare event COMPARE_TIME seconds after the counter starts from 0. */ extern volatile uint8_t onoffflage; const nrf_drv_rtc_t rtc = NRF_DRV_RTC_INSTANCE(0); /**< Declaring an instance of nrf_drv_rtc for RTC0. */ /** @brief: Function for handling the RTC0 interrupts. * Triggered on TICK and COMPARE0 match. */ void rtc_handler(nrf_drv_rtc_int_type_t int_type) { if (int_type == NRF_DRV_RTC_INT_COMPARE0) { nrf_drv_rtc_int_enable(&rtc, NRF_RTC_INT_COMPARE0_MASK); onoffflage = 1; } if (int_type == NRF_DRV_RTC_INT_COMPARE1) { onoffflage = 0; nrf_drv_rtc_counter_clear(&rtc); nrf_drv_rtc_int_enable(&rtc, NRF_RTC_INT_COMPARE1_MASK); } }
This is my RTC Event Handler Function.
/** @brief Function initialization and configuration of RTC driver instance. */ static void rtc_config(void) { uint32_t err_code; nrf_drv_clock_lfclk_request(NULL); //Initialize RTC instance nrf_drv_rtc_config_t config = NRF_DRV_RTC_DEFAULT_CONFIG; config.prescaler = 4095; err_code = nrf_drv_rtc_init(&rtc, &config, rtc_handler); APP_ERROR_CHECK(err_code); //Set compare channel to trigger interrupt after COMPARE_COUNTERTIME seconds err_code = nrf_drv_rtc_cc_set(&rtc,0,COMPARE_COUNTERTIME * 8,true); err_code = nrf_drv_rtc_cc_set(&rtc,1,COMPARE_COUNTERTIME_1 * 8,true); APP_ERROR_CHECK(err_code); //Power on RTC instance nrf_drv_rtc_enable(&rtc); }
RTC Configuration function
Disassembly Section
Traceback to Error
Thanks