1

I used to use the RPi 2b and had no problems with my Xbee codes but this new RPi3 is killing me. I can not read from my XBee model S2 Pro anymore.

Following instructions from other forums I have changed the TTY to S0 with

SERIALPORT = '/dev/ttyS0'

I have changed the UART in /boot to:

enable_uart=1

and in rasps-config I have enabled the login shell on serial. My simply code is as follows:

import serial, time, datetime, sys
from xbee import XBee
#from xbee import ZigBee
#import subprocess
#import pprint
#import MySQLdb
#import chat


SERIALPORT = '/dev/ttyS0'
BAUDRATE = 9600

ser = serial.Serial(SERIALPORT, BAUDRATE)

xbee = XBee(ser)

print 'Starting Up XBee Monitor'
# Continuously read and print packets
while True:
    try:
        response = xbee.wait_read_frame()
        print response
    except KeyboardInterrupt:
        break

ser.close()

An so my error is also as follows:

Starting Up XBee Monitor
Traceback (most recent call last):
  File "wetter.py", line 21, in <module>
    response = xbee.wait_read_frame()
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 412, in wait_read_frame
    frame = self._wait_for_frame()
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 130, in _wait_for_frame
    if self.serial.inWaiting() == 0:
  File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 518, in inWaiting
    return self.in_waiting
  File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 433, in in_waiting
    s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
IOError: [Errno 5] Input/output error

I am simply not having any luck with this. I am using Jessie Lite and Python 3. Does anyone have any other ideas?

Cybergei
  • 71
  • 2
  • 6

1 Answers1

1

I ran in to this same issue with Raspberry Pi Model B Rev 2 & XBee Series 1. I had to remove all entree related to the serial port in the /boot/cmdline.txt file & in the /etc/inittab file. After that the communication worked fine.

I will admit this was not my idea, I found it on another site, but am not able to find the site again.

/boot/cmdline.txt

Original

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

New

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

/etc/inittab comment out

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

cheycomm
  • 11
  • 1