BeagleBoard Rev C5 Ethernet over USB

BeagleBoard Rev C5 Ethernet over USB


This is a simple tutorial on how to use Buildroot (http://buildroot.uclibc.org/ ) to build a simple embedded Linux system for the BeagleBoard RevC5 ( http://beagleboard.org/) and enable ethernet over usb communication between the BeagleBoard and a Windows 7 Machine.

This was done on an Ubuntu 10.04 Virtual Machine. I assume you know how to connect up your board with power and serial to USB connections. I also assume you have a SD card reader connected to your machine with at least a 4 GB SD card inserted. You need to format the SD card to have 2 partitions. The first is a FAT partition marked with a boot flag and the second is an EXT3 ( Linux ) journaled partition to hold the root file system. Check out this post for a script to do this for you-->http://cgit.openembedded.org/cgit.cgi/openembedded/tree/contrib/angstrom/omap3-mkcard.sh.

This tutorial also depends on the information in a past post ( http://ptrackapp.com/apclassys-notes/beagleboard-rev-c5-simple/) in order to configure a basic system with Buildroot, such as console and other basic configuration options.

Download buildroot (http://buildroot.uclibc.org/download.html ). I used the 2012.05 version. Please see my previous posts on how to setup a basic system that will boot on the BeagleBoard. We will build on that information. Enter the buildroot directory and type the following in a terminal:

make menuconfig

This will open a Menu Configuration program similar to what is used to configure the Linux Kernel.

Enable the correct modules in the linux kernel. Go to Device Drivers > USB Support > USB Gadget Support.

Make it look like the image below enabling the correct drivers.

Now rebuild the kernel incorporating the new changes in the Buildroot directory:

make

Copy the files to your SD card and boot the BeagleBoard with the SD card.

Now attached the gadget USB cable to the board and the other end (regular USB) to the

host machine running Windows ( don't attach the cable to the Linux VM )

When the board is booted, load the 'g_ether' driver:

modprobe g_ether

Run the 'dmesg' command to see that the kernel recognizes the gadget.

You should see something like:

gadget: high-speed config #2: RNDIS

You will now see the 'usb0' device recognized as a networking interface

by running the 'ifconfig -a' command:

# ifconfig -a

eth0 Link encap:Ethernet HWaddr E6:A3:50:49:5E:86

inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1488 Metric:1

RX packets:39100 errors:0 dropped:0 overruns:0 frame:0

TX packets:4223 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:7257108 (6.9 MiB) TX bytes:711748 (695.0 KiB)

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:2 errors:0 dropped:0 overruns:0 frame:0

TX packets:2 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:288 (288.0 B) TX bytes:288 (288.0 B)

usb0 Link encap:Ethernet HWaddr A6:87:0A:94:16:B2

BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Assign an ip address to the new 'usb0' device and bring it up with the following

commands:

# ifconfig usb0 192.168.1.24

# ifconfig usb0 up

Now run the '/sbin/ifconfig -a' command again to see that it has an ip address:

usb0 Link encap:Ethernet HWaddr A6:87:0A:94:16:B2

inet addr:192.168.1.24 Bcast:192.168.1.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:56 errors:0 dropped:0 overruns:0 frame:0

TX packets:3 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:5165 (5.0 KiB) TX bytes:258 (258.0 B)

Open up the 'Network Connections' dialog box in Windows and you will see a

'Local Area Connection 2' device with the 'USB Ethernet / RNDIS Gadget'

description.

Right-click on that device and click 'properties'. Uncheck the 'TCP/IPv6' checkbox

and left-click the 'Internet Protocol Version 4 (TCP/IPv4)' row to select it. Now

click on the 'Properties' button. Click on the 'Alternate Configuration' tab on the

top of the dialog box and select the 'User Configured' button. Put in an ip address

for the gadget, a 'Subnet mask', and also the 'Default Gateway', which should be

the same as the 'usb0' ip address assigned to the gadget on the target board. See

the following screenshots.

Now click 'Ok' and open a windows cmd terminal. Ping the 'Default gateway' ip address,

i.e. the ip address of 'usb0' on the target board. You should see successful pinging

messages.


Feel free to leave feedback - happy coding!



ClassyBits 2016