SPI operation
Select the SPI port
Digi XBee® 3 802.15.4 RF Module User Guide
86
Select the SPI port
To force SPI mode on through-hole devices, hold DOUT/DIO13 low while resetting the device until SPI_
ATTN asserts. This causes the device to disable the UART and go straight into SPI communication
mode. Once configuration is complete, the device queues a modem status frame to the SPI port,
which causes the SPI_ATTN line to assert. The host can use this to determine that the SPI port is
configured properly.
On surface-mount devices, forcing DOUT low at the time of reset has no effect. To use SPI mode on
the SMT modules, assert the SPI_SSEL low after reset and before any UART data is input.
Forcing DOUT low on TH devices forces the device to enable SPI support by setting the following
configuration values:
Through-hole
Micro and Surface-mount
SPI signal
D1 (DIO1/ADC1/TH_SPI_ATTN Configuration)
P9 (DIO19/SPI_ATTN Configuration)
ATTN
D2 (DIO2/ADC2/TH_SPI_CLK Configuration)
P8 (DIO18/SPI_CLK Configuration)
SCLK
D3 (DIO3/ADC3/TH_SPI_SSEL Configuration)
P7 (DIO17/SPI_SSEL Configuration)
SSEL
D4 (DIO4/TH_SPI_MOSI Configuration)
P6 (DIO16/SPI_MOSI Configuration)
MOSI
P2 (DIO12/TH_SPI_MISO Configuration)
P5 (DIO15/SPI_MISO Configuration)
MISO
Note
The ATTN signal is optional—you can still use SPI mode if you disable the SPI_ATTN pin (
D1
on
through-hole or
P9
on surface-mount devices).
As long as the host does not issue a
WR
command, these configuration values revert to previous
values after a power-on reset. If the host issues a
WR
command while in SPI mode, these same
parameters are written to flash, and after a reset the device continues to operate in SPI mode.
If the UART is disabled and the SPI is enabled in the written configuration, then the device comes up in
SPI mode without forcing it by holding DOUT low. If both the UART and the SPI are configured (
(DIO13/UART_DOUT Configuration)
through
P9 (DIO19/SPI_ATTN Configuration)
are set to
1
) at the
time of reset, then output goes to the UART until the host sends the first input to the SPI interface. As
soon as the first input comes on the SPI port, then all subsequent output goes to the SPI port and the
UART is disabled.
Once you select a serial port (UART or SPI), all subsequent output goes to that port, even if you apply a
new configuration. Once the SPI interface is made active, the only way to switch the selected serial
port back to UART is to reset the device.
When the master asserts the slave select (SPI_SSEL) signal, SPI transmit data is driven to the output
pin SPI_MISO, and SPI data is received from the input pin SPI_MOSI. The SPI_SSEL pin has to be
asserted to enable the transmit serializer to drive data to the output signal SPI_MISO. A rising edge
on SPI_SSEL causes the SPI_MISO line to be tri-stated such that another slave device can drive it, if so
desired.
If the output buffer is empty, the SPI serializer transmits the last valid bit repeatedly, which may be
either high or low. Otherwise, the device formats all output in API mode 1 format, as described in
. The attached host is expected to ignore all data that is not part of a formatted
API frame.