I am developing on ArchLinuxArm, using Python 3.
I have arranged my code such that all I/O to the expansion boards is only performed in one thread (except, possibly, the RTC, which is handled by the OS.
I am experiencing a problem that the I/O thread crashes fairly often (sometimes within minutes of starting but at other times it will run for several hours) with the following traceback:
[root@automate ~]# Main.py
Exception in thread Inputs.Inputs:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
File "/usr/lib/python3.5/threading.py", line 862, in run
File "/root/Inputs.py", line 23, in Inputs
File "/root/Analogs.py", line 21, in sense
File "/root/ABElectronics_Python3_Libraries/ExpanderPi/ABE_ExpanderPi.py", line 61, in readADCraw
r = self.__spiADC.xfer2([4 + (channel >> 2), (channel & 3) << 6, 0])
OSError: [Errno 22] Invalid argument
If I insert a print statement into my code, the problem appears to go away - the system will run reliably for more than a day.
The analogue inputs are being scanned once a second with this code:
# 2016-05-08 21:46
from ExpanderPi.ABE_ExpanderPi import ADC
def __init__(self, pi, channel, avcnt):
from Initialise import analogs
if(len(self.values) >= self.avcnt):
I have no problem with the digital inputs, which are being scanned ten times a second.
Can anyone offer any advice or explanation for this problem?