Home/Support/Support Forum/How to reset the Xbee buffer from C ?!?

How to reset the Xbee buffer from C ?!?

0 votes

I have 2 xbee pros, relatively close to each other however I still often get dupe messages from one end or the other.

For example:

[ 2018-01-16 17:51:48 ] From Xbee (length: 100) [RAW]:




My setup is the following: Arduoino + Xbee < > Xbee + Raspberry pi 2

The rpi 2 sending commands and the arduino on the other end executes them and responds. In this example the only line I should've gotten back was:


The rest is garbage which either stuck in on the SENDER side Xbee or on the RECEIVER side. I hope that this is the rest because the SENDER side circuit is built in and difficult to disassemble.

So my question is, is it possible from C to send a flush command to the RECEIVER Xbee to flush it's buffer after each successful command reception?

int serialport_flush(int fd)
return tcflush(fd, TCIOFLUSH);

Does this have any effect?

So before sending out messages to the Arduino side my code always does:
serialport_write(fd1, buf);

At receiving messages it cannot really know if there is a junk in the receiver buffer before it writes that out to the serial.
asked Jan 25, 2018 in XBee Programmable Development by netbsd New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
No it is not possible to reset the XBee's buffers. However I have never observed this or heard of this occurring. That is providing you did not accidentally send it to your self. If your API frame or address is correct, then you are more likely not clearing your buffers properly.
answered Jan 25, 2018 by mvut Veteran of the Digi Community (12,829 points)