Can't get nRF52811 based sample projects to display on Segger J-Link RTT Viewer

Hi,

I am working on an FCC cert of our product which is nRF52811 based.  We are currently on SDK 2.0.0.  I have copied from the nrf samples bluetooth area the projects peripheral_uart and direct_test_mode and have been trying (in vain) to get them to send LOG_INF output to the RTT display.  Our main FW on nRF52811 sends the data fine but for some reason I can't get the other two test projects to do that.

I really need the direct_test_mode project to work that so I can test out the 52811 before we go to the RF Lab to check it out.  The peripheral_uart sample seems to be where our current pre-production FW originated from, so I have been trying to use that one to get the RTT display working.  I had to basically lobotomize it as far as BT is concerned since the 52811 is such a small SOC.

Here's the proj.conf from peripheral_uart:

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y

CONFIG_GPIO=y

# Make sure printk is printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=n

CONFIG_HEAP_MEM_POOL_SIZE=2048

#CONFIG_BT=y
#CONFIG_BT_PERIPHERAL=y
#CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"
#CONFIG_BT_DEVICE_APPEARANCE=833
#CONFIG_BT_MAX_CONN=1
#CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
#CONFIG_BT_NUS=y

# Enable bonding
#CONFIG_BT_SETTINGS=y
#CONFIG_FLASH=y
#CONFIG_FLASH_PAGE_LAYOUT=y
#CONFIG_FLASH_MAP=y
#CONFIG_NVS=y
#CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
#CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_ASSERT=y

# hml extra stuff:
CONFIG_BT_NUS_SECURITY_ENABLED=n
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_RTT_CONSOLE=y
The main configs that seem to be important for RTT display appear to be CONFIG_SERIAL, CONFIG_LOG, and CONFIG_USE_SEGGER_RTT.
I have the log.h setup in my main.c and have the other setups.  Here's a partial in main:
#define LOG_MODULE_NAME peripheral_uart
LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL_INF);
void main(void)
{
while(true) {
k_msleep(1000);

LOG_INF("EXECUTING MAIN AFTER WAITING 5 SECONDS");
};
Any help would be appreciated.
h.
  • A little extra info.  On the J-Link RTT Viewer output, I can see that we are able to connect, but nothing displays:

    LOG: Connecting to J-Link via USB...
    LOG: Device "NRF52811_XXAA" selected.
    LOG: InitTarget() start
    LOG: InitTarget() end - Took 2.09ms
    LOG: Found SW-DP with ID 0x2BA01477
    LOG: DPIDR: 0x2BA01477
    LOG: CoreSight SoC-400 or earlier
    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: [0][0]: E000E000 CID B105E00D PID 000BB000 SCS
    LOG: [0][1]: E0001000 CID B105E00D PID 003BB002 DWT
    LOG: [0][2]: E0002000 CID B105E00D PID 002BB003 FPB
    LOG: RTT Viewer connected.

    It's setup correctly, with the USB and Serial number, target device correct, interface SWD at 4000kHz and Auto Detection.  And as I said before the same display will correctly display our current real app that originally used peripheral_uart as a template.  So it seems to be something with these sample apps...  

    h.

  • I found another devzone article with a zip file (minimal_log.zip) that has a project that just does what I need it to do.  I have downloaded it and built it, but it doesn't output any data either.  I do see it connect to the RTT display though:

    devzone.nordicsemi.com/.../how-to-enable-ncs-rtt-logging

    h.

  • Hello,

    You are using NCS version 2.0.0? It is very old.

    I have tried to reproduce the minimal_log.zip on NCS version 2.9.0. Initially it shows there is no file like logging/log.h

    This is because there is no use of ''#include "logging/log.h" in current NCS version. The include statement for public zephyr headers has changed what was on NCS v2.0.0.

    The proper way to include the logging header in NCS 2.9.0 is:
    #include <zephyr/logging/log.h>

    Then it worked as expected.

    Have you set the target device properly? Which version of RTT viewer you are using?

  • Kazi,

    Yeah, 2.0.0 is very old.  We will be working on getting to the current version.  But right now we are on this version.  We have an app that is currently running on the nRF52811 processor that is sending RTT data to the display.  So I know it works under the SDK version 2.0.0

    I have two projects from the samples/bluetooth directory on SDK 2.0.0 under nrf (direct_test_mode and peripheral_uart) that I have been trying to get RTT display working on and it doesn't work.  I have also beein trying to get the minimal_log.zip working, which it doesn't work either.

    I have spent many hours on this and still no luck.  So I am sure there is something in our code on the working version (which I call the BLE) that must not be on the other test projects, but I don't see it.  I have done a lot of combing around looking at parameters from proj.conf and what they eventually become in .config and haven't really seen anything there.

    I have tried the logger thread on and off (it's off on our working software I think).  So I have looked at a lot of things.

    I really need to get this working because I need to do an FCC cert on it soon.  So any helpful hints you might have would be appreciated.

    How does the rtt suff exactly work?

    We have the J-Link interface connected to the board on the JTAG I believe.  So we aren't using any UARTs specifically.  It's through the SWO/CLK/IO.

    It would really be helpful to get this working through for what I need to do.

    Thanks,

    h.

  • I tried your sample, and it worked on the nrf52832 DK for version v2.9.0 with some modification of the header file. That I mentioned on my previous reply.

    Now I have tried this on v2.0.0 as same as you. It worked (for old version there is no error related to log.h file, so no modification was needed).

    below is my configuration of RTT viewer. 

Related