1.. zephyr:code-sample:: cellular-modem 2 :name: Cellular modem 3 4 Use a cellular modem to communicate with a UDP server. 5 6Overview 7******** 8 9This sample consists of a simple application which powers on 10the modem, brings up the net interface, then sends a packet 11with pseudo random data to the endpoint test-endpoint.com, 12which is a publicly hosted server which runs the Python 13script found in the server folder. DNS is used to look 14up the IP of test-endpoint.com. 15 16Notes 17***** 18 19This sample uses the devicetree alias ``modem`` to identify 20the modem instance to use. The sample also presumes that 21the modem driver creates the only PPP network interface. 22 23Setup 24***** 25 26Start by setting up the devicetree with the required 27devicetree node: 28 29.. code-block:: devicetree 30 31 /dts-v1/; 32 33 / { 34 aliases { 35 modem = &modem; 36 }; 37 }; 38 39 &usart2 { 40 pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>; 41 pinctrl-names = "default"; 42 current-speed = <115200>; 43 hw-flow-control; 44 status = "okay"; 45 46 modem: modem { 47 compatible = "quectel,bg9x"; 48 mdm-power-gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>; 49 mdm-reset-gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>; 50 status = "okay"; 51 }; 52 }; 53 54Next, the UART API must be specified using ``CONFIG_UART_INTERRUPT_DRIVEN=y`` or 55``CONFIG_UART_ASYNC_API=y``. The driver doesn't support UART polling. 56 57Lastly, the APN must be configured using ``CONFIG_MODEM_CELLULAR_APN=""``. 58