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 wakeup.
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 via 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:
CONFIG_MODEM_SLM
- Enables the Modem SLM library.CONFIG_MODEM_SLM_DMA_MAXLEN
- Configures UART RX EasyDMA buffer size, which is configured to 1024 bytes by default.CONFIG_MODEM_SLM_WAKEUP_PIN
- Configures the mandatory wake-up GPIO, which is not configured by default.CONFIG_MODEM_SLM_WAKEUP_TIME
- Sets the toggle time value in milliseconds for wake-up GPIO, by default 100 ms.
Optionally configure the following Kconfig options based on need:
CONFIG_MODEM_SLM_SHELL
- Enables the shell function in the Modem SLM library, which is not enabled by default.CONFIG_MODEM_SLM_INDICATE_PIN
- Configures the optional indicator GPIO, which is not configured by default.
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:
CONFIG_MODEM_SLM_CR_TERMINATION
- Enables<CR>
as the termination character.CONFIG_MODEM_SLM_LF_TERMINATION
- Enables<LF>
as the termination character.CONFIG_MODEM_SLM_CR_LF_TERMINATION
- Enables<CR+LF>
as the termination character, which is selected by default.
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
To send AT commands in shell, use the following syntax:
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.
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); SLM_MONITOR(download, "\r\n#XDFUGET: 0,", download_mon, MON_PAUSED);
API documentation
include/modem/modem_slm.h
lib/modem_slm/modem_slm.c
lib/modem_slm/modem_slm_monitor.c