nrf9160 dk not responding to at commands from external mcu over uart

Hello,

I am trying to connect the nrf9160 dk with the SLM application to our STM32.

The idea is to use the nrf9160 modem to connect to NB-IoT/LTE-M and control the modem by sending AT commands from the stm32 over a UART connection.

I have changed the nrf9160dk_nrf9160_ns.conf and the nrf9160dk_nrf9160_ns.overlay according to this description.

I have connected our board to Pins P0.11 and P0.10, but I can't seem to get any kind of response over UART from the DK.

The oscilloscope shows that the AT commands arrive at P0.11 but no kind of transmission coming back from P0.10.

I have also tried sending commands with Putty over a serial USB but it has the same problem.

I was hoping I could use the nrf Connect debug function in VS Code to figure out what the DK is receiving but that did not seem to work at all. It's not stopping at any breakpoints, not even the one in the first line of the main method although I've enabled the debug options in the build configuration.

I'm a little lost here what else I could try and would be grateful for any ideas!

(I'm using the nrf Connect SDK v2.1.2)

  • Hello,

    Can you please send the configuration files? We also need to look at the RTT log to see if the modem receives any data. You need to set CONFIG_SLM_LOG_LEVEL_DBG = y to get the RTT log.  

    Thanks.

    Best Regards,

    Kazi Afroza Sultana

  • Hello,

    sorry for the late reply.

    Here is the proj.conf: 

     

    #
    # Copyright (c) 2020 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    # General config
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_STACK_SENTINEL=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_RING_BUFFER=y
    
    # Segger RTT
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_NATIVE=n
    
    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    # Align the max FD entry to NRF_MODEM_MAX_SOCKET_COUNT(8)
    CONFIG_POSIX_MAX_FDS=8
    # Enable below for modem trace
    #CONFIG_NRF_MODEM_LIB_TRACE=y
    # Handle modem fault
    CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y
    
    # Use GPIO
    CONFIG_GPIO=y
    CONFIG_GPIO_NRFX=y
    
    # UART interface
    CONFIG_SERIAL=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_TIMER2=y
    
    # Stacks and heaps
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_AT_MONITOR_HEAP_SIZE=4096
    
    # Device power management
    CONFIG_PM_DEVICE=y
    
    # FOTA
    CONFIG_HTTP_PARSER_URL=y
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
    CONFIG_DFU_TARGET=y
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_IMG_MANAGER=y
    
    # FLASH
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # Settings
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_FCB=y
    CONFIG_FCB=y
    
    # nRF Cloud
    #CONFIG_NRF_CLOUD_IPV6=y
    CONFIG_NRF_CLOUD_MQTT=y
    CONFIG_NRF_CLOUD_FOTA=n
    CONFIG_NRF_CLOUD_AGPS=y
    CONFIG_NRF_CLOUD_AGPS_FILTERED=n
    CONFIG_NRF_CLOUD_PGPS=y
    CONFIG_NRF_CLOUD_LOCATION=y
    CONFIG_NRF_CLOUD_LOG_LEVEL_INF=y
    CONFIG_NRF_CLOUD_GPS_LOG_LEVEL_INF=y
    CONFIG_DATE_TIME=y
    CONFIG_MODEM_INFO=y
    CONFIG_MODEM_INFO_ADD_DATE_TIME=n
    CONFIG_AT_MONITOR=y
    CONFIG_MODEM_JWT=y
    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y
    
    #
    # SLM-specific configurations
    #
    CONFIG_SLM_CUSTOMIZED=n
    CONFIG_SLM_LOG_LEVEL_INF=y
    #CONFIG_SLM_LOG_LEVEL_DBG = y
    CONFIG_SLM_EXTERNAL_XTAL=n
    CONFIG_SLM_START_SLEEP=n
    CONFIG_SLM_DATAMODE_URC=n
    
    # nRF Cloud based location services
    CONFIG_SLM_AGPS=n
    CONFIG_SLM_PGPS=n
    CONFIG_SLM_CELL_POS=n
    
    # Serial DFU support
    CONFIG_SLM_NRF52_DFU=n
    CONFIG_SLM_NRF52_DFU_LEGACY=n
    

    the nrf9160dk_nrf9160_ns.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_SLM_CONNECT_UART_0=y
    #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_SLM_CONNECT_UART_2=y
    CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
    CONFIG_UART_2_NRF_HW_ASYNC=y
    CONFIG_SLM_WAKEUP_PIN=31
    CONFIG_SLM_INDICATE_PIN=30
    

    and the nrf9160dk_nrf9160_ns.overlay:

     

    /*
     * Copyright (c) 2021 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    &uart0 {
    	status = "disabled";
    };
    
    &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 {
    	uart2_default_alt: uart2_default_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 10)>,
    				<NRF_PSEL(UART_RX, 0, 11)>;
    				//<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, 10)>,
    				<NRF_PSEL(UART_RX, 0, 11)>;
    				//<NRF_PSEL(UART_RTS, 0, 12)>,
    				//<NRF_PSEL(UART_CTS, 0, 13)>;
    			low-power-enable;
    		};
    	};
    };
    

    I have upgraded to the nrf Connect SDK v2.2.0.-rc1 and created a new build configuration with debug configurations turned off because that enabled me to start a debugging session like in this thread.

    This was the RTT output:

    I tried to insert CONFIG_SLM_LOG_LEVEL_DBG = y in the proj.conf file, however, if I do the project fails to compile.

    Building serial_lte_modem
    west build --build-dir c:\Nordic\examplePojects\serial_lte_modem\build c:\Nordic\examplePojects\serial_lte_modem
    
    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/Nordic/examplePojects/serial_lte_modem
    -- Found Python3: C:/ncs/toolchains/v2.2.0-rc1/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
    -- Cache files will be written to: C:/ncs/v2.2.0-rc1/zephyr/.cache
    -- Zephyr version: 3.2.99 (C:/ncs/v2.2.0-rc1/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf9160dk_nrf9160_ns, Revision: 0.7.0
    -- Found host-tools: zephyr 0.15.1 (C:/ncs/toolchains/v2.2.0-rc1/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.1 (C:/ncs/toolchains/v2.2.0-rc1/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v2.2.0-rc1/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns.dts
    -- Found devicetree overlay: C:/Nordic/examplePojects/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.overlay
    -- Generated zephyr.dts: C:/Nordic/examplePojects/serial_lte_modem/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Nordic/examplePojects/serial_lte_modem/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Nordic/examplePojects/serial_lte_modem/build/zephyr/dts.cmake
    
    warning: Experimental symbol HTTP_CLIENT is enabled.
    
    
    C:/Nordic/examplePojects/serial_lte_modem/prj.conf:97: warning: attempt to assign the value ' y' to the undefined symbol SLM_LOG_LEVEL_DBG 
    Parsing C:/Nordic/examplePojects/serial_lte_modem/Kconfig
    Loaded configuration 'C:/ncs/v2.2.0-rc1/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns_defconfig'
    Merged configuration 'C:/Nordic/examplePojects/serial_lte_modem/prj.conf'
    Merged configuration 'C:/Nordic/examplePojects/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf'
    
    error: Aborting due to Kconfig warnings
    
    CMake Error at C:/ncs/v2.2.0-rc1/zephyr/cmake/modules/kconfig.cmake:328 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      C:/ncs/v2.2.0-rc1/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
      C:/ncs/v2.2.0-rc1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.2.0-rc1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
      CMakeLists.txt:9 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Nordic/examplePojects/serial_lte_modem/build/CMakeFiles/CMakeOutput.log".
    See also "C:/Nordic/examplePojects/serial_lte_modem/build/CMakeFiles/CMakeError.log".
    FAILED: build.ninja 
    C:\ncs\toolchains\v2.2.0-rc1\opt\bin\cmake.exe --regenerate-during-build -SC:\Nordic\examplePojects\serial_lte_modem -BC:\Nordic\examplePojects\serial_lte_modem\build
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.2.0-rc1\opt\bin\cmake.EXE' --build 'c:\Nordic\examplePojects\serial_lte_modem\build'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

  • I just realized my mistake was that I forgot to remove the spaces in CONFIG_SLM_LOG_LEVEL_DBG = y. That's why it did not compile. Now the RTT output is this:

  • Yes. There was a space after CONFIG_SLM_LOG_LEVEL_DBG this. What line endings you have used?

  • I have tried different combinations of CR and LF. The only reaction I sometimes get is this warning <wrn> slm_at_host: RX_STOPPED (4) but I cannot find a pattern that triggers it. In this screenshot it appeared after the last command I send.

Related