User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Identifying physical USB port attached to Arduino, from start up

Thu May 10, 2018 3:41 pm

OK...so it's a little different...
I have two Arduino Nanos plugged into a RPi 3B. each into a different USB port. When I apply power to the RPi, every thing comes up and runs. The RPi is fine. The pre-loaded sketches on the Nano's run fine. The problem is I can not find what physical ports are identified with the Nano's.

ls /dev/tty* shows:
/dev/tty /dev/tty17 /dev/tty26 /dev/tty35 /dev/tty44 /dev/tty53 /dev/tty62
/dev/tty0 /dev/tty18 /dev/tty27 /dev/tty36 /dev/tty45 /dev/tty54 /dev/tty63
/dev/tty1 /dev/tty19 /dev/tty28 /dev/tty37 /dev/tty46 /dev/tty55 /dev/tty7
/dev/tty10 /dev/tty2 /dev/tty29 /dev/tty38 /dev/tty47 /dev/tty56 /dev/tty8
/dev/tty11 /dev/tty20 /dev/tty3 /dev/tty39 /dev/tty48 /dev/tty57 /dev/tty9
/dev/tty12 /dev/tty21 /dev/tty30 /dev/tty4 /dev/tty49 /dev/tty58 /dev/ttyAMA0
/dev/tty13 /dev/tty22 /dev/tty31 /dev/tty40 /dev/tty5 /dev/tty59 /dev/ttyprintk
/dev/tty14 /dev/tty23 /dev/tty32 /dev/tty41 /dev/tty50 /dev/tty6
/dev/tty15 /dev/tty24 /dev/tty33 /dev/tty42 /dev/tty51 /dev/tty60
/dev/tty16 /dev/tty25 /dev/tty34 /dev/tty43 /dev/tty52 /dev/tty61

lsusb shows:
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
dmesg does not identify the ports either.

Note that if I plug in the Nanos after the RPi has powered up I can find the information via dmesg.

Can anyone help on this? I've been trying to find a method of getting the RPi to rescan for the USB ports the Nanos are connected to, but no luck.
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Identifying physical USB port attached to Arduino, from start up

Thu May 10, 2018 4:52 pm

I can confirm I'm seeing the same thing.

If I powerup with the Nano (clone) plugged into a USB port, it doesn't show up:

Code: Select all

[email protected]:~ $ ls /dev/ttyU*
ls: cannot access '/dev/ttyU*': No such file or directory
[email protected]:~ $ lsusb
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[email protected]:~ $
If I unplug the Nano, and plug it back it:

Code: Select all

[email protected]:~ $ ls /dev/ttyU*
/dev/ttyUSB0
[email protected]:~ $ lsusb
Bus 001 Device 008: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[email protected]:~ $

User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 1:04 pm

I had been considering that a power-up race condition was my issue, but even with the two Nano’s powered-up in advance of the RPi boot they are still not identified (lsusb). However, in looking (read “with open eyes”) at the dmesg output I find that the RPi has been reporting an “error -32” when attempting to connect to them.

Anyone know where to find these type of error codes.
[ 1.121548] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 1.361811] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[ 1.361826] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1.681576] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 1.811984] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 1.812025] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.001576] usb 1-1.5: new full-speed USB device number 4 using dwc_otg
[ 2.101542] usb 1-1.5: device descriptor read/64, error -32
[ 2.321548] usb 1-1.5: device descriptor read/64, error -32

[ 2.551627] usb 1-1.5: new full-speed USB device number 5 using dwc_otg
[ 2.651596] usb 1-1.5: device descriptor read/64, error -32
[ 2.871550] usb 1-1.5: device descriptor read/64, error -32
[ 2.991653] usb 1-1-port5: attempt power cycle

[ 3.651630] usb 1-1.5: new full-speed USB device number 6 using dwc_otg
[ 4.097919] usb 1-1.5: device not accepting address 6, error -32
[ 4.191621] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
[ 4.637116] usb 1-1.5: device not accepting address 7, error -32
[ 4.637293] usb 1-1-port5: unable to enumerate USB device
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

User avatar
DougieLawson
Posts: 33616
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 5:13 pm

Your power supply may not be good enough to run your RPi and your Arduino.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 5:43 pm

I don't believe that's the problem, as the Pi has a 3 ampere supply and i have a 10 ampere supply for the Nanos.
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 8:06 pm

