spixbeezigbeeunicast

XBEE 3 Zigbee 3.0 sometimes sends wrong message content


I am currently working on a SPI connection between a microcontroller (mbed LPC1768) and a XBEE 3 Zigbee 3.0. My goal is to send floats between my mbed and my Computer (wireless). I've got everything set up and received the data with another XBEE device, which is connected with my Computer. I am sending with unicast. I worked quite well and I wanted to test the result by sending a sinus wave and plotting it in Simulink

Here is the sinus curve

1

As you can see it kinda works, but there are some huge errors within the signal. These wrong values always appear at the same position (when I send the same values). Later I read the message with XCTU and I noticed that the message it received was somehow "manipulated". But this only appeared at specific values.

Here is the message I sent with my mbed: uint8_t Message[23] {0x7E, 0x0, 0x13, 0x10, 0x1, 0x0, 0x13, 0xA2, 0x0, 0x41, 0xC1, 0x80, 0xD5, 0xFF, 0xFE, 0x0, 0x0, 0xBB, 0xBE, 0xDD, 0x7D, 0x3F};

Notice that 0xBB is the "header" byte for the 4 float bytes. (The checksum is calculated later in the programm).

Here we suddenly have 5 bytes which are within the received data frame field! The last value is the checksum

2

I know that the receive packet is different from the packet I am sending, but it shouldn't change the content of my message at specific values. Other values are being received with only 4 data bytes correctly. What is the problem here? Sorry for my bad English.

I tried sending a sinus wave without any errors, but some specific values are being changed somehow.


Solution

  • Try switching to API mode 1 (ATAP=1). With ATAP set to 2, the XBee "escapes" certain values with 0x7D.

    Here's Digi's documentation on escaped API mode:

    In your example, the escaped values are:

    0x7D 0x31 -> 0x11
    0x7D 0x33 -> 0x13
    0x7D 0x5E -> 0x7E
    0x7D 0x5D -> 0x7D
    

    So the packet came from 00 13 A2 00 41 C1 7E 38, and had the correct payload of BB BE DD 7D 3F.

    I have yet to run into an application that needs API mode 2. Switch to ATAP=1, make sure your software knows it's running in "unescaped" mode, and it should resolve your issue.