I am running BrickPi_Python/Sensor_Examples/LEGO-Motor_Test.py. Motors may run a few times, then they stop and I get an error:
} sudo python3 LEGO-Motor_Test.py
Running Forward
Traceback (most recent call last):
File "LEGO-Motor_Test.py", line 39, in <module>
BrickPiUpdateValues() # Ask BrickPi to update values for sensors/motors
File "/usr/local/lib/python3.4/dist-packages/BrickPi-0.0.0-py3.4.egg/BrickPi.py", line 569, in BrickPiUpdateValues
File "/usr/local/lib/python3.4/dist-packages/BrickPi-0.0.0-py3.4.egg/BrickPi.py", line 684, in BrickPiFlush
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 435, in inWaiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
OSError: [Errno 5] Input/output error
Less frequently I get a different error:
} sudo python3 LEGO-Motor_Test.py
Running Forward
Running Backward
Running Forward
Running Backward
Running Forward
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 308, in _reconfigurePort
orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "LEGO-Motor_Test.py", line 39, in <module>
BrickPiUpdateValues() # Ask BrickPi to update values for sensors/motors
File "/usr/local/lib/python3.4/dist-packages/BrickPi-0.0.0-py3.4.egg/BrickPi.py", line 572, in BrickPiUpdateValues
File "/usr/local/lib/python3.4/dist-packages/BrickPi-0.0.0-py3.4.egg/BrickPi.py", line 716, in BrickPiRx
File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 378, in setTimeout
if self._isOpen: self._reconfigurePort()
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 311, in _reconfigurePort
raise SerialException("Could not configure port: %s" % msg)
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')
Issue happens both with a USB charger and the 8 batteries pack. I have installed the latest Raspbian, and then modified my own image following the provided instructions.
} uname -a
Linux raspberrypi 4.4.26-v7+ #915 SMP Thu Oct 20 17:08:44 BST 2016 armv7l GNU/Linux
Sample program LED.py works fine.
Based on what I read in the forum, I have tried disabling getty with
sudo systemctl disable serial-getty@ttyAMA0.service
and uncommented two lines in /root/config.txt
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on
but no improvement.
Anything I can do to collect additional information for troubleshooting?