NewburyPi wrote:
Fri May 11, 2018 5:43 pm
I don't believe that's the problem, as the Pi has a 3 ampere supply and i have a 10 ampere supply for the Nanos.
Hmm, the only thing I could find about error -32 was a current over-draw from the USB device, but the host was a PC, and I'm not sure whether the Pi has the ability to flag such a situation anyway.

Having said that, my nano has no devices on at, and is just running 'Blink', so the 3B should be able to power it, but I have the same result

Code: Select all

[email protected]:~ $ dmesg | grep -i usb
[    0.061626] usbcore: registered new interface driver usbfs
[    0.061695] usbcore: registered new interface driver hub
[    0.061795] usbcore: registered new device driver usb
[    0.237749] usbcore: registered new interface driver lan78xx
[    0.240077] usbcore: registered new interface driver smsc95xx
[    0.714330] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.716648] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.719015] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    0.726007] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.728322] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.730623] usb usb1: Product: DWC OTG Controller
[    0.732894] usb usb1: Manufacturer: Linux 4.14.34-v7+ dwc_otg_hcd
[    0.735174] usb usb1: SerialNumber: 3f980000.usb
[    0.738003] hub 1-0:1.0: USB hub found
[    0.743028] usbcore: registered new interface driver usb-storage
[    0.789748] usbcore: registered new interface driver usbhid
[    0.792082] usbhid: USB HID core driver
[    1.171428] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.411717] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    1.414323] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.417602] hub 1-1:1.0: USB hub found
[    1.741440] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    1.881730] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    1.884509] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.976020] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:5a:7a:33
[    2.101452] usb 1-1.4: new full-speed USB device number 4 using dwc_otg
[    2.201452] usb 1-1.4: device descriptor read/64, error -32
[    2.421459] usb 1-1.4: device descriptor read/64, error -32
[    2.641485] usb 1-1.4: new full-speed USB device number 5 using dwc_otg
[    2.741468] usb 1-1.4: device descriptor read/64, error -32
[    2.961440] usb 1-1.4: device descriptor read/64, error -32
[    3.081565] usb 1-1-port4: attempt power cycle
[    3.741465] usb 1-1.4: new full-speed USB device number 6 using dwc_otg
[    4.078591] usbcore: registered new interface driver brcmfmac
[    4.181501] usb 1-1.4: device not accepting address 6, error -32
[    4.281498] usb 1-1.4: new full-speed USB device number 7 using dwc_otg
[    4.721539] usb 1-1.4: device not accepting address 7, error -32
[    4.721704] usb 1-1-port4: unable to enumerate USB device
[email protected]:~ $

User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 8:55 pm

Perplexing. I did have a reply where they had a similar setup but did not see the problem. One possible clue is that they were running Rasperian Stretch 'Lite'. and someone else gave me a link to the code that checks for USB connections. Guess I've got my weekend cut out for me. :(
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 9:36 pm

So… I don’t have a root cause, but I might have a culprit. I have repeated my testing on:
• Arduino Uno
• Arduino Micro
• Adafruit Trinket
• Adafruit Pro Trinket
• OSEPP FTDI adapter
And all operated correctly. Which is to say, the RPi found them on boot up. No extra power supplies were necessary. Another POI, an OSEPP Nano also failed to be recognized on boot up. So, it may be a Nano issue. I will acquire an authentic Nano to test and let everyone know.
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Identifying physical USB port attached to Arduino, from start up

Fri May 11, 2018 9:51 pm

NewburyPi wrote:
Fri May 11, 2018 9:36 pm
So… I don’t have a root cause, but I might have a culprit. I have repeated my testing on:
• Arduino Uno
• Arduino Micro
• Adafruit Trinket
• Adafruit Pro Trinket
• OSEPP FTDI adapter
And all operated correctly. Which is to say, the RPi found them on boot up. No extra power supplies were necessary. Another POI, an OSEPP Nano also failed to be recognized on boot up. So, it may be a Nano issue. I will acquire an authentic Nano to test and let everyone know.
Interesting stuff, I'll try with other Pi versions

User avatar
scruss
Posts: 1768
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Identifying physical USB port attached to Arduino, from start up

Sat May 12, 2018 2:54 am

What's the serial chip on the Nano clones: CH341 or FTDI clone?

