unable to receive incoming data from one xbee to another xbee via serial port connection


OS : Ubuntu
xbee = s2c
I have set up my 2 xbee modules in API escape mode, and connected one XBee module at sender side and another module at receiver side. I’m sending JSON data continuously to receiver. I could able to view the incoming data in serial monitor without any packet loss. but when i receive the incoming data using python code I’m facing issues.

receiver code:

import serial
import time
from xbee import XBee, ZigBee
ser = serial.Serial(‘/dev/ttymxc0’, 9600, timeout = 5)
xbee = ZigBee(ser , escaped = True)
while True:

         data = xbee.wait_read_frame()


in this code the program is continuously going to wait state.
so when i use data = ser.readline().strip() and print data then i could able to receive data but with garbage values. can anyone help me over this issue please.
thanks in advance!!!


Could it be that the data you are getting is the Hex API frames being output by the radio? Try putting the radios in transparent mode and then do your ser.read. I think you will see that is what the issue is.

Hi thanks a lot for your response… actually i tried using transparent mode also using ser.read() but getting same garbage values… actually I’m communicating between arduino and gateway(ubuntu)… so while sending data from sender i have attached its address also hence which results in garbage values in receiver end.

Then the next guess would be a baud rate mismatch.

I have configured both xbee’s as 9600 baud rate only… actually now i could able to receive data packets but the case is I’m not getting all the packets from the xbee. most of the packets are missing or either resulting in garbage values. i could able to receive only few packets… I’m not understanding how to resolve this issue… actually the data packets which I’m sending is in JSON format.


This might be better handled via submitting a support case. You can create a case by sending an email to tech.support@digi.com