<div dir="ltr">Pat,<div>   Great information! </div><div><br></div><div>Regards,</div><div>Doug P.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 6, 2021 at 2:24 PM Pat Caron via DPRGlist <<a href="mailto:dprglist@lists.dprg.org">dprglist@lists.dprg.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default">During the last RBNV I mentioned that I was having problems communicating with an Arduino connected to the RPI due to that nature of the USB bus and what device gets connected first ei: /dev/ttyUSB0 vs /dev/ttyUSB1 or /dev/ttyACM0...etc when using multiple Arduinos.  To resolve this I used some udev rules as below to connect the devices to a symbolic link therefore resolving the unknown USB device name.  The same symbolic link name will be given to the USB serial device connected to a specific port.</div><div class="gmail_default"><br></div><div class="gmail_default">I created <b>/etc/udev/rules.d/99-tty-by-path.rules</b> with the following content on the raspberry pi.</div><div class="gmail_default"><br></div><div class="gmail_default"># Rules to create SYMLINK to Arduino device by USB path</div><div class="gmail_default">ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="1-1.2.7:1.0", SYMLINK+="ttyUSB-motor"<br>ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="1-1.2.7:1.1", SYMLINK+="ttyUSB-ultrasonic"<br></div><div class="gmail_default"><br></div><div class="gmail_default">I got the path for the KERNELS=="1-1.2.7:1.x" by typing the command below in the terminal for each devices connected</div><div class="gmail_default">udevadm info -a --name=ttyACM0</div><div class="gmail_default"><br></div><div class="gmail_default">      looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2.7/1-1.2.7:1.0':</div>    <b>KERNELS=="1-1.2.7:1.0"</b><br>    SUBSYSTEMS=="usb"<div class="gmail_default"><br></div><div class="gmail_default">Reload the rules or reboot for them to take effect!!</div><div class="gmail_default"><br></div><div class="gmail_default">In python I use:</div><div class="gmail_default"><br></div><div class="gmail_default">    try:<br>        link = txfer.SerialTransfer('/dev/ttyUSB-motor', 57600)<br>        <br>        link.open()<br>        time.sleep(2) # allow some time for the Arduino to completely reset<br>        while True:<br>            .......<br></div><div class="gmail_default"><br></div><div class="gmail_default">Regards,</div><div class="gmail_default">...Pat</div></div>
_______________________________________________<br>
DPRGlist mailing list<br>
<a href="mailto:DPRGlist@lists.dprg.org" target="_blank">DPRGlist@lists.dprg.org</a><br>
<a href="http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org" rel="noreferrer" target="_blank">http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org</a><br>
</blockquote></div>