|
| 1 | +.. _slm_as_linux_modem: |
| 2 | + |
| 3 | +nRF91 Series SiP as a modem for Linux device |
| 4 | +############################################ |
| 5 | + |
| 6 | +.. contents:: |
| 7 | + :local: |
| 8 | + :depth: 2 |
| 9 | + |
| 10 | +Overview |
| 11 | +******** |
| 12 | + |
| 13 | +You can use the Serial LTE Modem (SLM) application to make an nRF91 Series SiP work as a standalone modem that can be used with a Linux device. |
| 14 | +The Linux device can use a standard PPP daemon and ldattach utility to connect to the cellular network through the nRF91 Series SiP. |
| 15 | + |
| 16 | +The setup differentiates from a typical dial-up modem connection as the GSM 0710 multiplexer protocol (CMUX) is used to multiplex multiple data streams over a single serial port. |
| 17 | +This allows you to use the same serial port for both AT commands and PPP data. |
| 18 | + |
| 19 | +Prerequisites |
| 20 | +============= |
| 21 | + |
| 22 | +The Linux device needs to have the following packages installed: |
| 23 | + |
| 24 | +* pppd from the ppp package |
| 25 | +* ldattach from the util-linux package |
| 26 | + |
| 27 | +These should be available on all standard Linux distributions. |
| 28 | + |
| 29 | +Configuration |
| 30 | +============= |
| 31 | + |
| 32 | +To build the SLM application, use the :file:`overlay-ppp-cmux-linux.conf` configuration overlay. |
| 33 | + |
| 34 | +You can adjust the serial port baud rate using the devicetree overlay file. |
| 35 | +By default, the baud rate is set to 115200. |
| 36 | +If you change the baud rate, set the same rate in the :file:`scripts/slm_start_ppp.sh` and :file:`scripts/slm_stop_ppp.sh` scripts. |
| 37 | + |
| 38 | +Building and running |
| 39 | +==================== |
| 40 | + |
| 41 | +To build and program the SLM application to the nRF91 Series device, use the :file:`overlay-ppp-cmux-linux.conf` overlay file. |
| 42 | + |
| 43 | +Managing the connection |
| 44 | +======================= |
| 45 | + |
| 46 | +The start and stop scripts are provided in the :file:`scripts` directory of the SLM application. |
| 47 | +The scripts assume that the nRF91 Series SiP is connected to the Linux device using the `/dev/ttyACM0` serial port. |
| 48 | + |
| 49 | +If needed, adjust the serial port settings in the scripts as follows: |
| 50 | + |
| 51 | +.. code-block:: none |
| 52 | +
|
| 53 | + MODEM=/dev/ttyACM0 |
| 54 | + BAUD=115200 |
| 55 | +
|
| 56 | +To start the PPP connection, run the :file:`scripts/slm_start_ppp.sh` script. |
| 57 | +To stop the PPP connection, run the :file:`scripts/slm_stop_ppp.sh` script. |
| 58 | + |
| 59 | +The scripts need superuser privileges to run, so use `sudo`. |
| 60 | +The PPP link is set as a default route if there is no existing default route. |
| 61 | +The scripts do not manage the DNS settings from the Linux system. |
| 62 | +Read the distribution manuals to learn how to configure the DNS settings. |
| 63 | + |
| 64 | +The following example shows how to start the connection and verify its operation with various command-line utilities: |
| 65 | + |
| 66 | +.. code-block:: shell |
| 67 | +
|
| 68 | + $ sudo scripts/slm_start_ppp.sh |
| 69 | + Wait modem to boot |
| 70 | + Attach CMUX channel to modem... |
| 71 | + Connect and wait for PPP link... |
| 72 | + send (AT+CFUN=1^M) |
| 73 | + expect (OK) |
| 74 | +
|
| 75 | +
|
| 76 | + OK |
| 77 | + -- got it |
| 78 | +
|
| 79 | + send () |
| 80 | + expect (#XPPP: 1,0) |
| 81 | +
|
| 82 | +
|
| 83 | +
|
| 84 | +
|
| 85 | + #XPPP: 1,0 |
| 86 | + -- got it |
| 87 | +
|
| 88 | + $ ip addr show ppp0 |
| 89 | + 7: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1464 qdisc fq_codel state UNKNOWN group default qlen 3 |
| 90 | + link/ppp |
| 91 | + inet 10.139.130.66/32 scope global ppp0 |
| 92 | + valid_lft forever preferred_lft forever |
| 93 | + inet6 2001:14bb:69b:50a3:ade3:2fce:6cc:ba3c/64 scope global temporary dynamic |
| 94 | + valid_lft 604720sec preferred_lft 85857sec |
| 95 | + inet6 2001:14bb:69b:50a3:40f9:1c4e:7231:638b/64 scope global dynamic mngtmpaddr |
| 96 | + valid_lft forever preferred_lft forever |
| 97 | + inet6 fe80::40f9:1c4e:7231:638b peer fe80::3c29:6401/128 scope link |
| 98 | + valid_lft forever preferred_lft forever |
| 99 | +
|
| 100 | + $ ping -I ppp0 8.8.8.8 -c5 |
| 101 | + PING 8.8.8.8 (8.8.8.8) from 10.139.130.66 ppp0: 56(84) bytes of data. |
| 102 | + 64 bytes from 8.8.8.8: icmp_seq=1 ttl=60 time=320 ms |
| 103 | + 64 bytes from 8.8.8.8: icmp_seq=2 ttl=60 time=97.6 ms |
| 104 | + 64 bytes from 8.8.8.8: icmp_seq=3 ttl=60 time=140 ms |
| 105 | + 64 bytes from 8.8.8.8: icmp_seq=4 ttl=60 time=132 ms |
| 106 | + 64 bytes from 8.8.8.8: icmp_seq=5 ttl=60 time=145 ms |
| 107 | +
|
| 108 | + --- 8.8.8.8 ping statistics --- |
| 109 | + 5 packets transmitted, 5 received, 0% packet loss, time 4007ms |
| 110 | + rtt min/avg/max/mdev = 97.610/166.802/319.778/78.251 ms |
| 111 | +
|
| 112 | + $ iperf3 -c ping.online.net%ppp0 -p 5202 |
| 113 | + Connecting to host ping.online.net, port 5202 |
| 114 | + [ 5] local 10.139.130.66 port 54244 connected to 51.158.1.21 port 5202 |
| 115 | + [ ID] Interval Transfer Bitrate Retr Cwnd |
| 116 | + [ 5] 0.00-1.00 sec 0.00 Bytes 0.00 bits/sec 1 17.6 KBytes |
| 117 | + [ 5] 1.00-2.00 sec 0.00 Bytes 0.00 bits/sec 0 25.8 KBytes |
| 118 | + [ 5] 2.00-3.00 sec 0.00 Bytes 0.00 bits/sec 0 32.5 KBytes |
| 119 | + [ 5] 3.00-4.00 sec 128 KBytes 1.05 Mbits/sec 0 35.2 KBytes |
| 120 | + [ 5] 4.00-5.00 sec 0.00 Bytes 0.00 bits/sec 0 35.2 KBytes |
| 121 | + [ 5] 5.00-6.00 sec 0.00 Bytes 0.00 bits/sec 0 35.2 KBytes |
| 122 | + [ 5] 6.00-7.00 sec 0.00 Bytes 0.00 bits/sec 0 35.2 KBytes |
| 123 | + [ 5] 7.00-8.00 sec 0.00 Bytes 0.00 bits/sec 0 35.2 KBytes |
| 124 | + [ 5] 8.00-9.00 sec 0.00 Bytes 0.00 bits/sec 0 35.2 KBytes |
| 125 | + [ 5] 9.00-10.00 sec 0.00 Bytes 0.00 bits/sec 0 35.2 KBytes |
| 126 | + - - - - - - - - - - - - - - - - - - - - - - - - - |
| 127 | + [ ID] Interval Transfer Bitrate Retr |
| 128 | + [ 5] 0.00-10.00 sec 128 KBytes 105 Kbits/sec 1 sender |
| 129 | + [ 5] 0.00-11.58 sec 89.5 KBytes 63.3 Kbits/sec receiver |
| 130 | +
|
| 131 | + $ sudo scripts/slm_stop_ppp.sh |
| 132 | + send (AT+CFUN=0^M) |
| 133 | + expect (#XPPP: 0,0) |
| 134 | +
|
| 135 | +
|
| 136 | + OK |
| 137 | +
|
| 138 | +
|
| 139 | +
|
| 140 | + #XPPP: 0,0 |
| 141 | + -- got it |
0 commit comments