Introduction: CHIP USB OTG Ethernet Gadget
THIS WILL REQUIRE YOU RE-FLASH YOUR CHIP WITH THE DEBIAN KERNEL, HAVE WIFI ACCESS TO THE SAME NETWORK FOR THE HOST AND CHIP, AND YOU WILL NEED TO HAVE A USB-UART CABLE!
This is my first Instructable, so if it can be improved please let me know! I recently got a Next Thing Co CHIP single board Linux computer that I had backed on KickStarter (http://getchip.com/). The unit has some pretty impressive spec's, and is a steal at just $9! By default, the unit mounts as a USB Serial device, which is nice to get to the command line easily, though in my opinion, SSH is a much better option for interfacing and transferring data. The unit does have built in WiFi and Bluetooth, the first of which can be used for SSH if your host computer is connected to the same wireless network as the CHIP. For me, this can be an issue as I am not always in a place where I can get the CHIP onto the same wireless network. The CHIP is able to mount as a USB Serial device because it is using what is known as Gadget mode on the USB on the go (OTG), which also has modules for mounting as USB-Ethernet Gadget (which is what the Beaglebone Black does for those who are familiar). I wrote this to explain the steps I took to enable this functionality on the CHIP.
Step 1: Step 1: Setting Up the Required Tools
I am not going to re-invent the wheel for setting up the tools to get ready to flash the CHIP as they have documented this well at: http://docs.getchip.com/#installing-c-h-i-p-sdk.
You will need to have followed these steps and be able to flash the CHIP.
Step 2: Step 2: Flash the Chip With Debian
Following the steps provided in Step 1, flash the CHIP with the Debian option:
Step 3: Step 3: Make the Defconfig
Next you will change into the CHIP-buildroot directory in your vagrant VM:
Then run make chip_defconfig to get default settings:
$ sudo make chip_defconfig
Step 4: Step 4: Run the Linux-menuconfig and Make Changes Needed
Now you should be able to run the linux menuconfig to make the needed changes to the Kernel modules:
$ sudo make linux-menuconfig
When the menu config screen comes up you will need to accomplish the following things:
- Scroll down to the Device Drivers line and press Enter
- Scroll down to USB Support line and press Enter
- At the very bottom scroll to USB Gadget Support and press Enter
- Scroll down to USB Gadget Drivers and press Enter
- Scroll down to Ethernet Gadget and press "m"
- Use the right arrow to move to Save and press Enter
- Exit all the way out of the menuconfig
Step 5: Step 5: Make the Kernel
Now run the make command to compile the kernel. This will take about an hour or so, so you may want to stretch your legs...
$ sudo make
Step 6: Step 6: Move the Files to the CHIP
This is where you will need to have the CHIP on the same WiFi network as the host computer, and know the IP address of the CHIP.
Next we will cd into the ~/CHIP-buildroot/output/images folder and copy our files over to the CHIP:
$ cd ~/CHIP-buildroot/output/images
$ scp -r * root@<insert CHIP's IP address here>:/boot/
after those files have been moved to the CHIP we will copy over the modules:
$ cd ~/CHIP-buildroot/output/target/lib/modules
$ scp -r * root@<insert CHIP's IP address here>:/lib/modules
Step 7: Step 7: Re-Boot and Configure the CHIP
After the files have been copied over, you can reboot the CHIP. After the CHIP reboots, it will no longer mount on your computer as a USB Serial Converter, so you will need to have an external USB to Serial converter to make the next changes!
Once the CHIP has been rebooted, log in to the terminal using the USB Serial Converter and check that the usb0 appears as a network adapter:
chip $ sudo ifconfig
and you should see usb0 listed as an adapter. Congrats on getting here!
next you should be able to follow the steps found here: http://linux-sunxi.org/USB_Gadget, starting at the point where the run modprobe g_ether, to setup your static or DHCP settings for the CHIP!
You will then want to edit the modules file used to load the module at boot:
chip $ sudo nano /etc/modules
And add the g_ether module.
Step 8: Other Guides and Helpful Hints
Adafruit has a guide for doing this on the Raspberry Pi Zero which is very helpful to follow along: https://learn.adafruit.com/turning-your-raspberry-...
I did also notice that on some windows computers it did not register the CHIP as a Gadget Ethernet / RNDIS device which I was able to resolve by installing the Beaglebone Black drivers kit. After installing those drivers windows saw the RNDIS Device, and I was able to successfully SSH into the CHIP via the USB cable that was also powering it from my computer.
We have a be nice policy.
Please be positive and constructive.