Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

1. Overview

This note describes how to set up and use the serial consoles for the nRF9161 and nRF5340 MCUs. Use of the Zephyr interactive shell command interface, on top of the serial consoles, is explained as well.

1. Setting Up Serial Consoles

1. VCOM and USB Serial Ports

The Nordic kits are typically configured to expose 2 VCOM serial ports as CDC-UART USB devices on the main (interface MCU) USB connector.

The main nRF5340 SoC on the nRF5340 DK has its own USB interface and the corresponding USB connector (J3) that can also expose (USB) serial ports as CDC-UART USB devices. The Emcraft Zephyr application enables the appropriate USB device to support this feature.

2. Identifying Development Kits and VCOM Serial Ports

  1. Usenrfutil to list all connected development kits, their serial numbers and associated serial ports:

    $ nrfutil device list
    1050021575
    product         J-Link
    board version   PCA10095
    ports           /dev/ttyACM2, vcom: 0
                    /dev/ttyACM3, vcom: 1
    traits          devkit, jlink, seggerUsb, serialPorts, usb
    1050931892
    product         J-Link
    board version   PCA10153
    ports           /dev/ttyACM0, vcom: 0
                    /dev/ttyACM1, vcom: 1
    traits          boardController, devkit, jlink, modem, seggerUsb, serialPorts, usb
    Found 2 supported device(s)
    
  2. Use nrfutil to identify the specific devices:

    $ nrfutil device device-info --serial-number 1050931892
    serial_number: 001050931892
    	boardVersion: PCA10153
    	deviceFamily: NRF91_FAMILY
    	deviceVersion: NRF9161_xxAA_REV3
    	jlinkObFirmwareVersion: J-Link OB-nRF5340-NordicSemi compiled Apr 11 2024 17:44:26
    	protectionStatus: NRFDL_PROTECTION_STATUS_NONE
    $ nrfutil device device-info --serial-number 1050021575
    serial_number: 001050021575
    	boardVersion: PCA10095
    	deviceFamily: NRF53_FAMILY
    	deviceVersion: NRF5340_xxAA_ENGD
    	jlinkObFirmwareVersion: J-Link OB-nRF5340-NordicSemi compiled Apr 11 2024 17:44:26
    	protectionStatus: NRFDL_PROTECTION_STATUS_NONE
  3. dmesg can also be used to identify the VCOM serial ports:

    $ sudo dmesg
    ...
    [1198894.160703] usb 1-2.2: new full-speed USB device number 9 using uhci_hcd
    [1198894.576542] usb 1-2.2: New USB device found, idVendor=1366, idProduct=1059, bcdDevice= 1.00
    [1198894.576550] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [1198894.576553] usb 1-2.2: Product: J-Link
    [1198894.576564] usb 1-2.2: Manufacturer: SEGGER
    [1198894.576567] usb 1-2.2: SerialNumber: 001050931892
    [1198894.589375] cdc_acm 1-2.2:1.0: ttyACM0: USB ACM device
    [1198894.596846] cdc_acm 1-2.2:1.2: ttyACM1: USB ACM device
    ...
    [1199003.499651] usb 1-2.3: new full-speed USB device number 10 using uhci_hcd
    [1199003.721099] usb 1-2.3: New USB device found, idVendor=1366, idProduct=1051, bcdDevice= 1.00
    [1199003.721125] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [1199003.721137] usb 1-2.3: Product: J-Link
    [1199003.721146] usb 1-2.3: Manufacturer: SEGGER
    [1199003.721154] usb 1-2.3: SerialNumber: 001050021575
    [1199003.744604] cdc_acm 1-2.3:1.0: ttyACM2: USB ACM device
    [1199003.752999] cdc_acm 1-2.3:1.2: ttyACM3: USB ACM device
    ...

3. Identifying USB Serial Ports of nRF5340

Use dmesg to identify the USB Serial Ports exposed on the J3 USB connector by the main nRF5340 SoC of the nRF5340 DK:

