Hello,
we want to use RTC2 (RTC0 is used by SoftDevice, RTC1 by FreeRTOS) to keep track of time. I set NRFX_RTC2_ENABLED and NRFX_RTC_ENABLED in app_config.h. Code used for initialising RTC:
static nrfx_rtc_t _rtc = NRFX_RTC_INSTANCE(2); void rtc_handler(nrfx_rtc_int_type_t type){ if (type == NRFX_RTC_INT_COMPARE0) { _time += _rtc_increment; reset_counter(); } } nrfx_err_t cal_begin(){ nrfx_err_t err_code; #ifndef SOFTDEVICE_PRESENT //inititialize and enable target clock err_code = nrfx_clock_init(clockCallback); nrfx_clock_enable(); //low frequency clock is selected - check how to change source of the LF clock - RC, XTAL, Synth, ... nrfx_clock_lfclk_start(); while (!nrfx_clock_lfclk_is_running()) { /* wait until clock is running */ }; #endif nrfx_rtc_config_t config = NRFX_RTC_DEFAULT_CONFIG; config.prescaler = 4095; // 8 Hz err_code = nrfx_rtc_init(&_rtc, &config, rtc_handler); nrfx_rtc_tick_enable(&_rtc, false); err_code = nrfx_rtc_cc_set(&_rtc, 0, _rtc_increment * 8, true); nrfx_rtc_enable(&_rtc); return err_code; }
cal_begin() is then called after nrf_sdh_enable_request in main.c. After 1 minute (when RTC handler is raised) DK stop execution, after some time we get error:
++ MbedOS Error Info ++ Error Status: 0x80020126 Code: 294 Module: 2 Error Message: CMSIS-RTOS error: ISR Queue overflow Location: 0x20825 Error Value: 0x2 Current Thread: rtx_idle Id: 0x20003B6C Entry: 0x208D9 StackSize: 0x200 StackMem: 0x20003C38 SP: 0x2003FF18 For more info, visit: https://mbed.com/s/error?error=0x80020126&tgt=NRF52840_DK -- MbedOS Error Info -- = System will be rebooted due to a fatal error = = Reboot count(=5) reached maximum, system will halt after rebooting =
We also tried with no SoftDevice support, same result (error above). What can be done to solve this issue? Working with SDK v15.0.0, mbedOS v6.6.