You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/app/sm_cellular_modem.rst
+71-33Lines changed: 71 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ PPP and CMUX
29
29
:alt:CMUX multiplexes AT and PPP over one UART.
30
30
:align:center
31
31
32
-
CMUX multiplexes AT (DLC1) and PPP (DLC2) over one UART.
32
+
CMUX multiplexes AT and PPP over one UART using separate DLC channels.
33
33
34
34
|SM| supports PPP both with or without CMUX (GSM 07.10 multiplexing).
35
35
This allows you to choose the setup that best fits your use case.
@@ -39,38 +39,47 @@ PPP without CMUX
39
39
================
40
40
41
41
Without CMUX, PPP runs on the current UART.
42
-
Once PPP starts, the UART is in PPP data mode and cannot be used for AT commands until PPP is terminated.
43
-
This also means that no more AT notifications are delivered over that UART while PPP is active.
42
+
Send ``AT+CFUN=1`` to activate the modem, then ``AT+CGDATA`` to start PPP.
43
+
The modem responds with ``CONNECT`` and the UART immediately enters PPP data mode.
44
+
You cannot use the UART for AT commands until PPP is terminated by LCP negotiation.
45
+
No AT notifications are delivered over the UART while PPP is active.
44
46
45
47
Example
46
48
-------
47
49
48
50
Switching UART from AT mode to PPP mode and back:
49
51
50
52
.. figure:: ../images/ppp-uart-sequence.svg
51
-
:alt:PPP session without CMUX.
53
+
:alt:PPP session without CMUX using AT+CGDATA.
52
54
:align:center
53
55
54
56
PPP session without CMUX.
55
57
58
+
.. _ppp_with_cmux:
59
+
56
60
PPP with CMUX
57
61
=============
58
62
59
63
With CMUX, AT traffic and PPP traffic can share a single UART by using separate CMUX channels.
60
64
61
-
By default, |SM| uses the AT channel on DLC channel 1 and PPP on DLC channel 2.
62
-
If you want PPP on DLC channel 1, start CMUX with ``AT#XCMUX=2`` before starting PPP. This moves the AT-channel to DLC channel 2.
65
+
Start CMUX with ``AT+CMUX=0``, then issue ``AT+CGDATA`` on the chosen DLC channel to start PPP on that channel.
66
+
The following example uses DLC channel 1 for PPP and DLC channel 2 for AT commands, with ``AT#XCMUXURC=2`` directing URCs to DLC channel 2.
63
67
64
68
Example
65
69
-------
66
70
67
-
Start CMUX, then start PPP on DLC channel 2 while keeping AT on DLC channel 1:
71
+
Send ``AT#XCMUXURC=2`` to route URCs to DLC channel 2, start CMUX with ``AT+CMUX=0``, then start PPP on DLC channel 1 using ``AT+CGDATA``:
68
72
69
73
.. figure:: ../images/ppp-cmux-sequence.svg
70
-
:alt:PPP session with CMUX showing split into DLC1 (AT) and DLC2 (PPP).
74
+
:alt:PPP session with CMUX showing DLC1 (PPP) and DLC2 (AT), with URCs routed to DLC2.
71
75
:align:center
72
76
73
-
PPP session with CMUX.
77
+
PPP on DLC1, AT commands and URCs on DLC2.
78
+
79
+
.. note::
80
+
81
+
The ``AT#XCMUXURC=2`` is optional, but it is recommended to route URCs to a static channel.
82
+
When the URC channel is not selected, URCs are sent to the first open AT channel, which is not in data mode.
74
83
75
84
76
85
Use case: Linux host
@@ -109,15 +118,16 @@ Option A: PPP over CMUX (recommended)
109
118
=====================================
110
119
111
120
|SM| provides start and stop scripts for Linux in the application's :file:`scripts` directory.
121
+
The :file:`sm2_start_ppp.sh` script uses standard 3GPP AT commands (``AT+CMUX`` and ``AT+CGDATA``) and is the recommended way to establish a PPP connection over CMUX.
112
122
If needed, adjust the serial port settings with command line parameters.
113
-
Run ``sm_start_ppp.sh -h`` to see all available options.
123
+
Run ``sm2_start_ppp.sh -h`` to see all available options.
114
124
Default settings assume that the modem is available at ``/dev/ttyACM0`` with a baud rate of ``115200``.
115
125
116
126
1. Start the connection (requires superuser privileges for PPPD and CMUX):
$ sudo pppd noauth <UART_dev> <baud_rate> local crtscts debug noipdefault connect "/usr/sbin/chat -v -t60 '' AT+CFUN=1 OK AT+CGDATA CONNECT" nodetach
160
170
161
171
Replace ``<UART_dev>`` by the device file assigned to the Serial Modem's UART and ``<baud_rate>`` by the baud rate of the UART.
162
172
Typically, the device file assigned to it is :file:`/dev/ttyACM0` for an nRF9151 DK.
@@ -176,8 +186,8 @@ This setup is useful for quick testing, but the UART cannot be used for AT comma
176
186
177
187
#. Terminate the PPP connection with CTRL+C in the terminal where ``pppd`` is running or ``sudo poff`` in another terminal.
178
188
179
-
Use case: Zephyr host (Zephyr-compatible modem)
180
-
***********************************************
189
+
Use case: Zephyr host
190
+
*********************
181
191
182
192
This section describes how to use |SM| as a modem that is controlled by Zephyr's cellular modem driver.
183
193
The controlling chip runs a Zephyr application, which uses Zephyr's native IP stack.
@@ -192,19 +202,18 @@ The controlling chip runs a Zephyr application, which uses Zephyr's native IP st
192
202
* Power saving feature requires UART with DTR and RI pins connected between the controlling chip and the SiP.
193
203
See :ref:`uart_configuration` for more information.
194
204
* System mode is not configured. See the `%XSYSTEMMODE`_ command in the AT command Reference Guide for more details.
195
-
* The Zephyr cellular modem driver is written with the expectation that the PPP session starts on the DLC channel used for AT commands, which is DLC channel 1 by default.
196
205
197
206
Example
198
207
=======
199
208
200
-
The Zephyr modem driver requires the AT channel and PPP channel to be switched so that the PPP starts at DLC channel 1, while the AT channel is moved to DLC channel 2.
201
-
This is achieved by starting CMUX with ``AT#XCMUX=2`` before the network is attached and starting the PPP.
209
+
The Zephyr modem driver sends ``AT+CMUX=0`` to start the CMUX, then uses DLC channel 1 for AT commands and DLC channel 2 for PPP.
210
+
The dial script issues ``AT+CGDATA`` on DLC channel 2, which starts PPP on that channel and leaves DLC channel 1 free for AT commands and URCs.
202
211
203
212
.. figure:: ../images/ppp-zephyr-sequence.svg
204
-
:alt:PPP session with CMUX showing Zephyr host control.
213
+
:alt:PPP session with CMUX using standard AT+CMUX and AT+CGDATA commands from a Zephyr host.
205
214
:align:center
206
215
207
-
The Zephyr modem driver does extra DLC channel switching when starting the PPP session.
216
+
Zephyr modem driver uses DLC1 as the AT command channel and starts PPP on DLC2 using AT+CGDATA.
208
217
209
218
Configuration
210
219
=============
@@ -231,6 +240,28 @@ In particular:
231
240
* :file:`boards/nrf54l15dk_nrf54l15_cpuapp.overlay` - Configure UART (pins, baud rate), DTR and RI pins used between the MCU and the SiP.
232
241
233
242
Depending on your hardware, a devicetree overlay is needed to describe the modem UART and power control pins.
243
+
The modem node in the overlay must use ``compatible = "nordic,nrf91-sm-v2"`` to select the |SM| modem driver:
The ``nordic,nrf91-sm-v2`` binding is compatible with |SM| application v2.0.0 and later.
234
265
Devicetree settings also control the CMUX power-saving behavior.
235
266
236
267
Flashing and running
@@ -241,9 +272,10 @@ When the Zephyr's modem driver starts up, it will perform the following steps:
241
272
242
273
* Enable the UART interface.
243
274
* Enable notifications and query modem information.
244
-
* Enable CMUX.
275
+
* Configure URCs to DLC channel 1 with ``AT#XCMUXURC=1``.
276
+
* Enable CMUX with ``AT+CMUX=0``.
245
277
* Set the modem to normal mode with ``AT+CFUN=1``.
246
-
* Start PPP.
278
+
* Start PPP on DLC channel 2 with ``AT+CGDATA``.
247
279
248
280
The Zephyr host can then use standard Zephyr networking APIs to use the PPP link for network communication.
249
281
Only exception for normal network interfaces is that the PPP interface cannot be automatically started at boot.
@@ -254,23 +286,29 @@ You must start the PPP interface manually when required.
254
286
struct net_if *ppp_iface = net_if_get_default();
255
287
net_if_up(ppp_iface);
256
288
289
+
Using legacy nrf91-slm Zephyr driver
290
+
====================================
291
+
292
+
Zephyr provides an older upstream cellular modem driver that uses ``compatible = "nordic,nrf91-slm"``.
293
+
It was developed for the Serial LTE Modem (SLM) sample application and is not recommended for new designs.
294
+
295
+
Unlike the ``nordic,nrf91-sm-v2`` driver, the legacy ``nrf91-slm`` driver uses the proprietary ``AT#XCMUX=2`` command to switch the AT command channel to DLC channel 2 at runtime and ``AT#XPPP=1`` to allow PPP to start automatically on the secondary DLC channel.
296
+
This approach is unreliable in various recovery scenarios, because PPP startup and AT channel switching might run out of sync, leading to a loss of AT control.
:alt:Legacy PPP session with CMUX using AT#XCMUX=1 and AT#XCMUX=2 commands from a Zephyr host.
300
+
:align:center
301
+
302
+
Legacy ``nrf91-slm`` driver starts CMUX using ``AT#XCMUX=1``, then uses ``AT#XCMUX=2`` to switch the AT channel to DLC2 and starts PPP on DLC1.
303
+
257
304
Operational notes
258
305
*****************
259
306
260
307
* nRF91 Series SiP automatically activates the default PDP context.
261
308
Manually configuring the APN is typically not required.
262
309
263
310
* nRF91 Series SiP automatically restarts a network scan when connectivity is lost.
264
-
Manual dial-up scripts are typically not required for recovery.
265
-
266
-
* |SM| uses only one AT channel.
267
-
Therefore, the controlling chip must use only one CMUX channel for AT commands and notifications.
268
-
269
-
* CMUX channel allocation (by default, allocating DLC channel 1 to PPP and DLC channel 2 to AT) is controlled by ``AT#XCMUX``.
270
-
See :ref:`SM_AT_CMUX` for details.
271
-
272
-
* PPP link start/stop behavior and recovery from network loss depend on how PPP is configured and which CMUX channel is used.
273
-
See :ref:`SM_AT_PPP` for the ``#XPPP`` status notification format and PPP termination behavior.
311
+
Manual dial-up scripts are typically not required for LTE connection recovery.
274
312
275
-
* You might encounter a packet domain event (``+CGEV: IPV6 FAIL 0``) indicating a failure in obtaining an IPv6 address.
276
-
You can ignore this since not all carriers provide IPv6 address for default PDN.
313
+
* When you use the proprietary ``AT#XCMUX=1`` and ``AT#XPPP=1`` commands, CMUX channel allocation is static (by default, allocating DLC channel 1 to PPP and DLC channel 2 to AT).
314
+
See :ref:`SM_AT_CMUX` and :ref:`SM_AT_PPP` for details.
0 commit comments