linuxraspberry-pi

Can't find ttyUSB[id]


I have just started with my Raspberry Pi and I have a project where I want to read data from the USB port. I have installed Java JDK8 and written the program that compiles and runs. But I get the message that /dev/ttyUSB1 does not exist.

I just have a cable from the USB port on the Arduino going to the USB port on the RPi and I am using Raspbian Debian Wheezy.

When I go to DIR /dev/ and use $ ls, I can only find tty0 up to tty63. I have searched on the internet and some say that you can use ttyAMA0, but this does not work. I have also searched for the same problem, but have not found an answer to my problem.

I have used $ lsusb which gave me 4 devices (001-004) on Bus 001. I can see that, for example, my USB keyboard is listed as Bus 001 Device 004: ID 1532:010b Razer USA, Ltd. and if I run $ dmesg | grep Manufacturer I get that: [xxxxxxxxx] usb 1-1.2: Manufacturer: Razer

So my question is why does my USB device not get listed as ttyUSB[id]? Do I have to manually attach it?

I am a bit noob when it comes to Linux.

Hope someone can help me!


Solution

  • I have some bad news for you. The reason you have no /dev/ttyUSB[n] devices on the RPi (when you connect your Arduino) is because you need the Arduino drivers (FTDI drivers in particular). The unfortunate thing is that these drivers don't yet exist for the Arm platform (which includes the RPi). This is according to the FTDI web page showing support. Note the lack of Linux driver support for Arm.

    Apparently on Arm running Linux the only way to program the Arduino is via the serial port interface directly via the GPIO pins. Information on doing this can be found here . You will also have to do something similar on the Arduino side see this information.

    Once you have the two devices connected via straight serial then your going to probably run into another SNAFU. By default apparently on the RPi Linux will use the serial port for sending debug/console output. In order to use the serial interface for something that behavior has to be modified. This article discusses that. In particular disabling the kernel from using the serial port for terminal use this would seem to apply:

    The following steps (based on a clean 2012-07-15-wheezy-raspbian install

    1. Open a terminal on the Raspberry, or connect to Raspberry Pi through SSH.
    1. Make a backup of the /boot/cmdline.txt file. sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt
    1. Edit /boot/cmdline.txt file: sudo vi /boot/cmdline.txt

    This file contains: dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 $

    Remove the parameters that reference the UART serial port (ttyAMA0): dwc_otg.lpm_enable=0 console=tty1 $

    1. Comment next line in /etc/inittab: T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
    1. Reboot Raspberry Pi sudo reboot

    If you use a different Linux distro than Debian it would be different but the basics would still apply (modifying the kernel command line)