As an embedded systems engineer I am always interested in new systems. I’ve worked with the NixCore X1 boards and got pretty deep in to the OpenWRT/LEDE environment. For those that don’t know, OpenWRT is a Linux system designed for deeply embedded systems with pretty limited resources. It was designed to be run on routers like the Linksys WRT54G series but it is much more than that. I’ve been keeping my eye on dev boards and SOMs that support OpenWRT and I came across the LinkIt series of boards from Seeed Studios and Mediatek, specifically the LinkIt Smart 7688. These are fully supported by OpenWRT, are FCC certified and available for only $15 each! I purchased one of the LinkIt Smart 7688 boards a while back and haven’t really messed with it too much. Since Protologcal was due for a new post I thought I would share my experience working with the LinkIt, booting it up for the first time, poking around the insides, and then upgrading the firmware.
- MT7688AN Mediatek SOC
- 128MB RAM
- 32MB SPI FLASH
- 22 GPIO
- 3x UART
- USB Host
- Ethernet connections (100 base)
- 802.11bg/g/n 2.4GHz
With OpenWRT embedded systems like the LinkIt, there is almost always a serial port console allowing access to the bootloader and the root system. This allows developers to upgrade the firmware from a physical connection with the least amount of software. This is the starting point for all of my embedded system hacking, get the console and see what the system does.
I added the LinkIt to a breadboard, found the pinout diagram, connected up my FTDI232R-3v3 cable to UART2 as per this info, 57600 baud 8-N-1. Powering up the board through the micro-USB and you get the very familiar Ralink uBoot menu (Ralink is the original SOC+WiFi manufacturer purchased by Mediatek). uBoot is a bare-metal bootloader application that allows you to update the firmware on the device before the ‘true’ system boots. We will dive more in to that later. By default uBoot times out after a few seconds and hands control off to the Linux system partition which boots the kernel and enables the system. After a ton of messages we can hit enter and are dropped in to the standard OpenWRT console.
I was really impressed to see the standard OpenWRT 15.01 Chaos Calmer banner on the console, this to me means that Seeed or Mediatek didn’t do a lot of messing around with the stock system. For those who have worked with OpenWRT the system was pretty vanilla, the WiFi config uses the standard /etc/config/wireless, the init system appears to be unmodified, opkg reported all the packages (stock package list here), dropbear ssh server, etc. This is really really good to see, nothing crazy was running and taking up 100% CPU, so we have a pretty darn open development platform right out of the box, nicely done Mediatek!
I like to roll my own OpenWRT firmware, that way I have full control and I know what is installed in the system (no NSA or botnet backdoors!). Before getting in to building a custom OpenWRT image I like know that I can go back to the stock image if I really mess something up. Mediatek has a lot of information on how to upgrade the firmware on their Mediatek Labs website, so after some reading here is how you can flash a new image:
- From stock firmware there is a web based flashing utility that uploads an image file and uses OpenWRT’s sysupgrade utility
- You can also copy the firmware image to a USB drive and use uBoot to flash the image
- uBoot has menu options for downloading via Serial and TFTP
The web upgrade UI is from the device, so you need to connect a computer to the open WiFi access point “Linkit_XXXXX” and go to http://192.168.100.1 from a browser. Using the web based upgrade path I was able to upgrade my LinkIt to the latest 0.9.4 firmware just as a test. This upgrade took a few minutes and there was no real indication on what was going on, other than the blinking orange LED. The serial console didn’t show anything during the sysupgrade, so you just have to upload and hope for the best.
The uBoot USB based upgrade path is a little better. First you copy your image file to a FAT formatted USB drive and name it lks7688.img. Then you plug the drive in to an USB OTG cable connected to the USB data port. Hold the wifi button on the LinkIt and reset the device with the reset button. With the serial console connected you can see that uBoot detects the wifi button held down, and after 5 seconds it starts searching for a USB drive. What is interesting is that the console outputs:
“5: System Load Linux then write to Flash via USB Storage.”
If you look at the boot menu there is no option for 5, it jumps from 4 to 7. Rebooting without the wifi button pressed, and entering 5 into the uboot menu and the system drops in to the same USB update routine, so there are a few ways to start this upgrade.
When uBoot finds the drive it will automatically burn the lks7688.img system image file to the correct location in the SPI flash. The system reboots and you have a new firmware image. The USB update still takes about 2 minutes, but that’s better than the 3+ minutes for the web update method. I did not try the serial or TFTP upgrade methods, that is going to take some digging in to the SPI flash partitioning done by Mediatek, but I’m sure it is possible. Again, I was really happy to see there is a commonly accepted bootloader method to upgrade firmware, not some janky software solution!
Overall, I am quite impressed with the LinkIt Smart 7688, it is powerful, open, well documented, and cheap embedded system. The next steps are to create a footprint in Eagle PCB, make a few adapter boards for some hardware I have here, and then build a custom OpenWRT image. In a later post I will go over how to build and download OpenWRT, with support for the WiFi hardware on the LinkIt, to make a truly custom embedded Linux platform!