RTT viewer is not working

Hi,

I am currently developing a project using the nRF52810 as my controller and SEGGER Embedded Studio (version 5.42a) as my IDE. I have successfully integrated the Timer and SAADC peripherals into the ble_app_uart/pca10040e/s112 example project from the nRF5 SDK.

My problem is that I can't use J-Link RTT Viewer for debugging. When I open the J-Link RTT Viewer and connect it to my board, I can't see any debug messages or information in the RTT console. What could be the reasons for this? Is there any SDK configuration macro that needs to be enabled or disabled to use the RTT Viewer, or could the problem be related to the connection parameters?

Any response would be valuable.

*******************************************************************************************************************

Project Details:

  • SDK: nRF5 SDK 17.0.2
  • IDE: SEGGER Embedded Studio 5.42a
  • Controller: nRF52810
  • Peripherals: Timer and SAADC (using default configuration for SAADC, with a 12-bit resolution)

Thank you for your support.

Best regards,
SILTVM

Parents Reply Children
  • No. Does RTT logging work in SES with your modified project?

  • hi ,  I'm having some trouble displaying logs to the rtt viewer , I can see the logs with SES Debug Terminal but not in RTTviewer . 

  • I asked you to confirm that RTT logging works in SES with your modified example, as I need to ensure I understand the details. Also, I asked earlier if you have periodic logging after startup in your project. 

  •  , Yes, I'm checking the periodic log messages. I will attach the code for better understanding, The RTT viewer couldn't display anything.

    .

    int main(void)
    {
        bool erase_bonds;
        int len1=0;
        char cmd=0;
        uint16_t length=0;
        
        //uint32_t time_ticks;
        //uint32_t err_code = NRF_SUCCESS;
    
        // Initialize.
        //log_init();
       // #ifdef DEBUG_LOG
       // NRF_LOG_INFO("LOG INTI\n");
       // #endif
        uart_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("UART INTI\n");
        #endif
        log_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("LOG INTI\n");
        #endif
        timers_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("TIMER INTI\n");
        #endif
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("BEFORE ENTER BUTTONS LED INIT \n");
        #endif
        buttons_leds_init(&erase_bonds);
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("BUTTON LED INIT \n");
        #endif
        indication_gpio_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" INDICATION GPIO INIT \n");
        #endif
     
        power_management_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" POWER MANAGEMENT INIT \n");
        #endif
        ble_stack_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" BLE STACK INIT \n");
        #endif
        get_device_mac_address();
    
        gap_params_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" GAP PARAMS INIT \n");
        #endif
        gatt_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" GATT INIT  \n");
        #endif
        services_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" SERVICE  INIT \n");
        #endif
        advertising_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" ADVERTISING  INIT \n");
        #endif
        conn_params_init();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" CONNECTION PARAMS INIT \n");
        #endif
        // Start execution.
        #ifdef UART_DEBUG
        printf("\r\nUART started.\r\n");
        #endif
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("\n uart started \n.");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        #endif
    
        //tx_power_modification();
        advertising_start();
        #ifdef DEBUG_LOG
        NRF_LOG_INFO("ADVERTISING STARTED \n.");
        #endif
    
        saadc_init();
        saadc_sampling_event_init();
        saadc_sampling_event_enable();
    
        while(1)
        {
           //printf("running inside while \n");
           #ifdef UART_DEBUG
           printf("\n waiting for connection \n");
           #endif
    
            #ifdef DEBUG_LOG
           NRF_LOG_INFO(" waiting for connection  \n");
            #endif
           nrf_delay_ms(1000);
           if(ConnectionStatus==1)
           {
             //printf("ConnectionStatus=1 \n");
             nrf_delay_ms(1000);
             break;
           }
       
        }
    
        //uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN,m_conn_handle, 4);
       // printf("BLE_GAP_TX_POWER_ROLE_CONN: %u\n", err_code);
        //APP_ERROR_CHECK(err_code);
    
        #ifdef DEBUG_LOG
        NRF_LOG_INFO(" exit from connection \n");
        #endif
        #ifdef UART_DEBUG
        printf(" exit from connection \n");
        #endif
        ble_response_flag=1;
       
    
        while(1)
        {
        nrf_delay_ms(2000);
        NRF_LOG_INFO("INSIDE THE WHILE(1)LOOP \n");
        if(strlen(BLEDataBuff))
        {
         #ifdef DEBUG_LOG
         NRF_LOG_INFO("enter in if\n");
         #endif
         #ifdef UART_DEBUG
         printf(" enter in if \n");
         #endif
         cmd= ble_processcommand(BLEDataBuff);
         nrf_delay_ms(10);
         size_t l1=strlen(BLEDataBuff);
         #ifdef UART_DEBUG
         printf("size of str : %d\n ble string : %s\n cmd : %d\n",l1,BLEDataBuff,cmd);
         #endif
         nrf_delay_ms(100);
         ble_commandprocessing(cmd);
         nrf_delay_ms(2000);
         memset(BLEDataBuff,0,sizeof(BLEDataBuff));
         #ifdef DEBUG_LOG
         NRF_LOG_INFO("exit in if \n");
         #endif
         #ifdef UART_DEBUG
         printf(" exit in if \n");
         #endif
         
    
        }
           
        }
       
        while (1)
        {
            __WFI();
        }
       
    }
    
    

  • You are not processing the log buffer in your main loop like the original ble_app_uart example. If you don't want to do this, you need to enable In-place processing by setting NRF_LOG_DEFERRED to '0'.

    log_init() shall also be called at the beginning of main() before printing any messages.

Related