kyadav
Posts: 2
Joined: Tue May 21, 2019 12:58 am

USB com port Assignment

Tue May 21, 2019 1:24 pm

When the Raspberry pi boots up, it looks for the Arduino connected serially. I have a udev rules that finds the USB port Arduino is connected. This works just fine. In the program I am bit-banging GPIO lines with AVRDUDE into AtTiny84A. Right when power is applied to AtTiny, the com port changes for the Arduino and throws the serial exception errors. I have tried to handle the exception by finding the new com port the arduino was assigned to, but the exception always kills the program. I am using PySerial as well.

Any ideas on how to find the arduino com port at the very beginning of the program and have the OS tie the arduino to that port always so that it can never change?

In the code below, "LaserWrite1" is a batch script that does the bitbanging of the AtTiny.

Code: Select all

from time import sleep
import time
import subprocess
import serial
import os

ser = serial.Serial('/dev/serial_friend',115200, timeout=.1)
time.sleep(1.0)
ser.write("ready")
.....
.....

proc1 = subprocess.Popen('Laser_file1', shell = True)
proc2 = subprocess.Popen('Laser_file2', shell = True)


while True:
    sleep(0.5)
    data1 = ser.read()
    print("Waiting to Program...")
    if data1 == "1":
            program_func1()
Error Message: 'device reports readiness to read but returned no data ' SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?) :

Return to “Advanced users”