Page 1 of 1

XBee Problematic 2-way Comms

Posted: Wed Dec 20, 2017 3:58 am
by ojc
I've been stuck trying to find the solution to this problem for quite a while even though it's a simple fix:

Problem – I can send messages to my PC ok, however my Beaglebone doesn’t register any messages I try to send to it. When I try I get weird behaviour : the xbee attached to the PC seems to receive the messages it sent - this is from the XCTU console on the PC:

>
received:
hello this is BBB
hello this is BBB

sent:
hello this is PC

received:
hello this is PC
>

I’m running x2 XBee Pro S1’s
XBee_PC is attached to my PC via a sparkfun Xbee Explorer
XBee_BBB is attached to the UART2 port on my Beaglebone Black rev C by x4 wires – RX, TX, GND, 3.3V (setup includes decoupling cap)
Xbee Settings:
XBEE_PC XBEE_BBB
CH - Channel C C
ID - Pan ID 123 123
DH 0 0
DL 2 1
MY 1 2
CE End Device [0] Coordinator [1]

The program on the Beaglebone is as shown below – it pauses at ‘waiting for message’ even when I send messages to it from XCTU (ser.read() doesn't return anything either)
Code: Select all
import Adafruit_BBIO.UART as UART
import serial
from time import sleep

UART.setup("UART2")
ser = serial.Serial(port="/dev/ttyO2", baudrate=9600)
ser.open()

msg = 'hello this is BBB \n'
print 'attempting to send message... '
for i in range(2):
     sleep(0.1)
     ser.write(msg)

while True:
     print 'waiting for message... '
     try:
          data = ser.readline()
          print data
          sleep(0.1)
     except Exception as e: print(e)
     except KeyboardInterrupt:
          break
ser.close