[beagleboard] Running a USB-to-Serial adapter from the BeagleBoard

It’s not that I want to attach a USB-to-Serial dongle to my PC and
talk to the BeagleBoard (BB). I want to plug the dongle into the BB
(USB side) and write some code to talk to other junk (like my LCD
display, GPS module, etc.). I’ll write my own “C” code to talk to
these.

I’m brand new at doing this Linux stuff. I loaded Angstrom (kernel
2.6.32) onto the BB and I have it running. I can access the BB
through an LCD monitor (on the DVI port), USB keyboard, and USB mouse
(I have a self powered USB hub). I also have the system console
working out of the RS232 port of the BB. From a console in the
Angstrom GUI, I can output to the RS232 console by doing this from the
command line:

# echo “Hi Curt” > /dev/ttyS2

I have three different USB-to-Serial adaptors and they all seem to do
the same thing (not work). I will limit this description to the
“USB-2920” from Cables Unlimited. It looks like this is using the
FTDI chipset which seems popular.

The dongle is plugged in at startup to the “HS USB Host Port” on the
BB via the self powered hub. Using the “dmesg” command, I can get the
messages associated with the USB/Serial dongle:

<snip on>
[ 22.197753] usb 1-2.4: new full speed USB device using ehci-omap
and address 5
[ 22.336853] usb 1-2.4: New USB device found, idVendor=0403,
idProduct=6001
[ 22.344268] usb 1-2.4: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[ 22.352447] usb 1-2.4: Product: FT232R USB UART
[ 22.357513] usb 1-2.4: Manufacturer: FTDI
[ 22.362060] usb 1-2.4: SerialNumber: A600dqpX
<snip off>

Using the “cat /proc/bus/usb/devices” command, I get the following
messages associated with the dongle:

<snip on>
T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0403 ProdID=6001 Rev= 6.00
S: Manufacturer=FTDI
S: Product=FT232R USB UART
S: SerialNumber=A600dqpX
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 90mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
<snip off

I don’t see any new devices in the “/dev/” directory that might be
associated with the dongle. From a console with user privileges, I
get the following result:

<snip on>
curt@beagleboard:~$ echo "Hi Curt" > /dev/ttyUSB0
-sh: can't create /dev/ttyUSB0: Permission denied
<snip off>

If I get to a root shell by doing “su –“, then the command doesn’t
report any errors:

<snip on>
root@beagleboard:~# echo "Hi Curt" > /dev/ttyUSB0
root@beagleboard:~#
<snip off>

I still don’t see any RS232 text out of the dongle with the above
command. But now the “/dev/ttyUSB0” device shows up in the directory.

So any ideas of how I can get a USB-to-Serial adapter to work when the
USB is plugged into the BeagleBoard?

Curt

It’s not that I want to attach a USB-to-Serial dongle to my PC and
talk to the BeagleBoard (BB). I want to plug the dongle into the BB
(USB side) and write some code to talk to other junk (like my LCD
display, GPS module, etc.). I’ll write my own “C” code to talk to
these.

I’m brand new at doing this Linux stuff. I loaded Angstrom (kernel
2.6.32) onto the BB and I have it running. I can access the BB
through an LCD monitor (on the DVI port), USB keyboard, and USB mouse
(I have a self powered USB hub). I also have the system console
working out of the RS232 port of the BB. From a console in the
Angstrom GUI, I can output to the RS232 console by doing this from the
command line:

# echo “Hi Curt”> /dev/ttyS2

I have three different USB-to-Serial adaptors and they all seem to do
the same thing (not work). I will limit this description to the
“USB-2920” from Cables Unlimited. It looks like this is using the
FTDI chipset which seems popular.

The dongle is plugged in at startup to the “HS USB Host Port” on the
BB via the self powered hub. Using the “dmesg” command, I can get the
messages associated with the USB/Serial dongle:

<snip on>
[ 22.197753] usb 1-2.4: new full speed USB device using ehci-omap
and address 5
[ 22.336853] usb 1-2.4: New USB device found, idVendor=0403,
idProduct=6001
[ 22.344268] usb 1-2.4: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[ 22.352447] usb 1-2.4: Product: FT232R USB UART
[ 22.357513] usb 1-2.4: Manufacturer: FTDI
[ 22.362060] usb 1-2.4: SerialNumber: A600dqpX
<snip off>

Using the “cat /proc/bus/usb/devices” command, I get the following
messages associated with the dongle:

<snip on>
T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0403 ProdID=6001 Rev= 6.00
S: Manufacturer=FTDI
S: Product=FT232R USB UART
S: SerialNumber=A600dqpX
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 90mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
<snip off

