Communication Between NRF9160 and Nucleo Board Using SLM Example

Hello everyone,

I've successfully implemented the SLM example on the NRF9160, and it's functioning properly. Now, I'm attempting to send AT commands to the modem using my Nucleo board. I've disabled hardware flow control in the Nucleo configuration as well as in the SLM example configuration. Additionally, I've added the following code to the interrupt handler of the Nucleo board. While I can observe "Ready" on the RX of the Nucleo board, I'm not receiving any replies when I send AT\r\n to the modem. Could someone please assist me in resolving this issue?

Overlay:

/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */
 / {
    chosen {
             ncs,slm-uart = &uart2;
           };
  };

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

&uart0 {
	status = "disabled";
	hw-flow-control;
};

&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";
};

&pinctrl {
	uart2_default_alt: uart2_default_alt {
		group1 {
			psels = <NRF_PSEL(UART_RX, 0, 11)>;
			bias-pull-up;
		};
		group2 {
			psels = <NRF_PSEL(UART_TX, 0, 10)>,
				<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;
		};
	};
};


&spi3 {
	status = "disabled";
};

&i2c2 {
	status = "disabled";
};

prg config: 

#
# 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_PICOLIBC_IO_FLOAT=y
CONFIG_RING_BUFFER=y

# Segger RTT
CONFIG_USE_SEGGER_RTT=y
# Where console messages (printk) are output.
# By itself, SLM does not output any.
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
# Where SLM logs are output.
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

# 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_USE_RUNTIME_CONFIGURE=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_DOWNLOAD_CLIENT_MAX_FILENAME_SIZE=2048
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y

# FLASH
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# Settings
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y
CONFIG_NVS=y

# nRF Cloud
CONFIG_NRF_CLOUD_IPV6=n
CONFIG_NRF_CLOUD_MQTT=y
CONFIG_NRF_CLOUD_FOTA=n
CONFIG_NRF_CLOUD_AGNSS=y
CONFIG_NRF_CLOUD_AGNSS_FILTERED=n
CONFIG_NRF_CLOUD_PGPS=n
CONFIG_NRF_CLOUD_LOCATION=y
CONFIG_NRF_CLOUD_LOG_LEVEL_INF=y
CONFIG_NRF_CLOUD_GPS_LOG_LEVEL_INF=y
CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y
CONFIG_NRF_CLOUD_WIFI_LOCATION_ENCODE_OPT_MAC_RSSI=y
CONFIG_DATE_TIME=y
CONFIG_MODEM_INFO=y
CONFIG_MODEM_INFO_ADD_DATE_TIME=n

# UUID and JWT
CONFIG_MODEM_JWT=y

# MQTT client
#CONFIG_MQTT_KEEPALIVE=60
CONFIG_MQTT_CLEAN_SESSION=y

# AT command helper libraries
CONFIG_AT_CMD_PARSER=y
CONFIG_AT_MONITOR=y

#
# SLM-specific configurations
#
CONFIG_SLM_CUSTOMER_VERSION=""
CONFIG_SLM_EXTERNAL_XTAL=n
CONFIG_SLM_START_SLEEP=n
CONFIG_SLM_DATAMODE_URC=n

# debug options
#CONFIG_ASSERT=y
#CONFIG_LOG_BUFFER_SIZE=16384
CONFIG_SLM_LOG_LEVEL_DBG=y
#CONFIG_LOG_PRINTK=n
#CONFIG_LOG_MODE_IMMEDIATE=y

# For using external GNSS antenna
#CONFIG_MODEM_ANTENNA=y
#CONFIG_MODEM_ANTENNA_GNSS_EXTERNAL=y
CONFIG_SLM_CR_TERMINATION=y

RTT output: 

Nucelo IRQ Handler: 

  • Hello, 

    Looking at your setup, I can't see that you have enabled the following KConfig options:

    # 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_POWER_PIN=31
    CONFIG_SLM_INDICATE_PIN=30

    Please see the Connecting with an external MCU documentation.

    Kind regards,
    Øyvind

  • Hi  it's done before in nrf9160dk_nrf9160_ns.conf as below: 

    #
    # 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_POWER_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_POWER_PIN=31
    CONFIG_SLM_INDICATE_PIN=30
    

    But still I can't communicate with modem.

  • Hi, 

    Do you have a logic analyzer to use in your debugging? It could help debug the communication lines. That said, our Serial LTE Modem team tested on their side and inform me that you might need to disable CONFIG_SPI_NOR

    Further points to follow up with:

    • Are the voltages set correctly? NRF9160DK voltage can be changed with VDD IO switch (SW9).
    • Do you see an incoming AT-command with SLM RTT traces? To check whether AT-command is received, CONFIG_SLM_LOG_LEVEL_DBG=y should be set. Then RTT-traces will show if the command is received in SLM and if the response is sent.
      • If no, concentrate on TX:
        • Is the wiring correct between Nucleo TX and 9160 RX?
        • Can they send the AT-message to 9160 when they are not in the interrupt handler?
      • If yes, concentrate on RX:
        • Are they receiving something to UART1_IRQHandler when \r\n\OK\r\n should come?
    • Other noted things:

    • NRF SDK version is 3.5.99-ncs1, which seems odd as we are currently in 2.6.99. Might be Zephyr version.
    • CONFIG_SLM_CR_TERMINATION=y is used but CR_LF sending is still used.
    • UART2 is chosen twice.
    • The OK response is actually \r\nOK\r\n. Depending on how the UART_ReceiveString is implemented, this could explain things. 
    • It is also worth noting, that LL_USART_ReceiveData8 is used inside IRQ handler to get data one byte at a time and UART_ReceiveString is called inside it. Does the interrupt handler process data instead of the intended method? The OK response does not differ from the Ready as both come through UART.
      • If we are on the interrupt handler for UART, it is also possible that sending through UART is not allowed at that point.

    What application are you running on the Nucleo side? Have you tested with our SLM Shell sample? Our developers point out that they got the sample to work with exact settings they are using  and the disablement of the CONFIG_SPI_NOR.

    Kind regards,
    Øyvind

Related