Build Fail when trying to modify SLM application sample

Hello, 

I've been trying to modify the v2.4.0 Serial LTE Modem application sample for my nRF-9160 custom board, in order for it to communicate with our external MCU through UART2 at PO.28/29, while outputting modem trace log through another UART at PO.03/PO.04(From the reply of Nordic AI, I assume the default port of outputting LOG was uart1?).

I haven't change any original code files, but I've copied the "nrf9160dk_nrf9160_ns.conf", "nrf9160dk_nrf9160_ns.overlay" to modify, and also create an extra "open_uart_trace.conf" file.
I add these 3 files as extra Kconfig fragments and extra Devicetree overlays.

However when I build it, it would end up error, and from the build log it seems like there's a conflict about interrupt?

I can't figure out what did I need to do to fix the problem, please could someone help, thanks!

Below are the 3 files and the build Log.

custom_9160.conf

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

# Configuration file for nRF9160DK.
# This file is merged with prj.conf in the application folder, and options
# set here will take precedence if they are present in both files.

# Use UART_0 (when working with PC terminal)
# unmask the following config
#CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
#CONFIG_UART_0_NRF_HW_ASYNC=y
#CONFIG_SLM_WAKEUP_PIN=6
#CONFIG_SLM_INDICATE_PIN=2

# Use UART_2 (when working with external MCU)
# unmask the following config
CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
CONFIG_UART_2_NRF_HW_ASYNC=y
CONFIG_SLM_WAKEUP_PIN=31
CONFIG_SLM_INDICATE_PIN=2

.

custom_9160.overlay
/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

 / {
    chosen {
        ncs,slm-uart = &uart2;
    };
};

&uart0 {
    status = "disabled";
};

&uart1 {
    compatible = "nordic,nrf-uarte";
    current-speed = <230400>;
    status = "okay";

    pinctrl-0 = <&uart1_default_alt>;
    pinctrl-1 = <&uart1_sleep_alt>;
    pinctrl-names = "default", "sleep";
};

&uart2 {
    compatible = "nordic,nrf-uarte";
    current-speed = <115200>;
    status = "okay";
    hw-flow-control;

    pinctrl-0 = <&uart2_default_alt>;
    pinctrl-1 = <&uart2_sleep_alt>;
    pinctrl-names = "default", "sleep";
};

&i2c2 {
    status = "disabled";
};

&pinctrl {
    uart1_default_alt: uart1_default_alt {
        group1 {
            psels = <NRF_PSEL(UART_RX, 0, 3)>;
            bias-pull-up;
        };
        group2 {
            psels = <NRF_PSEL(UART_TX, 0, 4)>;
        };
    };

    uart1_sleep_alt: uart1_sleep_alt {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 4)>,
                <NRF_PSEL(UART_RX, 0, 3)>;
            low-power-enable;
        };
    };

    uart2_default_alt: uart2_default_alt {
        group1 {
            psels = <NRF_PSEL(UART_RX, 0, 28)>;
            bias-pull-up;
        };
        group2 {
            psels = <NRF_PSEL(UART_TX, 0, 29)>,
                <NRF_PSEL(UART_RTS, 0, 12)>,
                <NRF_PSEL(UART_CTS, 0, 13)>;
        };
    };

    uart2_sleep_alt: uart2_sleep_alt {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 29)>,
                <NRF_PSEL(UART_RX, 0, 28)>,
                <NRF_PSEL(UART_RTS, 0, 12)>,
                <NRF_PSEL(UART_CTS, 0, 13)>;
            low-power-enable;
        };
    };
};
.
open_uart_trace.conf
# Segger RTT
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y

# Enable below for modem trace
CONFIG_NRF_MODEM_LIB_TRACE=y

.
====Build Log====
* Executing task: nRF Connect: Generate config nrf9160dk_nrf9160_ns for d:\Nordic\Projects\SLM_v2.4.0

Building SLM_v2.4.0
C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/Nordic/Projects/SLM_v2.4.0/uart_trace d:/Nordic/Projects/SLM_v2.4.0 --pristine --board nrf9160dk_nrf9160_ns -- -DNCS_TOOLCHAIN_VERSION=NONE -DEXTRA_CONF_FILE=Extra_configs/uart_trace.conf;boards/custom_9160_A1_1.conf -DEXTRA_DTC_OVERLAY_FILE=boards/custom_9160_A1_1.overlay -DBOARD_ROOT=d:/nordic/projects/slm_v2.4.0"

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: D:/Nordic/Projects/SLM_v2.4.0
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf9160dk_nrf9160_ns, Revision: 0.7.0
-- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.4.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns.dts
-- Found devicetree overlay: D:/Nordic/Projects/SLM_v2.4.0/boards/nrf9160dk_nrf9160_ns.overlay
-- Found devicetree overlay: boards/custom_9160_A1_1.overlay
-- Generated zephyr.dts: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/zephyr.dts
-- Generated devicetree_generated.h: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/dts.cmake
Parsing D:/Nordic/Projects/SLM_v2.4.0/Kconfig
Loaded configuration 'C:/ncs/v2.4.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns_defconfig'
Merged configuration 'D:/Nordic/Projects/SLM_v2.4.0/prj.conf'
Merged configuration 'D:/Nordic/Projects/SLM_v2.4.0/boards/nrf9160dk_nrf9160_ns.conf'
Merged configuration 'D:/Nordic/Projects/SLM_v2.4.0/Extra_configs/uart_trace.conf'
Merged configuration 'D:/Nordic/Projects/SLM_v2.4.0/boards/custom_9160_A1_1.conf'
Configuration saved to 'D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/.config'
Kconfig header saved to 'D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/include/generated/autoconf.h'

