From GumstixDocsWiki
As of 2010, all Gumstix customers should be using Gumstix OpenEmbedded, not Buildroot.
The Gumstix Developer's website is www.gumstix.net
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
For legacy customers still requiring buildroot:
Contents[hide] |
USBNet on Verdex
September 2009 USBnet on verdex working.
In this example it is required to patch pxaregs to include extra registers available on the PXA270. Specifically GPIO_100 and UP2OCR_DPPUE.
gumstix.h in gumstix-kernel-2.6.21 needs to be patched to point to the correct USB registers for PXA270.
Also a patch to ether.c in gumstix-kernel-2.6.21 so that the PXA270 USB Client mode comes up as CDC_SUBSET. This enables the usbnet to be accessed from Windows via the MCCI commercial Windows driver. I had no luck with RNDIS. So turn off RNDIS in the kernel config.
These patches are relative to the gumstix-verdex OE tree.
pxa270regs.patch - Lots of added registers related to pxa270 to be placed in pxaregs/gumstix-custom-verdex
This patch is too big to post here and can be found in gumstix-users@lists.sourceforge.net with Subject: PXA270 USB Client Working!
pxa-extra-usb-regs.patch - Additional usb UP2OCR registers to be placed in pxaregs/gumstix-custom-verdex
--- pxaregs-1.14-r0/pxaregs.c 2009-09-17 09:44:52.000000000 +1000 +++ pxaregs-1.14-r0/pxaregs.c.new 2009-09-17 09:46:47.000000000 +1000 @@ -79,10 +79,20 @@ { "ISAR_SA", 0x403016A0, 0, 0x0000007f, 'x', "I2C Slave Address" }, { "UP2OCR", 0x40600020, 0, 0xffffffff, 'x', "USB Port 2 Output Control Register" }, -{ "UP2OCR_SEOS", 0x40600020, 24, 7, 'x', "USB Port 2 Single-Ended Output Select" }, -{ "UP2OCR_HXOE", 0x40600020, 17, 1, 'x', "USB Port 2 Tranceiver OE" }, -{ "UP2OCR_HXS", 0x40600020, 16, 1, 'x', "USB Port 2 Tranceiver Output Select" }, +{ "UP2OCR_CPVEN", 0x40600020, 0, 1, 'x', "Charge Pump Vbus Enable" }, +{ "UP2OCR_CPVPE", 0x40600020, 1, 1, 'x', "Charge Pump Vbus Pulse Enable" }, +{ "UP2OCR_DPPDE", 0x40600020, 2, 1, 'x', "Host Port 2 Transceiver D+ Pull Down Enable" }, +{ "UP2OCR_DMPDE", 0x40600020, 3, 1, 'x', "Host Port 2 Transceiver D- Pull Down Enable" }, +{ "UP2OCR_DPPUE", 0x40600020, 4, 1, 'x', "Host Port 2 Transceiver D+ Pull Up Enable" }, +{ "UP2OCR_DMPUE", 0x40600020, 5, 1, 'x', "Host Port 2 Transceiver D- Pull Up Enable" }, +{ "UP2OCR_DPPUBE", 0x40600020, 6, 1, 'x', "Host Port 2 Transceiver D+ Pull Up Bypass Enable" }, +{ "UP2OCR_DMPUBE", 0x40600020, 7, 1, 'x', "Host Port 2 Transceiver D- Pull Up Bypass Enable" }, +{ "UP2OCR_EXSP", 0x40600020, 8, 1, 'x', "External Transceiver Speed Control" }, +{ "UP2OCR_EXSUS", 0x40600020, 9, 1, 'x', "External Transceiver Suspend Enable" }, { "UP2OCR_IDON", 0x40600020, 10, 1, 'x', "OTG ID Read Enable" }, +{ "UP2OCR_HXS", 0x40600020, 16, 1, 'x', "USB Port 2 Tranceiver Output Select" }, +{ "UP2OCR_HXOE", 0x40600020, 17, 1, 'x', "USB Port 2 Tranceiver OE" }, +{ "UP2OCR_SEOS", 0x40600020, 24, 7, 'x', "USB Port 2 Single-Ended Output Select" }, { "HW_MCR", 0x41600010, 0, 0xffffffff, 'x', "HWUART Modem Control Register" },
gumstix-pxa270-usb-client-regs.patch - Adds in preprocessor directives for GPIO_100 and GPIO_27 to be placed in linux/gumstix-kernel-2.6.21/gumstix-custom-verdex as noted by David Kilp an USBClient Verdex
--- linux-2.6.21/include/asm-arm/arch-pxa/gumstix.h 2009-09-16 14:19:51.000000000 +1000 +++ linux-2.6.21-new/include/asm-arm/arch-pxa/gumstix.h 2009-09-16 14:24:57.000000000 +1000 @@ -24,6 +24,11 @@ #define GPIO_GUMSTIX_USB_GPIOn 81 #define GPIO_GUMSTIX_USB_GPIOx 83 +#elif CONFIG_ARCH_GUMSTIX_VERDEX + +#define GPIO_GUMSTIX_USB_GPIOn 100 +#define GPIO_GUMSTIX_USB_GPIOx 27 + #else #define GPIO_GUMSTIX_USB_GPIOn 35
gumstix-pxa270-usb-subset.patch - Make PXA270 USBnet use CDC_SUBSET
--- linux-2.6.21/drivers/usb/gadget/ether.c 2009-09-17 17:24:33.000000000 +1000 +++ linux-2.6.21-new/drivers/usb/gadget/ether.c 2009-09-18 10:17:15.000000000 +1000 @@ -259,9 +259,10 @@ #endif #ifdef CONFIG_USB_GADGET_PXA27X -#define DEV_CONFIG_CDC -extern struct usb_ep* pxa27x_ep_config(struct usb_gadget *gadget, - struct usb_endpoint_descriptor *desc,int config,int interface,int alt); +#define DEV_CONFIG_SUBSET +//#define DEV_CONFIG_CDC +//extern struct usb_ep* pxa27x_ep_config(struct usb_gadget *gadget, +// struct usb_endpoint_descriptor *desc,int config,int interface,int alt); #endif #ifdef CONFIG_USB_GADGET_S3C2410
We need to turn on the specific PXA270 internal pull-up resistor to enable USB Client interface. Using patched pxaregs for example we can enter in information into /etc/network/interfaces on the gumstix. The UP2OCR_DPPUE switch needs to be reset each time you bring the interface up. You will require to statically set an IP address on your host machine or provide udhcpd on the gumstix to issue an IP Address to the host
auto usb0 iface usb0 inet static address 192.168.211.1 netmask 255.255.255.0 network 192.168.211.0 broadcast 192.168.211.255 down pxaregs UP2OCR_DPPUE 0 up pxaregs UP2OCR_DPPUE 1
As of August, 2007, the USBNet module does not work well on the Verdex. According to this mailing-list message from Craig Hughes,
The linux USB client driver for the PXA270 has serious problems, which basically mean it doesn't currently work, and might not ever work (there was discussion on the linux-arm mailing list about this a week or two ago). So effectively, the PXA270 is host-only, even though there is nominal USB client support on the SoC, in practice it does not work. David Brownell, the linux-usb guy, is very perjorative on the PXA family's USB client controllers.
USBNet under Linux
USBNet (tcp/ip connection over usb) depends heavily on the kernel-version you are using on the host, and the gumstix-image you've flashed on your gumstix: - If you have a Linux 2.6.10+ everything should work out of the box (regardless of the gumstix-image). All you need to do, is modprobe the usbnet-module. If you don't have one, you'll need to recompile your modules/kernel. You can then proceed to test your connection.
If you have the above kernel and the usbnet modules loaded but it still does not work, then when compiling the kernel make sure when doing make menuconfig that Device Drivers -> USB Support -> USB Network Adapters -> Embedded Arm Linux Links (CONFIG_USB_ARMLINUX) is selected Also under Device Drivers -> USB Support -> USB Gadget Support The following are selected: Support for USB Gadgets, USB Gadget Drivers (Ethernet Gadget), Ethernet Gadget, and RNDIS support are selected. I selected them to be included in the kernel, not as modules. I do not know if this makes a difference.
For Linux 2.6.13.?+ you will need to add: Device Drivers -> USB Support -> USB Network Adapters. Select "Multi-purpose USB Networking Framework" "Simple USB Network Links (CDC Ethernet Subset)" and "Embedded ARM Linux Links (iPaq, ...)" You can also select "Host for RNDIS devices (EXPERIMENTAL)"
- If you have Linux 2.6.9-, you'll need to patch the kernel: drivers/usb/net/usbnet.c needs to be changed, so that it recognizes the gumstix as usb-net device (the file should be in the attachement-section of this page):
--- usbnet_orig.c 2004-11-12 22:55:56.000000000 +0100 +++ usbnet.c 2004-11-22 20:37:14.000000000 +0100 @@ -3320,6 +3320,10 @@ }, { USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader .driver_info = (unsigned long) &blob_info, +}, { + // Linux Ethernet/RNDIS gadget on pxa210/25x/26x + USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203), + .driver_info = (unsigned long) &linuxdev_info, }, #endif
Just as reminder. The usual procedure to patch:
cd /usr/src/linux/drivers/usb/net patch < ~/usbnet.patch
If you build usbnet as a module you'll just need to rebuild and install the modules (make modules modules_install), otherwise you'll need to rebuild the kernel. This solves the host-part. The attached patch doesn't work with recent gumstix-images though, as they are made work with Windows too (and only recent linux-kernels are able to deal with this). The easiest workaround is building the gumstix-image without RNDIS (==windows-usb-net). Obviously you won't be able to attach your gumstix to Windows-machines anymore. First fetch the build-root environment (using svn as described above), but do not yet build it. Enter the gumstix-buildroot/sources directory and disable RNDIS in the linux.conf file:
cd gumstix-buildroot/sources sed -i 's/CONFIG_USB_ETH_RNDIS=y/# CONFIG_USB_ETH_RNDIS is not set/' linux.config
Now build you environment as usual:
cd .. make
This should create a new rootfs.arm_nofpu.jffs2 image that you can upload to the Gumstix.
USBNet under Windows
-
Main article: Windows XP usbnet
In the current revision (r434) usb isn't started automatically at boot-up anymore. In this case just add "auto usb0" to /etc/network/interfaces (on the gumstix) before proceeding. Normally you just need to install the linux.inf from the gumstix linux source tree (gumstix-buildroot/build_arm/linux-X/Documentation/usb). You can get the file in the attachement-section of this page too. Windows should then automatically detect your gumstix. If it doesn't your gumstix-image might not be up to date. Flash a newer version and try again. Windows should automatically detect your gumstix. Follow Windows_XP_usbnet to install the driver. You'll need DOS version of linux.inf external link before proceeding. Dave Hylands has some nice instructions of getting dhcp to work under windows. Have a look at his pageexternal link, until its content is merged here.
If you are using Windows 2000, you may need an RNDIS driver, which is available at: RNDIS driver
Windows 2000 does not appear to support bridging, however if you configure Windows' RNDIS interface to use 192.168.1.1, and Gumstix' usb0 to use 192.168.1.2, you should be able to access the Gumstix from your Windows box. (Or use 192.168.2.X if your network already uses 192.168.1.
USBnet on Mac OS X
Head over to the AJZaurusUSB page and get the latest version of their Mac OS X driver, install the driver but before you restart you need to add Gumstix to the list of devices. Using the terminal edit the file /System/Library/Extensions/AJZaurusUSB.kext/Contents/Info.plist and add the following below
<key>IOKitPersonalities</key> <dict>
the text:
<key>Gumstix</key> <dict> <key>CFBundleIdentifier</key> <string>org.lucidcake.driver.AJZaurusUSB</string> <key>IOClass</key> <string>org_lucidcake_driver_AJZaurusUSB</string> <key>IOProviderClass</key> <string>IOUSBDevice</string> <key>idProduct</key> <integer>42146</integer> <key>idVendor</key> <integer>1317</integer> </dict>
Restart and when you plug the usb cable in (and waited a bit for Linux to boot) you should be informed of a new network device which once configured will allow you to ssh in.
Thanks to OpenEZX for describing the method and pointing me in the direction of the latest driver.
USBnet on Mac OS X 10.5.X
By default, Mac OS X 10.5.X prefers to use the CDC-ACM interface of USB networking devices instead of CDC-ECM with the exception of a broadcom network card. The result being a serial network interface instead of an ethernet network interface. To remedy this, you can download a patched AppleUSBCDC driver that will recognize the usb id/vendor pair of g_ether and force it to use CDC-ECM (ethernet network interface). You can obtain the OS X 10.5.X patched driver from: http://bugcommunity.com/downloads/usbcdc-g_ether.zip. Source code: http://bugcommunity.com/downloads/files/AppleUSBCDCDriver-g_ether.326.4.1.zip
Installation guide is found at http://bugcommunity.com/wiki/index.php/Start_Guide_Mac_OS_X_10.5
The issue of multiple network interfaces showing up whenever the device is rebooted/power-cycled is due to the g_ether driver randomly setting the host and device mac addresses. This problem is remedied by passing the same host and device mac addresses during the modprobe of g_ether.
For example:
modprobe g_ether host_addr=46:0d:9e:67:69:eb dev_addr=46:0d:9e:67:69:ec
Testing the connection
If everything works as expected you should have an usb0 interface (ifconfig -a) on both host (if Linux) and Gumstix after having plugged the USB-cable. From here on it's standard networking. If you are unfamiliar with Linux/Windows networks here some short lines to test your connection. Under Linux type "ifconfig", and look for adresses starting with 192.168.0.X. If you have some, replace 192.168.0.1 with 10.0.0.1 and 192.168.0.2 with 10.0.0.2 in the following lines (same applies for Windows: if you have already a network that uses 192.168.0.X, switch to another network): On the Gumstix (over serial line):
# ifconfig usb0 192.168.0.2
On the linux-machine:
# ifconfig usb0 192.168.0.1 # ssh root@192.168.0.2
And you should be connected to your gumstix over the usb-connection. Under Windows just configure the USB-interface to have 192.168.0.1 as IP-address. You can test the connection by httping to the gumstix (http://192.168.0.2).
If you want to have a static IP on your gumstix edit /etc/network/interfaces on you gumstix and replace with
Note however, that reflashing the gumstix will erase this file! Therefore the cleanest solution is to add a dhcp-server on the host-machine.
iface usb0 inet dhcp pre-up /sbin/modprobe g_ether;/sbin/modprobe af_packet post-down /sbin/modprobe -r g_ether
iface usb0 inet static address 192.168.0.2 netmask 255.255.255.0 pre-up /sbin/modprobe g_ether;/sbin/modprobe af_packet post-down /sbin/modprobe -r g_ether
You might also have a look at the Ethernet Gadget-page.