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

RTT not appearing in modified ble_app_uart example

    Hello,

I have been developing software on the ble_app_uart example in Segger Embedded Studio with sdk 17.0.2.  The example has RTT enabled but I noticed when I try to use RTT in my modified version that no RTT shows up in the debugging window.  I added various libraries and changed the config file, but did not remove anything or turn off anything in the config file from the example.  I wasn't sure how to troubleshoot this and was wondering what potential problems might be interfering with RTT outputs in the debugging terminal.  Here is my main() code, I can add more if necessary.  

int main(void)
{
    bool erase_bonds;
    ret_code_t rc;

    // Initialize.
    twi_init();
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();


    /* Register first to receive an event when initialization is complete. */
    (void) fds_register(fds_evt_handler);


    rc = fds_init();
    APP_ERROR_CHECK(rc);

    /* Wait for fds to initialize. */
    wait_for_fds_ready();

    // Start execution.
    printf("\r\nUART started.\r\n");



    //turn on LED3 while on and not in sleep mode
    nrf_gpio_cfg_output(LED2);
    nrf_gpio_pin_clear(LED2);

    NRF_LOG_INFO("Debug logging for UART over RTT started.");



    //button press waits for a button press event or times out and goes to sleep mode if no button press is received in 15 seconds
   
    
    buttonPress(); 

    nrf_delay_ms(100);

    advertising_start(); 

    //advertise for 15 seconds then try to send the data
    nrf_delay_ms(5000);

    //SendTime sends the entire memory, should add a condition to make sure that it's connected to BLE, potentially only send new entries etc.
    SendTime(); 

    //wait 5 seconds after sending the data before entering sleep mode, just here to give time to read in devtools for debugging
    nrf_delay_ms(5000);

    sleep_mode_enter_wakeup_enabled();
    
   


    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}

  • I'm using in-place processing.  I had been using deferred previously with the only call to NRF_LOG_PROCESS() in the idle_state_handle(), but I changed some of the sleep mode behavior from the ble_app_uart example and changed to in place processing at that point as well since I thought the new sleep behavior would alter the processing.  

  • Hi

    So in your modified example project, the application is able to run past NRF_LOG_INFO() without asserting, correct? Can you also confirm that the UART backend for logging is disabled and that only the RTT is enabled for logging, as enabling both might cause trouble.

    Best regards,

    Simon

  • So in your modified example project, the application is able to run past NRF_LOG_INFO() without asserting, correct?

    Yes.

    Can you also confirm that the UART backend for logging is disabled and that only the RTT is enabled for logging, as enabling both might cause trouble.

    logging UART is just enabled through the code: 

    NRF_LOG_BACKEND_UART_ENABLED

     in the sdk_config.h file correct?  I can't find this anywhere in the config file which is strange since using UART with putty still works.  Could this be enabled elsewhere?  I also noticed on the page I linked for NRF_LOG_BACKEND_UART_ENABLED that the description says "enable RTT backend."  Is this  a mistake?   Or does the UART backend enable both?

  • Hi

    Yes, the UART backend for logging is disabled by setting the NRF_LOG_BACKEND_UART_ENABLED to 0 in sdk_config.h. My mistake, this define is not used in the ble_app_uart example, as the UART backend is not used for logging, but for the application and NUS service instead.

    What I did notice though, is that there are some CLI defines (amongst other things) disabled in the ble_app_uart example's config file. Have you remembered to enable these to go with the additional peripherals you're using?

    The description of NRF_LOG_BACKEND_UART_ENABLED is wrong in the Infocenter it seems. I have reported this to our tech. doc. writers. Thank you for pointing that out!

    Best regards,

    Simon

  • What I did notice though, is that there are some CLI defines (amongst other things) disabled in the ble_app_uart example's config file. Have you remembered to enable these to go with the additional peripherals you're using?

    Which defines need to be enabled and what effects would CLI have on RTT?  I don't think I understand the interaction and there are a lot of CLI defines so I'm not sure what changes I need to make or should try.  

Related