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?

  • A small update. My desire is for Point to Point Xbee common so I set up both in AT mode, one as End Point and one as Coordinator. With tis config, the py script does not function, however the the Coordinator is in API mode, it receives a packet but not all data. – Cybergei Sep 27 '16 at 10:09
  • When you were using the Pi 2, were you also using Jessie Lite, or were you using the full version? – goobering Sep 27 '16 at 10:11
  • Nah with Pi2 it was the full version but of the previous release. Not Jessie – Cybergei Sep 27 '16 at 10:43
  • It seems that the Python script receives data only when the Bee is in API mode, but my problem with that is the payload size is too small in API mode. I need the Bee to function in AT mode so that the payload is at least fragmented. What do you all think? – Cybergei Sep 27 '16 at 12:26
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

| improve this answer | |
  • If you wish to stop the RPi's serial port being used I am not sure the modification to /etc/inittab will be effective on Jessie/Jessie Lite unless the sysV init is being used - by default upgrades from the previous Wheezy as well as new installs will use the new-fangled systemd as the first process (PID==1) and I do not think THAT uses /etc/inittab to control the spawning of getty instances on virtual consoles and (in this case) serial ports. I think you and the OP will need to research the systemd way of controlling this service. – SlySven Nov 23 '16 at 16:37
  • Unfortunately my strong aversion to it {it gets the stake-through-the-heart reception, with the holy-water and garlic drench on my RPis and PCs} so I do not know what you need to do to configure it not to use the serial port as a possible login terminal...8-P – SlySven Nov 23 '16 at 16:39
  • Added note, my error was on wheezy, not Jessie. Didnt realize the major difference. – cheycomm Nov 24 '16 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.