I have connected CLK, MISO, MOSI, CSel and ATTN lines to a standalone Atmel Atmega328P chip, loaded with the Arduino bootloader and running on its internal 8MHz oscillator at Vcc = 3.3V. On the XBee, GND, VCC (also 3.3V) and either [CLK, MISO, MOSI, CSel and ATTN] or [DOUT and DIN] are connected.
The Atmega chip can transmit data (“Hello world”) in API mode 1 (non-escaped) via UART to a second XBee which is connected to a PC via USB. When I disconnect the UART lines and connect the SPI lines, the XBee does not transmit anything. Moreover, upon a hard reset of the XBee, no status frame is received on the SPI bus and the ATTN line always remains HIGH. When I send a RF data frame from the PC XBee, it is received in UART mode, but again SPI does not respond and ATTN remains high.
I have checked the outgoing signals from the Atmega MCU. The waveforms are as expected for CLK, MOSI and CSel (3.3V, mode 0, MSB first, leading edge rises).
The MISO line however remains high constantly. I have connected a flash-memory chip using the same SPI interface and it works correctly.
I have tried the following, to no avail:
- connecting the DOUT to ground and resetting the XBee.
- setting the DOUT and DIN to ‘disabled’ using XCTU.
- setting all disconnected DIO pins to disabled, input, output low and output high.
- disabling the pullup/down resistors on the SPI lines
- SPI communication at different speeds (2, 1, 0.5, 0.25, 0.125, 0.0625 MHz)
- repeating the abovementioned tests with a second XBee module
There is simply no reponse from the XBee in SPI mode. When UART lines are connected, the XBee always works. This suggests that the XBee never enters SPI mode. I have read the 868LP manual, and the following posts:
, but they have not helped. I would be grateful if you could provide some advice and perhaps some more detailed information on the SPI implementation on the XBee 868LP. Am I missing some essential step? Do you know of anyone successfully using XBee + Atmega328 with SPI interface? Thank you for your time.