warning: UART_0_NRF_HW_ASYNC (defined at drivers/serial/Kconfig.nrfx:84) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: UART_0_NRF_UARTE (=n), (UART_0_NRF_UART
|| UART_0_NRF_UARTE) (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_0_NRF_HW_ASYNC and/or look up
UART_0_NRF_HW_ASYNC in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: UART_0_NRF_HW_ASYNC_TIMER (defined at drivers/serial/Kconfig.nrfx:103) was assigned the
value '2' but got the value ''. Check these unsatisfied dependencies: UART_0_NRF_HW_ASYNC (=n),
(UART_0_NRF_UART || UART_0_NRF_UARTE) (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_0_NRF_HW_ASYNC_TIMER and/or look up
UART_0_NRF_HW_ASYNC_TIMER in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: LOG_BACKEND_UART (defined at subsys/logging\backends\Kconfig.uart:4) was assigned the value
'y' but got the value 'n'. Check these unsatisfied dependencies: UART_CONSOLE (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_BACKEND_UART and/or look up
LOG_BACKEND_UART in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: Experimental symbol TFTP_LIB is enabled.


warning: Experimental symbol HTTP_CLIENT is enabled.

-- Found GnuLd: c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found version "3.8.2") found components: Interpreter
Changed board to secure nrf9160dk_nrf9160 (NOT NS)

=== child image mcuboot - begin ===
loading initial cache file D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/child_image_preload.cmake
CMake Warning (dev) at D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/child_image_preload.cmake:8 (set):
Syntax error in cmake code at

D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/child_image_preload.cmake:8

when parsing string

C:\ncs\toolchains\31f4403e35\opt\bin\python.exe

Invalid escape sequence \3

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs/v2.4.0/bootloader/mcuboot/boot/zephyr
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf9160dk_nrf9160, Revision: 0.7.0
-- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.4.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160.dts
-- Found devicetree overlay: C:/ncs/v2.4.0/bootloader/mcuboot/boot/zephyr/app.overlay
-- Generated zephyr.dts: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/zephyr/zephyr.dts
-- Generated devicetree_generated.h: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/zephyr/dts.cmake
Parsing C:/ncs/v2.4.0/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.4.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_defconfig'
Merged configuration 'C:/ncs/v2.4.0/bootloader/mcuboot/boot/zephyr/prj.conf'
Merged configuration 'C:/ncs/v2.4.0/nrf/modules/mcuboot/tfm.conf'
Merged configuration 'C:/ncs/v2.4.0/nrf/modules/mcuboot/fih_low_enable.conf'
Merged configuration 'C:/ncs/v2.4.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration 'D:/Nordic/Projects/SLM_v2.4.0/child_image/mcuboot.conf'
Merged configuration 'D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to 'D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/zephyr/.config'
Kconfig header saved to 'D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: lib__libc__common

Excluding target from build.


CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: drivers__console

Excluding target from build.


MCUBoot bootloader key file: C:/ncs/v2.4.0/bootloader/mcuboot/root-ec-p256.pem
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/mcuboot
=== child image mcuboot - end ===

CMake Warning at C:/ncs/v2.4.0/nrf/modules/mcuboot/CMakeLists.txt:310 (message):


---------------------------------------------------------
--- WARNING: Using default MCUBoot key, it should not ---
--- be used for production. ---
---------------------------------------------------------




CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: lib__libc__common

Excluding target from build.


-- Configuring done
-- Generating done
-- Build files have been written to: D:/Nordic/Projects/SLM_v2.4.0/uart_trace
-- west build: building application
[1/396] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr), build: v3.3.99-ncs1
[1/182] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr), build: v3.3.99-ncs1
[172/182] Linking C executable zephyr\zephyr_pre0.elf

[176/182] Linking C executable zephyr\zephyr_pre1.elf

