jogl
Posts: 93
Joined: Sun Mar 13, 2016 12:02 pm
Location: SW Ontario Canada

USB Issues, HD, Arduino

Thu Mar 23, 2017 10:07 am

I have a model 3 that for the past few months I have been using as an Arduino programmer. The Arduino Uno has been connected to the Pi and reading temperatures and then sending the data serially to the Pi which (using a Python program) commits the data to a MySQL database. It has worked fine.

I decided that it was time to connect a hard drive so that the database does not have to be stored on the SD card. I could not get the HD to show up (in the dmesg) until I unhooked the Arduino. Then the HD showed up (as /dev/sda) and I was able to mount it (as /mnt/hd). That worked fine.

Now I cannot get the Arduino to work. With or without the HD connected there is no /dev/ttyUSB0 that the Arduino used to be connected to. Also in the Arduino IDE the select serial port is greyed out.

What do I need to do to get both devices working?

Thanks,
JP.

jogl
Posts: 93
Joined: Sun Mar 13, 2016 12:02 pm
Location: SW Ontario Canada

Re: USB Issues, HD, Arduino

Fri Mar 24, 2017 10:41 am

Well, the hard drive is working just fine mounted at /mnt/hd.

So, I guess the problem is now reduced to how do I get a serial port (was ttyUSB0 before this adventure began) working so that I can program Arduino and transmit data serially as before?

User avatar
DougieLawson
Posts: 41436
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: USB Issues, HD, Arduino

Fri Mar 24, 2017 11:29 am

What's the format on the HD filesystem?

If it's not ext4 then reformat it as ext4. Because otherwise you WILL get troubles with MySQL file locking and Linux security.

Get the blkid with sudo blkid /dev/sda
Add a line item in /etc/fstab

Code: Select all

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /srv ext4 defaults,noatime 0 1
so that it mounts at a known mount point during boot up. We're using blkid as that means it doesn't matter if the drive appears as /dev/sda1, /dev/sdb1 or even /dev/sdq1, it will still mount.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

MarkDH102
Posts: 491
Joined: Fri Feb 13, 2015 3:18 pm

Re: USB Issues, HD, Arduino

Fri Mar 24, 2017 12:31 pm

Do an :
ls /dev
in a terminal.
I've just plugged in an Arduino and it lists as
ttyACM0

Maybe the assignments have changed for you.
Do an ls before inserting the Arduino then after and check differences.

jogl
Posts: 93
Joined: Sun Mar 13, 2016 12:02 pm
Location: SW Ontario Canada

Re: USB Issues, HD, Arduino

Fri Mar 24, 2017 4:43 pm

Drive is formatted ext4 and is now set up as suggested and mounts and works fine.

Nothing changes in the /dev/tty*'s when I boot with Arduino connected vs without.

And I have just noticed that with the UUID... in fstab and no hd connected the RPi will not boot up?

User avatar
DougieLawson
Posts: 41436
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: USB Issues, HD, Arduino

Fri Mar 24, 2017 9:06 pm

Unplug your arduino, plug it back in then look at dmesg you should see something like

Code: Select all

[ 8925.584948] usb 1-1.2.4: USB disconnect, device number 6
[ 8925.587997] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 8925.588175] ch341 1-1.2.4:1.0: device disconnected
[ 8930.909438] usb 1-1.2.4: new full-speed USB device number 7 using dwc_otg
[ 8931.043130] usb 1-1.2.4: New USB device found, idVendor=1a86, idProduct=7523
[ 8931.043154] usb 1-1.2.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 8931.043165] usb 1-1.2.4: Product: USB2.0-Serial
[ 8931.045425] ch341 1-1.2.4:1.0: ch341-uart converter detected
[ 8931.058910] usb 1-1.2.4: ch341-uart converter now attached to ttyUSB0
which is from my Chinese clone Nano.
Or something like

Code: Select all

[ 8930.139974] usb 1-1.3: USB disconnect, device number 4
[ 8934.272997] usb 1-1.3: new full-speed USB device number 5 using dwc_otg
[ 8934.418189] usb 1-1.3: New USB device found, idVendor=2341, idProduct=0001
[ 8934.418214] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 8934.418224] usb 1-1.3: Product: Arduino Uno
[ 8934.418234] usb 1-1.3: Manufacturer: Arduino (www.arduino.cc)
[ 8934.418244] usb 1-1.3: SerialNumber: 64935343633351C06280
[ 8934.436224] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
which is from my Uno.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

jogl
Posts: 93
Joined: Sun Mar 13, 2016 12:02 pm
Location: SW Ontario Canada

Re: USB Issues, HD, Arduino

Sat Mar 25, 2017 11:56 am

All is working now, thanks guys.

This is kind of embarrassing, I had a bad USB cable. Funny thing is that it worked with the HD but not the UNO. It was brand new right out of the bag, but from you know where.

Thanks again,
JP.

Return to “Beginners”