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

RTT Not working if ERROR_CHECK is called/compiled in?

Hi, I am working with the Mesh SDK 0.10.1. Everything compiles and runs fine. However I wasn't getting any RTT logs. I found that if I put a while loop before the first call to ERROR_CHECK() the logging works fine. This is really weird!, and leads me to believe that it is getting optimized out or something? Any help greatly appreciated!

I am using OS X, gcc-arm-none-eabi-4_8-2014q1, and the CMake scripts include with the project.

Here is the function that first calls ERROR_CHECK() in "examples/nrf_mesh_sdk.c", see the while(1) loop about 2/3 the way down.

void mesh_core_setup(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing softdevice\n");
    
#if  SD_BLE_API_VERSION >= 5
    nrf_clock_lf_cfg_t lfc_cfg = {NRF_CLOCK_LF_SRC_XTAL, 0, 0, NRF_CLOCK_LF_ACCURACY_20_PPM};
#elif SD_BLE_API_VERSION >= 2
    nrf_clock_lf_cfg_t lfc_cfg = {NRF_CLOCK_LF_SRC_XTAL, 0, 0, NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM};
#elif defined(S110)
    nrf_clock_lfclksrc_t lfc_cfg = NRF_CLOCK_LFCLKSRC_XTAL_20_PPM;
#endif
    mesh_softdevice_setup(lfc_cfg);

    
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing mesh stack\n");
    nrf_mesh_init_params_t mesh_init_params = {
        .lfclksrc = lfc_cfg,
        .assertion_handler = mesh_assert_handler,
    };
    
  
   //with this added RTT works fine, if compiles without this loop RTT doesn't work???
    while (1) {
        
    }
    
    ERROR_CHECK(nrf_mesh_init(&mesh_init_params));
    
    
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Enabling mesh stack\n");
    ERROR_CHECK(nrf_mesh_enable());
    
    
}
Related