Sample Header Ad - 728x90

Unable to write/read from serial port after couple of minutes/hours. Error message: stty: standard input: Inappropriate ioctl for device

1 vote
1 answer
2302 views
I am trying to write and read from serial port at the same time. The purpose of this is to turn on and off a device over a DIO card which is connected to the serial port. While doing these on/off test, I also need to collect some data from light sensors which are also connected to DIO card. Usually the first couple of minutes/hours everything is working as it should. I can send commands to the DIO card, they get executed while at the same time I am able to read the light sensor data. Unfortunately after couple of minutes/hours it stops working and I am not able to send any commands through the port at all. **Serial port settings:** I use the following serial port settings: sudo stty -F /dev/ttyUSB0 115200 cs8 -cstopb -parenb -echo When I try to send commands in terminal I get the following error message: bash: /dev/ttyUSB0: Permission denied When i try to read the serial port settings via `stty > $devicesFolder/lightSensor_log.txt echo $line idOfMainScript=$(ps -aux | grep -E "\/bin\/bash.+Main_Script\.sh") if [[ -z $idOfMainScript ]]; then break fi done printf "adc-loop;" > /dev/ttyUSB0 **3) Test_Scenario.sh** #!/bin/bash printf "DO1=1;" > /dev/ttyUSB0 sleep 50 printf "DO1=0;" > /dev/ttyUSB0
Asked by apploid (11 rep)
Nov 8, 2019, 10:39 AM
Last activity: Jun 3, 2023, 08:51 PM