Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Example that logs over Segger RTT requiring no configuration changes by me

I'm trying to get debug output to appear in my Segger J-LINK SWO viewer (from an NR52840 SDK board with NRF5 v16) which I understand is a potentially complicated process; I've received nothing in the SWO viewer so far.  Do you have an example which sends debug output to Segger RTT by default, without me screwing anything up, i.e. all I have to do is make flash, just so that I can check that the connection and the Segger tools are good (not that there's much that can go wrong with them)?

FYI, in my sdk_config.h I have NRF_LOG_ENABLED 1,  NRF_LOG_BACKEND_RTT_ENABLED 1, NRF_LOG_BACKEND_UART_ENABLED 0NRF_LOG_DEFERRED 0 and NRF_LOG_DEFAULT_LEVEL 3 and in main.c I start with:

NRF_LOG_INIT(NULL);
NRF_LOG_DEFAULT_BACKENDS_INIT();

NRF_LOG_INFO("Hello world.\n");

In the Segger SWO viewer I've selected nRF52840_xxAA, let it measure the clock, selected channel 0, the green LED near the PCA10056 on the board is flashing regularly and I pressed the reset button on the board. Nada.

Oh, and I also have the defaults for the Segger RTT settings, i.e.:

#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0

Rob

Parents
  • Hi Rob,

    RTT is printed out on the SWDIO line instead of SWO. Could you try the RTTViewer instead and see if it works? 

    Thre are several examples which have RTT logging enabled by default. ble_app_uart is one of them (located in \nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral\ble_app_uart\pca10056\s140). Note: remember to load the Softdevice since it's a BLE app: make flash_softdevice && make flash 

    Vidar

    Edit: RTTViewer is not available for Linux MacOS if I recall correctly. So if you are not working in Windows, try to first connect the debugger with Jlink commander (JLinkExe) first, then run the RTTClient executable from another terminal window. 

Reply
  • Hi Rob,

    RTT is printed out on the SWDIO line instead of SWO. Could you try the RTTViewer instead and see if it works? 

    Thre are several examples which have RTT logging enabled by default. ble_app_uart is one of them (located in \nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral\ble_app_uart\pca10056\s140). Note: remember to load the Softdevice since it's a BLE app: make flash_softdevice && make flash 

    Vidar

    Edit: RTTViewer is not available for Linux MacOS if I recall correctly. So if you are not working in Windows, try to first connect the debugger with Jlink commander (JLinkExe) first, then run the RTTClient executable from another terminal window. 

Children
  • Ah, apologies, I thought RTT was the same thing as SWO.  Do you have SDO out also, nice and standard...?

    Anyway, RTT shows the same thing: all seems to start up OK but no sign of any of my debug.

    I tried that example you pointed to, which built and downloaded fine, but I still don't see anything in the RTT viewer.  RTT viewer connects (see output below) and the green LED on the board flashes more rapidly but no text ever appears in the terminal window.  What else might I be doing wrong?

    LOG: Connecting to J-Link via USB...
    LOG: Device "NRF52840_XXAA" selected.
    LOG: InitTarget() start
    LOG: InitTarget() end
    LOG: Found SW-DP with ID 0x2BA01477
    LOG: DPIDR: 0x2BA01477
    LOG: Scanning AP map to find all available APs
    LOG: AP[2]: Stopped AP scan as end of AP map has been reached
    LOG: AP[0]: AHB-AP (IDR: 0x24770011)
    LOG: AP[1]: JTAG-AP (IDR: 0x02880000)
    LOG: Iterating through AP map to find AHB-AP to use
    LOG: AP[0]: Core found
    LOG: AP[0]: AHB-AP ROM base: 0xE00FF000
    LOG: CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    LOG: Found Cortex-M4 r0p1, Little endian.
    LOG: FPUnit: 6 code (BP) slots and 2 literal slots
    LOG: CoreSight components:
    LOG: ROMTbl[0] @ E00FF000
    LOG: ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    LOG: ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    LOG: ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    LOG: ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    LOG: ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    LOG: ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    LOG: RTT Viewer connected.

Related