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

How do I add RTT debugging to blinky example in Embedded Studio

Hi all, I apologise for this very basic question, but I don't understand how to add/enable RTT debugging to my code. I want to practice writing basic code for the NRF5 SDK, and I think adding debugging to the blinky example is a good step.

What I have done is:

-Copy the "blinky" folder from ...nRF5_SDK\examples\peripheral\blinky  to a new folder   ...nRF5_SDK\my_code\peripheral\blinky

(Did this to keep my test code separate from the examples)

-Replace the config file ...\nRF5_SDK\my_code\peripheral\blinky\pca10056\mbr\config with the config file from ...\nRF5_SDK\examples\ble_peripheral\ble_app_blinky\pca10056\s140\config

(Did this becuase ble_app_blinky example uses RTT debugging, and I know it works)

-Add nrf_log_backend_rtt.c and nrf_log_default_backends.c to the nRF_Log folder in Embedded studio from ...nRF5_SDK\components\libraries\log\src

(Did this to match the ble_app_blinky example)

-Create folder nRF_Segger_RTT in Embedded studio, and added SEGGER_RTT.c , SEGGER_RTT_printf.c , SEGGER_RTT_Syscalls_SES.c   from ...\nRF5_SDK\external\segger_rtt folder

(Did this to match the ble_app_blinky example)

-Use CMSIS configurator to make sure NRF_LOG_BACKEND_RTT and NRF_LOG_ENABLED are enabled in sdk_config.h

(Need to be enabled to work)

-Modify main.c to use logging.

When I do those steps, the code builds, but when debugging, nothing shows on the debug terminal

Here is the main code:

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "boards.h"

#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"


int main(void)
{
    NRF_LOG_DEFAULT_BACKENDS_INIT();
    bsp_board_init(BSP_INIT_LEDS);


    while (true)
    {
        for (int i = 0; i < LEDS_NUMBER; i++)
        {
            NRF_LOG_INFO("Invert");
            bsp_board_led_invert(i);
            nrf_delay_ms(500);
        }
    }
}

Project items in SES:

Thanks in advance

Parents Reply Children
No Data
Related