|
| 1 | +.. _serial_lte_modem: |
| 2 | + |
| 3 | +nRF9160: Serial LTE Modem |
| 4 | +######################### |
| 5 | + |
| 6 | +The Serial LTE Modem (SLM) sample demostrates sending AT commands between a host and a client device. |
| 7 | +An nRF9160 DK is used as the host, while the client can be simulated using either a PC or an nRF52 DK. |
| 8 | + |
| 9 | +This sample is an enhancement to the at_client sample. It provides the following features: |
| 10 | + |
| 11 | + * Support for TCP/IP proprietary AT commands. |
| 12 | + * Support for GPS proprietary AT commands. |
| 13 | + * Support for communication to external MCU over UART. |
| 14 | + |
| 15 | +All nRF91 modem AT commands are also supported. |
| 16 | + |
| 17 | +Requirements |
| 18 | +************ |
| 19 | + |
| 20 | +* The following development board: |
| 21 | + |
| 22 | + * nRF9160 DK board (PCA10090) |
| 23 | + |
| 24 | +* If the client is a PC: |
| 25 | + |
| 26 | + * Any terminal software, such as TeraTerm. |
| 27 | + |
| 28 | +* If the client is an nRF52 device: |
| 29 | + |
| 30 | + * nRF52840 DK board (PCA10056) |
| 31 | + * nRF52832 DK board (PCA10040) |
| 32 | + |
| 33 | +.. terminal_config |
| 34 | +
|
| 35 | +Terminal connection |
| 36 | +=================== |
| 37 | + |
| 38 | +By default, configuration option ``CONFIG_SLM_CONNECT_UART_0`` is defined. |
| 39 | +This means that you can use the J-Link COM port on the PC side to connect with nRF9160 DK, and send or receive AT commands there. |
| 40 | + |
| 41 | +Terminal serial configuration: |
| 42 | + |
| 43 | + * Hardware flow control: disabled |
| 44 | + * Baud rate: 115200 |
| 45 | + * Parity bit: no |
| 46 | + |
| 47 | +.. note:: |
| 48 | + * The default AT command terminator is Carrier Return and Line Feed, i.e. ``\r\n``. |
| 49 | + * nRF91 logs are output to the same terminal port. |
| 50 | + |
| 51 | +External MCU configuration |
| 52 | +========================== |
| 53 | + |
| 54 | +To work with external MCU (nRF52), you must set the configuration option ``CONFIG_SLM_CONNECT_UART_2``. |
| 55 | +The pin interconnection between nRF91 and nRF52 is presented in the following table: |
| 56 | + |
| 57 | +.. list-table:: |
| 58 | + :align: center |
| 59 | + :header-rows: 1 |
| 60 | + |
| 61 | + * - nRF52 DK |
| 62 | + - nRF91 DK |
| 63 | + * - UART TX P0.6 |
| 64 | + - UART RX P0.11 |
| 65 | + * - UART RX P0.8 |
| 66 | + - UART TX P0.10 |
| 67 | + * - UART CTS P0.7 |
| 68 | + - UART RTS P0.12 |
| 69 | + * - UART RTS P0.5 |
| 70 | + - UART RTS P0.13 |
| 71 | + * - GPIO OUT P0.27 |
| 72 | + - GPIO IN P0.31 |
| 73 | + |
| 74 | +UART instance in use: |
| 75 | + |
| 76 | + * nRF52840 and nRF52832 (UART0) |
| 77 | + * nRF9160 (UART2) |
| 78 | + |
| 79 | +UART configuration: |
| 80 | + |
| 81 | + * Hardware flow control: enabled |
| 82 | + * Baud rate: 115200 |
| 83 | + * Parity bit: no |
| 84 | + * Operation mode: IRQ |
| 85 | + |
| 86 | +Note that the GPIO output level on nRF91 side should be 3 V. |
| 87 | + |
| 88 | +TCP/IP AT commands |
| 89 | +****************** |
| 90 | + |
| 91 | +The following proprietary TCP/IP AT commands are used in this sample: |
| 92 | + |
| 93 | +* AT#XSOCKET=<op>,<type> |
| 94 | +* AT#XSOCKET? |
| 95 | +* AT#XBIND=<local_ip>,<local_port> |
| 96 | +* AT#XTCPCONN=<url>,<port> |
| 97 | +* AT#XTCPCONN? |
| 98 | +* AT#XTCPSEND=<data> |
| 99 | +* AT#XTCPRECV=<length>,<time> |
| 100 | +* AT#XUDPSENDTO=<url>,<port>,<data> |
| 101 | +* AT#XUDPRECVFROM=<url>,<port>,<length>,<time> |
| 102 | + |
| 103 | +GPS AT Commands |
| 104 | +*************** |
| 105 | + |
| 106 | +The following proprietary GPS AT commands are used in this sample: |
| 107 | + |
| 108 | + |
| 109 | +* AT#XGPSRUN=<op>[,<mask>] |
| 110 | +* AT#XGPSRUN? |
| 111 | + |
| 112 | +Building and Running |
| 113 | +******************** |
| 114 | + |
| 115 | +.. |sample path| replace:: :file:`samples/nrf9160/serial_lte_modem` |
| 116 | + |
| 117 | +.. include:: /includes/build_and_run_nrf9160.txt |
| 118 | + |
| 119 | +The following configuration files are located in the :file:`samples/nrf9160/serial_lte_modem` directory: |
| 120 | + |
| 121 | +- :file:`prj.conf` |
| 122 | + This is the standard default configuration file. |
| 123 | +- :file:`child_secure_partition_manager.conf` |
| 124 | + This is the project-specific Secure Partition Manager configuration file. |
| 125 | + |
| 126 | +Testing |
| 127 | +======= |
| 128 | + |
| 129 | +To test the sample with a PC client, open a terminal window and start sending AT commands to the nRF9160 DK. |
| 130 | +See `Terminal connection`_ section for the serial connection configuration details. |
| 131 | + |
| 132 | +When testing the sample with an nRF52 client, the DKs go through the following start-up sequence: |
| 133 | + |
| 134 | + 1. nRF91 starts up and enters sleep state. |
| 135 | + #. nRF52 starts up and starts a periodical timer to toggle the GPIO interface. |
| 136 | + #. nRF52 deasserts the GPIO interface. |
| 137 | + #. nRF91 is woken up and sends a ``Ready\r\n`` message to the nRF52. |
| 138 | + #. On receiving the message, nRF52 can proceed to issue AT commands. |
| 139 | + |
| 140 | +Dependencies |
| 141 | +************ |
| 142 | + |
| 143 | +This application uses the following |NCS| libraries and drivers: |
| 144 | + |
| 145 | + * ``nrf/drivers/lte_link_control`` |
| 146 | + * ``nrf/drivers/at_cmd`` |
| 147 | + * ``nrf/lib/bsd_lib`` |
| 148 | + * ``nrf/lib/at_cmd_parser`` |
| 149 | + * nRF BSD Socket |
| 150 | + * Zephyr BSD socket |
| 151 | + |
| 152 | +In addition, it uses the Secure Partition Manager sample: |
| 153 | + |
| 154 | +* :ref:`secure_partition_manager` |
| 155 | + |
| 156 | +References |
| 157 | +********** |
| 158 | + |
| 159 | +* nRF91 `AT Commands reference`_ in Nordic Infocenter |
| 160 | + |
0 commit comments