Dec-15-2020, 09:45 PM
(This post was last modified: Dec-15-2020, 11:24 PM by Larz60+.
Edit Reason: Fiexd error tag
)
Hi.
Im sending data (a 3 digit number and a letter like ¨423 A¨) from PC to Raspberry zero via serial through USB gadget mode.
Im using this code
Im sending data (a 3 digit number and a letter like ¨423 A¨) from PC to Raspberry zero via serial through USB gadget mode.
Im using this code
import serial ser= serial.Serial('/dev/ttyGS0', 9600) while (True): if (ser.inWaiting()>0): data_str = ser.read(ser.inWaiting()) print(data_str)I can send ten or twenty messages and then a get the error
Error:Tracebak (most recent call last):
File "the.py", line 12, in <module>
if (ser.inWaiting()>0):
File "/usr/local/lib/python3.7/dist-packages/serial/serialutil.py", line 594, in inWaiting
return self.in_waiting
File "/usr/local/lib/python3.7/dist-packages/serial/serialposix.py", line 549, in in_waiting
s = fcntl.ioctl (self.fd, TIOCINQ, TIOCM_zero_str)
OSError: [Errno 5] input/output error
Any idea?