Custom nRF5340 board not logging debug statements to JLinkRTTViewer

I have a custom board (nrf5340) and can debug it, but it will not print to J-Link RTT Viewer. The main looks like this and I tested with a breakpoint on the LOG_DBG using my J-Link Plus, so I know it's getting there.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/pwm.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(app, LOG_LEVEL_DBG);
...
int main(void)
{
LOG_DBG("Starting Blinky Example");
//int ret;
bool led_state = false;
if (!device_is_ready(vib_motor.dev)) {
LOG_ERR("Vibration motor control not supported");
return -ENODEV;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have this in the prj.conf:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CONFIG_GPIO=y
CONFIG_PWM=y
CONFIG_LOG=y
#Bluetooth Settings
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Hello_World_Blinky"
#CONFIG_DEBUG_OPTIMIZATIONS=y
#CONFIG_DEBUG_THREAD_INFO=y
#Segger RTT Settings
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_UART_CONSOLE=n
CONFIG_PRINTK=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

it's making it impossible to work with this board.

  • Hello,

    RTT link viewer has several ports, sometime if it does not work for one terminal it can work for another. Did you try all? The first step you can do to check if any other serial terminal is open in your system. Try to close it and open the J-Link RTT viewer again.

    You can also try to add these CONFIG_CONSOLE=y and CONFIG_LOG_BACKEND_UART=n in the prj.conf file.

  • I added these to the prj.conf

    Fullscreen
    1
    2
    CONFIG_CONSOLE=y
    CONFIG_LOG_BACKEND_UART=n
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Now when I run in debug mode I get the printing in JLink RTT Viewer but when I build and flash I don't.

  • ''Now when I run in debug mode, I get the printing in JLink RTT Viewer but when I build and flash I don't.'' How do you build and flash? Do you mean you can not get any output on other serial terminal like putty or no output on Jlink RTT viewer?

    Can you show me some output log or screenshot from your output terminal?

  • When I debug, I am in VS Code and press the debug button in nrfConnect (add-in), I get prompted to select core from the command prompt and select app, I open (or select) the jlink rTy app and connect. I see the debug messages.

    Otherwise I do a pristine build in VS Code on the nrfConnect add-in, when done I press flash, when done I open (or select) jlink rtt viewer, I connect, which seems to work, but get no messages.

  • It seems to be working. I ran it a few times and I think the config statement did it. I don't know why it didn't the first one or two times, but it seems to work pretty regularly now. Thank you.

1 2