Hi i am using nRF52840 with segger embedded studio.
SDK -> nrf5-sdk 17.1.0
I want to configure rtc2 so that
whenver i initialize it it should generate an interrupt after certain interval and wakeup the system.
B_LED_RED is blinking but B_LED_BLUE is not blinking.
// RTC instance for RTC2
const nrfx_rtc_t rtc = NRFX_RTC_INSTANCE(2);
nrfx_rtc_config_t rtc_cfg = NRFX_RTC_DEFAULT_CONFIG;
// RTC wake-up handler
void rtc_handler(nrf_drv_rtc_int_type_t int_type)
{
if (int_type == NRFX_RTC_INT_TICK)
{
nrf_gpio_pin_toggle(B_LED_RED);
}
else if(int_type == NRFX_RTC_INT_COMPARE0)
{
nrf_gpio_pin_toggle(B_LED_BLUE);
}
}
void rtc_init(void)
{
rtc_cfg.prescaler = 4095; //1 tick 32768/(4095+1) = 8 Hz= 125ms/tick
uint32_t err_code;
err_code = nrfx_rtc_init(&rtc, &rtc_cfg, rtc_handler);
APP_ERROR_CHECK(err_code);
nrfx_rtc_tick_enable(&rtc, true);
nrfx_rtc_cc_set(&rtc, 0, 8, true);
nrfx_rtc_enable(&rtc);
}