I don’t see any new devices in the “/dev/” directory that might be
associated with the dongle. From a console with user privileges, I
get the following result:

<snip on>
curt@beagleboard:~$ echo "Hi Curt"> /dev/ttyUSB0
-sh: can't create /dev/ttyUSB0: Permission denied
<snip off>

If I get to a root shell by doing “su –“, then the command doesn’t
report any errors:

<snip on>
root@beagleboard:~# echo "Hi Curt"> /dev/ttyUSB0
root@beagleboard:~#
<snip off>

I still don’t see any RS232 text out of the dongle with the above
command. But now the “/dev/ttyUSB0” device shows up in the directory.

But it's not the device you want; you've just created a normal file.
Get rid of it, as it will only cause pain if you manage to get the
system to recognize your device.

So any ideas of how I can get a USB-to-Serial adapter to work when the
USB is plugged into the BeagleBoard?

It looks like the module which supports this device is not being
loaded [automatically]. Can you verify that you have a file
   /lib/modules/*/kernel/drivers/usb/serial/ftdi_sio.ko

You might just try this:
   # modprobe ftdi_sio

Note: have you tried this USB-Serial device on a normal Linux desktop?

Thanks Gary.

When I try to run the “modprobe” command, this is what I get:

<snip on>
curt@beagleboard:~$ su -
root@beagleboard:~# modprobe ftdi_sio
FATAL: Could not load /lib/modules/2.6.32/modules.dep: No such file or
directory
root@beagleboard:~#
<snip off>

There does not appear to be a “/lib/modules/2.6.32” directory. There
are “/lib/modules/2.6.28-omap1” and “/lib/modules/2.6.29-omap1”
directories. There is a “/lib/modules/2.6.29-omap1/kernel/drivers/usb/
serial/ftdi_sio.ko” file.

I think I got the Angstrom image from here:
http://www.angstrom-distribution.org/node/47
http://www.angstrom-distribution.org/demo/beagleboard/

Is that the wrong image? Should I get one from somewhere else?
Should I build my own?

Again, I really new to Linux (as if you couldn’t tell).

Curt

Hi!

I guess next step is to run stty on the beagle side and find what parameters of the tty are used.

Also it is very good to see what your dmesg output is to find if your dongle is enabled in the kernel. lsmod will help to find out if a respective module has been loaded for the dongle.

Of course only root privileges give you access to the tty port.

regards,
Max

2010/4/20 Gary Thomas <gary@mlbassoc.com>

The problem is that your root file system image was built using
the 2.6.28-omap1 kernel but you've booted 2.6.32. In general, it's
not safe to mix & match kernel versions and modules (most times not
even allowed).

Try downloading the modules appropriate for your kernel, probably:
   http://www.angstrom-distribution.org/demo/beagleboard/modules-2.6.32-r70+gitr7b8926aa626991fa087b00f6bbc1fb6b0e8269b0-beagleboard.tgz
I'm assuming that you booted this kernel:
   http://www.angstrom-distribution.org/demo/beagleboard/uImage-2.6.32-r70+gitr7b8926aa626991fa087b00f6bbc1fb6b0e8269b0-beagleboard.bin

Then, on your board:
   # tar -zxf modules-2.6.32-r70+gitr7b8926aa626991fa087b00f6bbc1fb6b0e8269b0-beagleboard.tgz -C /
This will extract the modules to your root file system (SD card?) Now you
should have a /lib/modules/2.6.32/ directory.

If you reboot, your USB-serial adapter should start to work.

Thank Gary.

Not having the correct root file system was my problem. I re-image my
SD and now I get this:

<snip on>
[ 41.179687] usbcore: registered new interface driver usbserial
[ 41.338378] USB Serial support registered for generic
[ 41.461822] usbcore: registered new interface driver
usbserial_generic
[ 41.468414] usbserial: USB Serial Driver core
[ 42.088500] USB Serial support registered for FTDI USB Serial
Device
[ 42.259033] ftdi_sio 2-2.4:1.0: FTDI USB Serial Device converter
detected
[ 42.425384] usb 2-2.4: Detected FT232RL
[ 42.429260] usb 2-2.4: Number of endpoints 2
[ 42.633636] usb 2-2.4: Endpoint 1 MaxPacketSize 64
[ 42.638458] usb 2-2.4: Endpoint 2 MaxPacketSize 64
[ 42.829376] usb 2-2.4: Setting MaxPacketSize 64
[ 42.944000] usb 2-2.4: FTDI USB Serial Device converter now
attached to ttyUSB0
[ 43.065002] usbcore: registered new interface driver ftdi_sio
[ 43.130584] ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver
<snip off>

Curt