nRF9160 SLM with Zephyr native_sim on linux

Hi,

We develop functionalities on native_sim before moving to embedded, therefore I am trying to have nRF9160 modem connected to Zephyr "cellular_modem" sample on linux native_sim.

I compiled "serial_lte_modem" with "west build -b nrf9160dk/nrf9160/ns -p -- -DEXTRA_CONF_FILE=overlay-ppp-cmux-linux.conf && west flash" (v3.0.2). I had to remove "hw-flow-control" on uart0 to have the communication. The modem is connected to developer's PC with USB (nRF9160 DK board). It answers communication, connects to APN - all OK.

The "cellular_modem" sample is from Zephyr source (not nrf, although diff does not show differences related to the issue). This native_sim app, uses DTS uart_1 as "zephyr,native-pty-uart" with modem on it and uart_1 is showing as PTY on linux.

/ {
	aliases {
		modem = &modem;
	};

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

	uart_1: uart_1 {
		compatible = "zephyr,native-pty-uart";
		current-speed = <115200>;
		status = "okay";

		modem: modem {
			compatible = "nordic,nrf91-slm";
			status = "okay";
		};
	};
};

The uart_1 where the app is run is then connected with socat to /dev/ACM0. Communication starts, I get AT commands running, but just when CMUX is enabled with AT#XCMUX=1 it stops. No output from app nor from the SLM modem. 

Log from console of the cellular_modem app:

uart connected to pseudotty: /dev/pts/6
uart_1 connected to pseudotty: /dev/pts/7
*** Booting Zephyr OS build v4.1.0-5405-ge571f8bab428 ***
Powering on modem
[00:00:05.010,000] <dbg> modem_cellular: modem_cellular_log_event: event resume
[00:00:05.010,000] <dbg> modem_cellular: modem_cellular_log_state_changed: switch from idle to run init script
[00:00:05.010,000] <dbg> modem_cellular: modem_cellular_log_event: event bus opened
[00:00:05.010,000] <dbg> modem_chat: modem_chat_script_start: running script: nordic_nrf91_slm_init_chat_script
[00:00:05.010,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 0
[00:00:05.010,000] <dbg> modem_chat: modem_chat_script_next: sending: AT
Bring up network interface
Waiting for L4 connected
[00:00:05.070,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.070,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 1
[00:00:05.070,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CFUN=0
[00:00:05.150,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.150,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 2
[00:00:05.150,000] <dbg> modem_chat: modem_chat_script_next: sending: AT%XSYSTEMMODE=1,0,0,0
[00:00:05.210,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.210,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 3
[00:00:05.210,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CFUN=0
[00:00:05.450,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.450,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 4
[00:00:05.450,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CEREG=1
[00:00:05.510,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.510,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 5
[00:00:05.510,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CFUN=1
[00:00:05.610,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.610,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 6
[00:00:05.610,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CMEE=1
[00:00:05.670,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.670,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 7
[00:00:05.670,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CEREG=1
[00:00:05.730,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.730,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 8
[00:00:05.730,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CEREG?
[00:00:05.790,000] <dbg> modem_chat: modem_chat_log_received_command: +CEREG:  1 4
[00:00:05.790,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.790,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 9
[00:00:05.790,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CGSN
[00:00:05.790,000] <dbg> modem_cellular: modem_cellular_log_event: event deregistered
[00:00:05.850,000] <dbg> modem_chat: modem_chat_log_received_command:  351516172759573
[00:00:05.850,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 10
[00:00:05.850,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.850,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 11
[00:00:05.850,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CGMM
[00:00:05.910,000] <dbg> modem_chat: modem_chat_log_received_command:  nRF9160-SICA
[00:00:05.910,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 12
[00:00:05.910,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.910,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 13
[00:00:05.910,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CGMI
[00:00:05.970,000] <dbg> modem_chat: modem_chat_log_received_command:  Nordic Semiconductor ASA
[00:00:05.970,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 14
[00:00:05.970,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:05.970,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 15
[00:00:05.970,000] <dbg> modem_chat: modem_chat_script_next: sending: AT+CGMR
[00:00:06.030,000] <dbg> modem_chat: modem_chat_log_received_command:  mfw_nrf9160_1.3.5
[00:00:06.030,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 16
[00:00:06.030,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:06.030,000] <dbg> modem_chat: modem_chat_script_next: nordic_nrf91_slm_init_chat_script: step: 17
[00:00:06.030,000] <dbg> modem_chat: modem_chat_script_next: sending: AT#XCMUX=1
[00:00:06.090,000] <dbg> modem_chat: modem_chat_log_received_command: OK
[00:00:06.090,000] <dbg> modem_chat: modem_chat_script_stop: nordic_nrf91_slm_init_chat_script: complete
[00:00:06.090,000] <dbg> modem_cellular: modem_cellular_log_event: event script success

(there is 5s delay on start, to allow me to run socat on other terminal)

socat starts with:

socat -v /dev/ttyACM0,raw,echo=0,b115200 /dev/pts/7,raw,echo=0

and shows AT commands and responses (no issues spotted).

Would be grateful for any idea.

Regards

Related