$ sudo dmesg
...
[83484.658759] usb 1-2.4: new full-speed USB device number 46 using uhci_hcd
[83484.979567] usb 1-2.4: New USB device found, idVendor=2fe3, idProduct=0001, bcdDevice= 3.04
[83484.979584] usb 1-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[83484.979590] usb 1-2.4: Product: Zephyr USBD ACM console
[83484.979601] usb 1-2.4: Manufacturer: ZEPHYR
[83484.979606] usb 1-2.4: SerialNumber: 172430EEEFC6BEFD
[83484.988087] cdc_acm 1-2.4:1.0: ttyACM4: USB ACM device
...

Note that the CDC-ACM USB device is disconnected and connected again on every reset of the nRF5340 SoC.

4. Serial Console of the nRF9161

The nRF9161 serial console is available on the VCOM0 serial port of the nRF9161 DK. Connect to it using a terminal program on your Linux PC:

picocom -b 115200 /dev/ttyACM0

After the Thingy-9151-Lite application image is programmed to the target board, reset the board and observe the Zephyr banner and shell on the serial console:

*** Booting nRF Connect SDK v2.5.1-5-gb2bb1a280782 ***
[00:00:00.254,577] <inf> app: Start thingy9151lite_nrf9151_app v98.98-14-release on nrf9161dk_nrf9161
uart:~$

5. Serial Console of the nRF5340 Application Core

The nRF5340 (application core) serial console is available on the USB serial port of the nRF5340. Connect to it using a terminal program on your Linux PC:

picocom -b 115200 /dev/ttyACM4

This serial console can be re-directed to the standard VCOM1 serial port by changing the board overlay file (thingy9151lite_nrf5340_cpuapp_app/boards/nrf5340dk_nrf5340_cpuapp_ns.overlay):

/ {
        chosen {
//              zephyr,console = &cdc_acm_uart0;
//              zephyr,shell-uart = &cdc_acm_uart0;
        };
};

Connect to it using a terminal program on your Linux PC:

picocom -b 115200 /dev/ttyACM3

After the Thingy-9151-Lite application image is programmed to the target board, reset the board and observe the Zephyr banner and shell on the serial console:

*** Booting nRF Connect SDK v2.5.1-5-gb2bb1a280782 ***
[00:00:00.251,098] <inf> app: Start thingy9151lite_nrf5340_cpuapp_app v98.98-14-release on nrf5340dk_nrf5340_cpuapp
uart:~$

6. Serial Console of the nRF5340 Network Core

The nRF5340 (network core) serial console is available on the VCOM0 serial port of the nRF5340 DK. Connect to it using a terminal program on your Linux PC:

picocom -b 115200 /dev/ttyACM2

After the Thingy-9151-Lite application image is programmed to the target board, reset the board and observe the Zephyr banner on the serial console:

*** Booting nRF Connect SDK v2.5.1-5-gb2bb1a280782 ***
[00:00:00.000,701] <inf> app: Start thingy9151lite_nrf5340_cpunet_app v98.98-14-release on nrf5340dk_nrf5340_cpunet

The nRF5340 Network Core application only provides logging output to the console, as the Zephyr shell is disabled in the project configuration.

7. Using Zephyr Shell

The Thingy-9151-Lite software is configured to run the Zephyr interactive shell command interfaces, in the serial consoles for all the MCU’s.

Most of the standard Zephyr shell features are available, such as the auto-completion, command history, etc.

Various Zephyr shell commands are enabled:

uart:~$ kernel
kernel - Kernel commands
Subcommands:
  cycles     :Kernel cycles.
  reboot     :Reboot.
  stacks     :List threads stack usage.
  threads    :List kernel threads.
  version    :Kernel version.
  sleep      :ms
  log-level  :<module name> <severity (0-4)>
uart:~$ device
device - Device commands
Subcommands:
  list  :List configured devices
uart:~$
  • No labels