README.rst
1.. zephyr:code-sample:: at_client
2 :name: AT Command Client
3 :relevant-api: uart_interface modem_pipe
4
5 Create a bidirectional UART bridge between console and modem for AT command communication.
6
7Overview
8********
9
10This sample demonstrates how to create an AT command client that bridges
11communication between the host console and a cellular modem. It uses the
12Zephyr modem subsystem with ``uart_pipe`` for console communication and
13``modem_pipe`` for modem communication.
14
15The sample provides a transparent bidirectional bridge:
16
17* Commands typed in the console are forwarded to the modem
18* Responses from the modem are displayed on the console
19* Supports AT command interaction and firmware update via XMODEM protocol
20
21Requirements
22************
23
24* A board with two UART peripherals
25* One UART connected to the host console (typically USB CDC-ACM or ST-LINK)
26* Second UART connected to a cellular modem
27* Device tree configuration for both UARTs
28
29Wiring
30******
31
32The sample requires two UART connections to be defined in the device tree:
33
34* ``zephyr,console`` - Console UART for host communication
35* ``zephyr,modem-uart`` - Modem UART for cellular modem communication
36
37Building and Running
38********************
39
40Build and flash the sample as follows:
41
42.. zephyr-app-commands::
43 :zephyr-app: samples/drivers/modem/at_client
44 :board: <your_board>
45 :goals: build flash
46 :compact:
47
48After flashing, open a serial terminal to the console UART. Any AT commands
49typed will be forwarded to the modem, and responses will be displayed.
50
51Sample Output
52=============
53
54.. code-block:: console
55
56 *** Booting Zephyr OS build v3.x.x ***
57 [00:00:00.100,000] <inf> at_client: Console UART pipe registered
58 [00:00:00.150,000] <inf> at_client: Modem pipe initialized and opened
59 [00:00:00.151,000] <inf> at_client: Console <-> Modem communication established
60 [00:00:00.151,000] <inf> at_client: Ready to forward AT commands
61
62
63 AT
64 OK
65
66 AT+CGMI
67 Sierra Wireless
68 OK
69
70Usage Example
71=============
72
73Once running, you can send AT commands directly from your terminal:
74
75.. code-block:: console
76
77 AT+CGSN # Query modem IMEI
78 AT+CSQ # Check signal quality
79 AT+COPS? # Query operator
80 AT+CGDCONT=1,"IP","apn" # Configure APN
81
82Firmware Update
83===============
84
85This sample supports modem firmware updates using the XMODEM protocol.
86Use the companion Python script ``hl78xx_firmware_update.py`` to perform
87firmware updates through the AT client bridge.
88
89See ``scripts/hl78xx_firmware_update.py`` for details.
90