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

Program getting stuck on NRF_BREAKPOINT_COND after getting into a template function

So I noticed the program goes into a state where it's stuck on  NRF_BREAKPOINT_COND, which happens after getting into the following writeToLogger() template function. If I comment this function call, it seems to work fine. 

   template<typename T>
    static void writeToLogger(T *data, ...)
    {
        char tmp[40] = {0};
        va_list args;
        va_start(args, data);
        vsprintf (tmp, data, args);
        xStreamBufferSend(nrfLogTaskMsgBuffer, (void*)&tmp, 40, pdFALSE);
    }
    
int main(void)
{
  NrfLogger logger;
  NrfLogger::writeToLogger<char>("Writing to register address %x", 10);
}

Parents Reply Children
  • The app_error_fault_handler says that the error is 0x4002 which is an SDK related error. You should be able to get the filename and linenumber from the info variable when casted to assert_info_t.

    It most likely seems to be a manual ASSERT check in integration\nrfx\legacy\nrf_drv_clock.c: 274 (nRF5 SDK17.0.2)

        ASSERT(m_clock_cb.lfclk_requests > 0);
    This happens most likely when you have not initialized the nrf_drv_clock as below before attempting to start the scheduler. Add this line before vTaskStartScheduler

        /* Initialize clock driver for better time accuracy in FREERTOS */
        err_code = nrf_drv_clock_init();
        APP_ERROR_CHECK(err_code);
Related