Modem SLM

The Modem SLM library exposes the AT command interface of the Serial LTE Modem application for external devices over a serial interface. This library is for applications running on external MCU that is built with nRF Connect SDK and is connected to an nRF91 Series SiP through UART.

Overview

The Modem SLM library allows you to perform the following functions:

  • Manage the serial interface so that the application only decides which UART device to use and configures its DTS.

  • Manage the GPIO pins, with support for bidirectional indication and power pin.

  • Send modem or SLM proprietary AT commands, receive responses and notifications, similar to the AT Host library. Received AT responses or notifications can be parsed by the AT parser library.

  • Send raw data in SLM data mode. Refer to Running in data mode.

  • Monitor AT notifications with registered callbacks, similar to the AT monitor library.

  • Send AT commands through UART or RTT shell, similar to the AT shell library.

Configuration

The library is enabled and configured entirely using the Kconfig system.

Configure the following Kconfig options to enable this library:

Optionally configure the following Kconfig options based on need:

The application must use Zephyr chosen nodes in devicetree to select UART device. Additionally, GPIO can also be selected. For example:

/ {
   chosen {
      ncs,slm-uart = &uart1;
      ncs,slm-gpio = &gpio0;
   };
};

Use one of the following options to select the termination character:

You must configure the same termination character as that configured in SLM on the nRF91 Series SiP. The library sends the termination character automatically after an AT command.

Shell usage

SLM

Send AT commands for SLM in shell:

uart:~$ slm AT%XPTW=4,\"0001\"

OK

uart:~$ slm at%ptw?

%XPTW: 4,"0001"
%XPTW: 5,"0011"

OK

SLM accepts AT command characters in upper, lower, or mixed case.

Host

Use slmsh command to see commands for the Modem SLM library functions.

Request toggling of the power pin from the Modem SLM library to put the SLM device to sleep and then wake it up:

uart:~$ slmsh powerpin
[00:00:17.973,510] <inf> mdm_slm: Enable power pin
[00:00:18.078,887] <inf> mdm_slm: Disable power pin

uart:~$ slmsh powerpin
[00:00:33.038,604] <inf> mdm_slm: Enable power pin
[00:00:33.143,951] <inf> mdm_slm: Disable power pin
Ready

[00:00:34.538,513] <inf> app: Data received (len=7): Ready
uart:~$

SLM Monitor usage

The SLM Monitor has similar functions to the AT monitor library, except “Direct dispatching”.

SLM_MONITOR(network, "\r\n+CEREG:", cereg_mon);

API documentation

Header file: include/modem/modem_slm.h
Source file: lib/modem_slm/modem_slm.c
Source file: lib/modem_slm/modem_slm_monitor.c
Modem SLM library