Digi International Inc XB3C1 Manuel D’Utilisation

Page de 146
Serial communication
Serial interface
Digi XBee3 Cellular LTE Cat 1 Smart Modem User Guide
87
Serial interface
The XBee Smart Modem interfaces to a host device through a serial port. The device can communicate
through its serial port with:
n
Through logic and voltage compatible universal asynchronous receiver/transmitter (UART).
n
Through a level translator to any serial device, for example, through an RS-232 or USB
interface board.
n
Through a serial peripheral interface (SPI) port.
Serial data
A device sends data to the XBee Smart Modem's UART through pin 3 DIN as an asynchronous serial
signal. When the device is not transmitting data, the signals should idle high.
For serial communication to occur, you must configure the UART of both devices (the microcontroller
and the XBee Smart Modem) with compatible settings for the baud rate, parity, start bits, stop bits,
and data bits.
Each data byte consists of a start bit (low), 8 data bits (least significant bit first) and a stop bit (high).
The following diagram illustrates the serial bit pattern of data passing through the device. The
diagram shows UART data packet 0x1F (decimal number 31) as transmitted through the device.
You can configure the UART baud rate, parity, and stop bits settings on the device with the BDNB,
and SB commands respectively. For more information, see
In the rare case that a device has been configured with the UART disabled, you can recover the device
to UART operation by holding DIN low at reset time. DIN forces a default configuration on the UART at
9600 baud and it brings the device up in Command mode on the UART port. You can then send the
appropriate commands to the device to configure it for UART operation. If those parameters are
written, the device comes up with the UART enabled on the next reset.
UART data flow
Devices that have a UART interface connect directly to the pins of the XBee Smart Modem as shown in
the following figure. The figure shows system data flow in a UART-interfaced environment. Low-
asserted signals have a horizontal line over the signal name.
Serial buffers
The XBee Smart Modem maintains internal buffers to collect serial and RF data that it receives. The
serial receive buffer collects incoming serial characters and holds them until the device can process
them. The serial transmit buffer collects the data it receives via the RF link until it transmits that data
out the serial or SPI port.