I've seen problems with the latter as they all identify as having serial number 00000000. The serial driver expects unique serial numbers on FTDI chips and can become confused.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Identifying physical USB port attached to Arduino, from start up

Sat May 12, 2018 7:23 pm

scruss wrote:
Sat May 12, 2018 2:54 am
What's the serial chip on the Nano clones: CH341 or FTDI clone?

I've seen problems with the latter as they all identify as having serial number 00000000. The serial driver expects unique serial numbers on FTDI chips and can become confused.
This Nano clone doesn't get detected at boot:

Code: Select all

[  339.169384] usb 1-1.5: new full-speed USB device number 8 using dwc_otg
[  339.325693] usb 1-1.5: New USB device found, idVendor=0403, idProduct=6001
[  339.325719] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  339.325729] usb 1-1.5: Product: FT232R USB UART
[  339.325738] usb 1-1.5: Manufacturer: FTDI
[  339.325747] usb 1-1.5: SerialNumber: AL00A7C5
[email protected]:~ $ lsusb
Bus 001 Device 008: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[email protected]:~ $
This one does:

Code: Select all

[    3.383843] usb 1-1.4: New USB device found, idVendor=1a86, idProduct=7523
[    3.394086] usb 1-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[    3.404614] usb 1-1.4: Product: USB2.0-Serial
< snip >
[   12.290250] usbcore: registered new interface driver usbserial
[   12.290376] usbcore: registered new interface driver usbserial_generic
[   12.290491] usbserial: USB Serial support registered for generic
[   12.485848] usbcore: registered new interface driver ch341
[   12.561499] usbserial: USB Serial support registered for ch341-uart
[   12.561638] ch341 1-1.4:1.0: ch341-uart converter detected
[   12.603795] usb 1-1.4: ch341-uart converter now attached to ttyUSB0
[email protected]:~ $ lsusb
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[email protected]:~ $
So, although the FTDI chip has a non zero serial number, it still isn't recognised at boot, whereas the ch341 is.

User avatar
scruss
Posts: 1768
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Identifying physical USB port attached to Arduino, from start up

Sun May 13, 2018 4:49 pm

Does the FTDI serial port appear eventually after reboot, or not at all? If not at all, that's not an issue I've ever experienced.

Maybe conflicting udev rules? Unplug the nano, run udevadm monitor, then plug it in and see what happens.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Re: Identifying physical USB port attached to Arduino, from start up

Sun May 13, 2018 7:01 pm

I've only been able to get the Nano recognized if I plug it into the USB port after the RPi has booted. If I am remembering correctly, I've checked the USB status (lsusb, dmesg) as much as 5 to 10 minutes later and found that it still is not recognized. I will now look into the pyusb library, to see if I can force this recognition.

However I'm quickly moving toward shelving the issue, as I now have a number of workarounds. Calling it on LITS.
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Identifying physical USB port attached to Arduino, from start up

Mon May 14, 2018 12:21 am

NewburyPi wrote:
Sun May 13, 2018 7:01 pm
I've only been able to get the Nano recognized if I plug it into the USB port after the RPi has booted. If I am remembering correctly, I've checked the USB status (lsusb, dmesg) as much as 5 to 10 minutes later and found that it still is not recognized. I will now look into the pyusb library, to see if I can force this recognition.

However I'm quickly moving toward shelving the issue, as I now have a number of workarounds. Calling it on LITS.
There's obviously a problem that needs looking into.

User avatar
NewburyPi
Posts: 10
Joined: Fri Mar 24, 2017 6:24 pm
Contact: Website Twitter

Re: Identifying physical USB port attached to Arduino, from start up

Wed Jun 06, 2018 12:17 pm

Perhaps. However, I am closing this issue out, per LITS (Life is to short). Plenty of work arounds (Don't use nanos, KISS, etc).
--
Dale

Pi By : Livin' the dream & dreamin' live. : 'n' stuff

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Identifying physical USB port attached to Arduino, from start up

Thu Jun 07, 2018 11:04 pm

NewburyPi wrote:
Wed Jun 06, 2018 12:17 pm
Perhaps. However, I am closing this issue out, per LITS (Life is to short). Plenty of work arounds (Don't use nanos, KISS, etc).
I flagged this as a problem to the mods, but got no response. I now buy clones like these that state the serial interface as CH340 (~£9 for 3, but some soldering required).

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 3 guests