[182/182] Linking C executable zephyr\zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 28546 B 48 KB 58.08%
RAM: 16360 B 32 KB 49.93%
IDT_LIST: 0 GB 2 KB 0.00%
[11/396] Generating ../../tfm/CMakeCache.txt
-- Found Git: C:/ncs/toolchains/31f4403e35/mingw64/bin/git.exe (found version "2.37.3.windows.1")
-- The C compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found version "3.8.2") found components: Interpreter
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Nordic/Projects/SLM_v2.4.0/uart_trace/tfm
[22/396] Performing install step for 'tfm'
-- Install configuration: "MinSizeRel"
[377/396] Linking C executable zephyr\zephyr_pre0.elf

[381/396] Linking C executable zephyr\zephyr_pre1.elf

[383/396] Generating isr_tables.c, isrList.bin
FAILED: zephyr/isr_tables.c zephyr/isrList.bin
cmd.exe /C "cd /D D:\Nordic\Projects\SLM_v2.4.0\uart_trace\zephyr && C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-objcopy.exe --input-target=elf32-littlearm --output-target=binary --only-section=.intList D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/zephyr_pre1.elf isrList.bin && C:\ncs\toolchains\31f4403e35\opt\bin\python.exe C:/ncs/v2.4.0/zephyr/scripts/build/gen_isr_tables.py --output-source isr_tables.c --kernel D:/Nordic/Projects/SLM_v2.4.0/uart_trace/zephyr/zephyr_pre1.elf --intlist isrList.bin --sw-isr-table --vector-table"
gen_isr_tables.py: error: multiple registrations at table_index 9 for irq 9 (0x9)
Existing handler 0x2c7f1, new handler 0x463b3
Has IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?

ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\31f4403e35\opt\bin\cmake.EXE' --build 'd:\Nordic\Projects\SLM_v2.4.0\uart_trace'

* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

  • Hi,

    Are you trying to modify and build the sample for nrf9160dk_nrf9160_ns board target or for your custom board?

    I have reproduced your issue by building SLM sample for nrf9160dk_nrf9160_ns board target in NCS v2.4.0 with your config/overlay files. I will look further into it. I expect to get back to you by the end of next week.

    Best regards,
    Dejan

  • Hi Dejans,

    Yes I am trying to build a firmeare for my custom board. I'm aware that the pins might already assinged for other use on the DK board, but somehow our hardware engineer decide to place them there...

    We've been using that board as  modem for a while, so far it works fine.

    But recently at our new site, we are having a phenomenon thay even if the signal was good (power level is 8 from the response of AT%CONEVAL), the board would periodically response ERROR while we send XSEND command(TCP packet, with data mode).

    The data throughput of device there were about 100 bytes per packet, one packet per 10 second. And the Error would pop up roughly every 24 sends(sometimes less).

    Since error doesn't shows evertime we send XSEND, I assume the syntax was correct, so I am trying to make the 9160 output its LOG for more information about what's happening inside.

  • Hi,

    Can you provide complete application log and modem trace?

    Best regards,
    Dejan

  • Hi Dejans,

    Sorry we do not have the modem trace yet. The environment there doesn't have space for an J-Link and a laptop there. That's the reason I wanna build a slm application that could output trace through another UART while communicating with out external MCU.

    What we have now is the LOG of UART communication between external MCU and nRF-9160. It was separated into files because we logged them through 2 TF card UART logger.

    Also for some unknown reason, the LOG should be way more larger than this since its overnight logging, but this is what we got for now.

    9160 sending to M452(our Nuvoton external MCU):

    9160_to_M452_FILE0000.TXT9160_to_M452_FILE0001.TXT

    M452 sending to 9160

    M452_to_9160_FILE0003.TXT

    Also I am continuing trying to build the slm application, but I noticed that in the description under SLM sample's documnet folder, there's a file named slm_description.rst mentioned:
    """

    To save power, both the console and the output logs over ``UART_0`` are disabled in this application.

    """
    So it seems like the default uart port used to output trace is actually UART 0 instead of UART1?
    I've asked Nordic AI again and this time it also reply the default port is UART 0.
    If this is the case then here comes a new problem that in order to communicate with external MCU, the document says we have to enable UART 2 and disable UART0, but the default UART port used to output trace was UART 0.
    Is this solvable with configuration? Or this could only be solve by going into the codes to modify them?
  • Hi Dejans,

    Information update!

    According to the suggestion from Nordic AI to check the zephyr.dts, I kind of figure out that UART1 was likely to also be assigned to use by "arduino_serial". Guess that might be the reason IRQ error pops when I try to configure UART1.
    (Screenshot was taken "after" I changed the port, so uart1 is now disabled)

    However as I tried to configure the modem trace output port to UART3, it  could successfully build(new extra configure file attached below). But I ends up still receiving trace from one of the virtual port of the DK board instead of the expected PO.03/PO.04.
    custom_9160_A1_1.conf

    custom_9160_A1_1.overlay

    uart_trace.conf

Related