Now in the trunk! -
This is the main thread for installing OpenWRT HooToo HT-TM02 and HT-TM04 micro-routers. See other updates and notes at the bottom of this post before using these instructions....
A little background on the device.
This is nice little unit with approximately the same functionality, about the same performance, and TWICE the amount of FLASH (8mb vs 4mb). It's also considerably smaller and a bit cheaper (I paid $18 free shipping Amazon prime. Some have seen it for $15 or less). Feature set is nearly identical to the 703..
- 8mb SPI Flash
- 32mb SDRAM
- USB host
- One ethernet
- 802.11n wifi
- reset button
- mode switch
Here's a view:
Here's the top of the board
.. and the bottom. The serial console connections are the 4 large pads on the bottom edge - they are marked..
The wifi works amazingly well considering it only has a chip antenna. An external antenna is easily installed as it has both a proper impedance matching RF front-end as well as a stripline bandpass filter on the board. So far they've all worked well for me with just the chip antenna so I've found no need to modify them yet.
My patches (here and also in my github respository - link below) have support for both LEDs, the reset button and the slider switch. All works well including the USB port.
After some bit of effort to learn how to add a new device to buildroot for trunk (all the wiki docs are for AA), discovering the gpio/led connections on the board, and understanding the HooToo upgrade image format so I could build a "factory" openwrt upgrade image, I've developed a set of patches and images. I've submitted the patches to OpenWRT powers that be and haven't heard anything yet. I hope they'll eventually accept them and make this part of the trunk. (UPDATE: My patchs are now part of the trunk except for the "factory" image which you can get from my github repository - link below). In the meantime, I want to share this with the community. All the files - patches, images, and board photos are over on github at https://github.com/wingspinner/HooToo-T … 02-OpenWRT. Below are my latest upgrade instructions and how it all works but you'll need to go to the repository to get some of the files.
Just a note, I'm not affiliated with HooToo in any way and developed this independently. I have been lobbying HooToo to comply with the GPL for a couple of months. Recently they finally made available a sanitized and seemingly incomplete set of sources on their website (now apparently removed) which I thank them for however there isn't much useful in them. They did include the GPIO driver sources and includes though which allowed me to verify that I had got the LED and switch assignments correct. Unfortunately I received them only after I had already figured them out independently. Oh well!
To install OpenWRT on the TM02 I ended up replacing the UBoot bootloader with a version compatible with the OpenWRT partitioning scheme. There are several methods to replace UBoot:
1. If you have at least average soldering skills you can solder a 3v USB<->Serial cable to the board, setup a tftp server and replace it using tftp, then reboot and use that to burn the OpenWRT sysupgrade image to the correct MTD partition using tftp. That's how I did it the first time. Also, having a serial console connection is very useful as a debug and recovery tool. If you plan on doing a lot of experimenting I recommending this as it's an invaluable tool for configuration, debug, and recover - as long as you can solder the connections without ruining the board. The connections are well marked and it's not difficult at all. Same goes for the TM04. Both devices can be gently pried apart with a very thin screwdriver. Remove the bottom cover on the TM02 and carefully remove the board. The pads or on the bottom of the board near the edge (see photos). The TM04 requires that you carefully remove the daughter board and then the three screws holding the base board in place. Again, the pads are on the edge of the board and marked.
2. I've discovered that the board is compatible with in-circuit programming of the flash chip using an external FLASH programmer which makes for easy debricking or upgrading of uboot. I use the "flashrom" app along with the TIAO Tumpa (USB Multi-Protocol Adapter), and one of these: http://www.ebay.com/itm/141377097279?_t … EBIDX%3AIT . I've found the in-circuit method to be much quicker and easier than TFTP most of the time. This is for more advanced users. More notes on this below.
3. Since my initial upgrade, I have studied and now understand the factory HooToo upgrade images and that knowledge has enabled me to create OpenWRT "Factory" images that are compatible with the HooToo factory GUI software. In OpenWRT parlance a "Factory" image is the one you use to load OpenWRT on to the device for the first time while it's still running the manufacturer's original software. In this case, you load the "Factory" image from the HooToo upgrade menu. With the Factory image it's easy to do the conversion/upgrade without soldering and it shouldn't take more than 10-15 minutes. The factory image I prepared will load the new UBoot along with OpentWRT so it's a one step painless process and the recommended method. I've created a tool that enables advanced users to create their own factory images. More notes below.
- A 1gb or larger USB Flash stick (preferably an empty, new one )
- PC - any OS and browser
- Ethernet cable
1. Connect the TM02 to power with it's mode switch in the AP mode. That's the switch selection that has the icon with an image of the world connected to a network. Wait for it to boot up as indicated by it showing up as an AP in your PC wifi scan. Connect to it. The passkey is "11111111" unless you've changed it.
2. Once you are connected, open your browser and browse to the IP address 10.10.10.254 . The Hootoo GUI should appear. Bypass the setup wizard by closing it's popup window.
3. Insert a USB flash memory stick (preferably an empty one you can dedicate to this purpose and > 1gb) into the TM02. Wait for the popup window confirming that the TM02 has recognized the stick. Make sure the stick is properly mounted by clicking on the "Explore" menu item and viewing the directory of the stick.
4. Now go to the "System" menu, select the firmware upgrade menu item, and then upgrade the TM02 using one of the following files from the "ramips_openwrt" directory of my repository
(https://github.com/wingspinner/HooToo-T … 02-OpenWRT):
This is a well configured image with Luci, USB storage, USB serial, relayd and some other packages intended to make a solid base for experimentation. It's based on the most recent trunk revision (at the time of this writing) r44945. This is recommended for those with more basic knowledge since Luci is already installed for you.
This image is based on the "sysupgrade" image from the trunk, revision r44945. It has only the most basic USB drivers and not much else. It's intended for more advanced users who want full control of what is in the image. Luci is not included. You'll need to log into this via telnet or using the serial console. Check the wiki for instructions.
This is the original "factory" image I built and released. It's configured similar to the first image in this list but is based on a much older trunk revision. I've included it here as reference and don't recommend using it for new installs.
5. WAIT until the timer popup times out (about 5 minutes) before disconnecting the TM02 power as it takes time to write and verify the entire on-board flash MTD. Do NOT interrupt the process in any way otherwise you'll brick your device and likely need to use an external FLASH programmer to recover) The loader issues a "reboot" command when it's done but apparently re-writing the entire flash crashes the HooToo Linux install and it doesn't reboot on it's own. After the timer times out remove power from the TM02.
6. Connect an ethernet cable between your PC and the TM02. Set your PC for DHCP and then power-on the TM02. If the upgrade worked, you'll see both LED's light up. That's the new UBoot. When it starts to boot the kernel they will go out. They may or may not come back on during the boot process. After about 30 seconds it should be booted into OpenWRT. It will issue an IP to your PC in the 192.168.1.xx range. Later, you can configure the LED's to do something more useful.
7. If you used the more fully configured factory image, uhttpd and LUCI should be up and running so browse to 192.168.1.1 and configure to your hearts content using LUCI. There are no requirements for any other upgrades - you're done!
The network is configured with OpenWRT defaults. That means you can't do much with it until you've done some reconfiguring. Default configuration is ethernet is set as "lan" and bridged to the wifi ("wlan") with no firewall inbetween. There are plenty of examples as to how to configure the network any number of ways in the OpenWRT Wiki "recipes" and on this forum. Search is your friend - and so is the wiki table of contents. ;-) Relayd is also present as part of the richer build so you can create that interface if you wish and adjust the firewall to everything as "accept" (again, use the Wiki instructions). I'm using a freshly upgraded TM02 as a client bridge with relayd as I write this.
WHAT HAPPENS DURING THE UPGRADE AND WHY YOU NEED A USB FLASH STICK
The TM02 with the factory software doesn't have enough free RAM to untar/ungzip and assemble the complete TM02 flash MTD image for the upgrade so it requires a USB flash stick to use as workspace. Having a clean USB flash stick plugged in is required for this reason.
The first thing the loader does is shutdown various services that might interfere with the flashing process and perhaps free up some RAM. Then it writes a complete backup of the factory flash MTD device to your USB flash stick. It copys the entire TM02 MTD device as one file to your flash stick as well as each separate partition as individual files. The files are named using the partition labels from the flash chip and will be under the "HT_FLASH" directory on the stick. You can use these files to revert back to factory if you wish. Reloading the original HooToo firmware is not difficult for a well versed embedded hardware/software hacker but it's "plug and play" and there aren't any specific instructions. If you are convinced that you want to use the HooToo firmware I recommend spending another $20 and buying a second unit rather than hassle going back and forth. In any case, a full backup is provided for you on the USB flash stick and, if you feel you must go back, there are at least two methods to accomplish this: A. Using UBoot from the serial console. B. Use an external FLASH programmer such as the "Flashrom" app running on another Linux system, a hardware programmer ( I use the TIAO Tumpa USB Multi-Protocol Adapter), and one of these: http://www.ebay.com/itm/141377097279?_t … EBIDX%3AIT and simply reprogram the flash with the ALL.bin file in-circuit. You'll need to do some research and figure the details out. (Hint: Wiki, forum, search, google ;-) )
Next the loader extracts the OpenWRT sysupgrade image and the new UBoot image from the overall upgrade file and ungzips and untars them. Then it assembles a new MTD device flash image which includes the new UBoot, the original HooToo "config" and "factory" MTD partitions, and the new OpenWRT sysupgrade image. This is then written to the TM02 MTD using mtd_write. A copy of this image is also written to your flash stick as "openwrt.bin" in case you should need it. Once that's done it executes a "reboot" command. (Note: As mentioned previously this doesn't appear to happen.)
I've found the HT-TM02 to be an extremely versatile little device with sufficient I/O and memory for many applications at a very low cost. I find myself using it as a replacement for many embedded applications where I might have, in the past, used a less capable dedicated embedded microcontroller that required much more software and hardware effort to get running. The biggest issue I've had is getting over the mindset that it's overkill for some of my applications given the fact that it's a full and robust Linux machine. It seems odd having a full-blown computer monitoring I/O's or a serial port but I find I must keep the price in perspective.
One of my apps is as a wireless serial protocol converter between a diesel engine and a PC that monitors it. Previously, the PC had to be connected directly to the engine controller using a $20 TTL serial to USB cable. That's been replaced by a $15 HT-TM02 - and now it's wireless! If I had to do this application with Arduino, ARM Cortex-M boards, etc I'd have a $100+ invested plus a substantial programming task by the time I assembled all the interfaces (WiFi, USB, serial, etc). Using the HT-TM02 and OpenWRT made this a 1 hour job (really!). OpenWRT helps make it possible - it's much more than a router OS.
ADDITIONAL NOTES, UPDATES, INSTRUCTIONS
10-2015 - To Upgrade Or Not To Upgrade
Now that my patches are part of the main OpenWRT trunk you may want to download the latest sysupgrade image and upgrade your unit. This is not a requirement and, in fact, not recommended unless you have a specific reason to do so. I've found the 42649 revision to work fine for most everything I'm doing. If things are working as you wish I recommend not upgrading.
However, the OpenWRT trunk images benefit from constant improvements and bug fixes and there may be good reasons to upgrade to the latest revision. There are risks though. As with all bleeding edge trunk revisions there may be new bugs and incompatibilities with your existing packages injected since trunk images are automated builds and no testing is done (you are the tester!). Make sure you have the ability to deal with that. Here are some situations where upgrading may be desirable:
- You need a kernel module that's not already installed and don't have access to a repository with the older revision modules (kernel modules are specific to a kernel version and may fail to install if mismatched).
- You want or need one a new feature or bug fix present in the latest Trunk revision.
- A particular package you plan to install is not compatible with the older Trunk revision kernel and libraries.
If you do decide to upgrade using the latest trunk image I recommend that you do not retain configuration files and redo your configuration from scratch as some of the config files may have changed as well.
To upgrade to the latest trunk image, follow the "Downloads" link on the openwrt.org website and download and install the latest trunk sysupgrade image using LUCI (or the command line sysupgrade script). Note that the powers that be decided to make all the images in the trunk downloads basic images with only the most basic kernel modules and packages. It's likely that you'll need more than that. In my "Factory" image there are several more kernel modules to more fully support the built-in hardware and make for a more useful system so you may want to add those back in. Here is the original default configuration for reference. Use this list to add these back in via Luci or apt:
kmod-ledtrig-netdev kmod-ledtrig-timer kmod-leds-gpio kmod-ledtrig-default-on \
kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-net usbutils \
kmod-scsi-core kmod-scsi-generic kmod-fs-ext4 \
kmod-usb-storage kmod-usb-storage-extras block-mount \
kmod-usb-serial kmod-usb-serial-ftdi kmod-gpio-button-hotplug \
kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 luci luci-mod-admin-full \
kmod-app-samba luci-theme-openwrt luci-proto-relay relayd nano \
One last note on this. If you have a desire/need to use the latest trunk revisions I strongly recommend setting up the OpenWRT build environment and building your own images. If you follow the wiki instructions for installing it it's actually pretty easy and it will save you a lot of headaches and time.
01-01-2015 - In-Circuit FLASH Programming
Note: This is an advanced topic and if you aren't familiar with FLASH programming and the associated tools it's probably best to skip this until you've done some additional research.
- I've discovered that the board is compatible with in-circuit programming of the flash chip which makes for easy debricking, upgrading of uboot, or reverting back to the HooToo firmware. I use the "flashrom" app along with the TIAO Tumpa (USB Multi-Protocol Adapter) http://www.diygadget.com/tiao-usb-multi … erial.html, and one of these: http://www.ebay.com/itm/141377097279?_t … EBIDX%3AIT I've found this to be sometimes quicker and easier than TFTP unless one keeps a TFTP server setup and ready to go whenever it's needed.
03-23-2015 - Repository Pathnames Have Changed
For some reason the OpenWRT team has changed the pathnames for the package repositories. Most of the newer revision packages work just fine (some don't and I plan on releasing a new "Factory" image based on the latest Trunk revision soon). You can repair this via Luci or the command line here's what they should be:
src/gz chaos_calmer_base http://downloads.openwrt.org/snapshots/ … kages/base
src/gz chaos_calmer_luci http://downloads.openwrt.org/snapshots/ … kages/luci
src/gz chaos_calmer_management http://downloads.openwrt.org/snapshots/ … management
src/gz chaos_calmer_packages http://downloads.openwrt.org/snapshots/ … s/packages
src/gz chaos_calmer_routing http://downloads.openwrt.org/snapshots/ … es/routing
src/gz chaos_calmer_telephony http://downloads.openwrt.org/snapshots/ … /telephony
03-24-2015 - New "Factory" images available
I've generated new factory upgrade images based on the latest (as of this writing) trunk sources - revision 44945. Also, I've provided a complete repository of packages so they'll available in the future. Please go to my github repository and read the readme files for more info: https://github.com/wingspinner/HooToo-T … 02-OpenWRT
03-24-2015 - Tool available to Create "Factory" Images
Ideally, this would be integrated with the OpenWRT Buildroot tool however I haven't gotten around to that yet. In the mean time I've created and released under the Creative Commons Attribution-ShareAlike 3.0 Unported License a tool that will created a new "Factory" image compatible with the HT-TM02 and HT-TM04 (it may work for other HooToo devices and possibly some other non-HooToo devices sold under different names but I haven't personally verified this). It's currently a somewhat complex shell script but if someone has the time to rewrite it in C I wouldn't mind. It requires as input a TM02/TM04 "sysupgrade" image and a UBoot image. More details are available on my GitHub site under the "tools" folder: https://github.com/wingspinner/HooToo-T … 02-OpenWRT.
03-25-2015 - HT-TM04 Compatibility Verified
I've verified that the TM02 images work just fine on the TM04 with no modifications. LED and switches are mapped identically. I used the MMC and SD kernel modules and the SD card works fine as well. As far as I can tell it's fully compatible with the TM02 and everything works fine. Have at it!
(Last edited by wingspinner on 25 Mar 2015, 18:27)