Write (WR) command fails on SPI

I have code that writes a set of configuration parameters (RE, KY, TO, CE, ID, EE) followed by a WR command. These are all written over the SPI bus. All the commands up until the WR command work fine. I receive a AT command response packets (0x88) with a Command Status of 0=OK. However, when I write the final WR command, I don’t receive the AT command response packet. Instead, I receive an Extended Transmit Status (0x8B) packet which has a Delivery status of Route not found (0x25). Any suggestions why it is failing?

What is the exact part number and firmware version you are working with?

What is the API frame you are sending where the WR fails?

It is a XB9X-DMUS-001 with firmware 900A.

Just now I set out to record the API frame byte-by-byte to report it here to you, and the XBee responded with success. I didn’t change anything, so I don’t know why it’s working now, but I’ll let you know if it fails again, and if so, I’ll post the API frame.

Thanks,
Jon

This problem cropped up again, this time with no response from the XBee. Here are the bytes that I am sending:

‘~’; 0x7e
NUL; 0x00
EOT; 0x04
BS; 0x08
‘K’; 0x4b
‘W’; 0x57
‘R’; 0x52
ETX; 0x03

I am using the SPI bus. In the docs, it says “Once you issue a WR command, do not send any additional characters to the device until after you receive the OK response.” Since I am using the SPI bus, It is in API mode (AP = 1) so I would not receive an “OK response”. Although the docs don’t specify what the response to a WR command should be in API mode, I assume it is still valid to use this command, right?

For the SPI port, you still do need to issue 0xFF FF’s to read the data from the SPI port.

Yes, I understand that. My application monitors the attention wire and sends 0xFF’s whenever the XBee has data ready. I am sending and receiving data without any problem.

In my previous post, I was just expressing my confusion about the documentation: With a connection to the UART in command mode, I would expect to receive an “OK” response to a command. However, in API mode I would expect to receive a Local AT Command Response to a command. So, when the documentation says to expect an “OK” response to a command, it made me wonder if that command is somehow only valid in UART command mode and not available in SPI mode?

Thanks,
Jon

Jon,

If you are using the UART and if API mode is off, the you would use the ATWR command. Then you would get an OK back.

If you are using API mode via the UART, then you would issue the API frame 7E 00 04 08 01 57 52 4D and would expect to receive 7E 00 05 88 01 57 52 00 CD.

For the SPI port, the process would be the same as for the API mode but you would send the 0xFF frames to receive the response. So no, the command sequence is the same with respect to issuing a WR and expecting an OK back.

OK, thanks, that answers my question. Do you have any suggestions why I get no response to the WR command above? As I mentioned, all my other communication with the XBee is solid, and it is only the WR command where I don’t get a response. Thanks!

I am sorry but I don’t.

And update for anyone who is interested: I discovered today that this same code on an XR radio seems to be working fine.