Trying OpenWRT Chaos Calmer (15.05 RC1) on Asus RT-N16

 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 CHAOS CALMER (15.05 RC1)
 -----------------------------------------------------

In [2] below Glenn has a great guide on building OpenWRT with bluetooth_6lowpan for Asus RT-N16. With the recent release of Chaos Calmer 15.05-rc1, things become easier as it has kernel 3.18.11 inside. There is a few approaches to install OpenWRT into RT-N16, see [1]. We take the easiest way, i.e. using TFTP from an Ubuntu PC.

Install official CHAOS CALMER (15.05 RC1)

(1) For Ubuntu side, install TFTP if it’s not installed yet. sudo apt-get install tftp

Configure your box to use an ip 192.168.1.15; this specific IP is required in order to transfer via tftp.

sudo ifconfig eth0 192.168.1.15

Tips 1, remove the DHCP configuration from Ubuntu LAN interface or above address will be lost soon.

(2) Grab the image from OpenWRT https://downloads.openwrt.org/chaos_calmer/15.05-rc1/brcm47xx/generic/openwrt-15.05-rc1-brcm47xx-generic-squashfs.trx
Suppose it’s saved to ~/Downloads.

(3) Put RT-N16 into recovery mode

- Disconnect power from the router 
- Hold the WPS button while plugging in the power to the router to reset nvram, router will restart. 
- Hold the RESET button while plugging in the power to the router to get into recovery mode in which tftpd will be listening.
- The power LED should start to blink (low frequency, ~1 time every 3 seconds). Retry if that doesn't work for you. 

The router IP in the recovery mode is 192.168.1.1 255.255.255.0. Try to ping this IP.

(4) Transfer the image to router Navigate to ~/Downlaods

$ tftp 192.168.1.1
>mode binary
>trace
>put openwrt-15.05-rc1-brcm47xx-generic-squashfs.trx

When it's complete the router will be writing the firmware and may not automatically reboot. IMPORTANT wait up to 5 minutes, then power off the router and plug it back in.

(5) Connect to OpenWRT LuCI Web Interface

Configure Ubuntu LAN interface back to be DHCP and open http://openwrt.lan/ in a browser. Try login as root without password.

Configure CHAOS CALMER (15.05 RC1) for Bluetooth and 6lowpan support

(1) Set a password for root in LuCI Admin page and enable SSH on LAN interface. Use SSH to connect with RT-N16 via its LAN interface (i.e. LAN cable connected)

(2) Connect WAN port to Internet, i.e. Broadband router

Tips 2, in case your broadband router allocate 192.168.1.x address, configure the RT-N16 LAN address to be 192.168.2.1 (or so) on LuCI

Tips 3, in my case RT-N16 has 192.168.2.1 as its LAN address and it received 192.168.1.x with DNS to be 192.168.1.1. I cannot ping www.yahoo.co.jp but could ping its IP address. It means DNS not working. As a workaround, add below to /etc/resolv.conf

nameserver 8.8.8.8

NOTE this change is wiped out after a reboot and needs to be added again.

(3) Get necessary packages from OpenWRT repository

opkg update 
opkg install kmod-bluetooth kmod-bluetooth_6lowpan bluez-utils bluez-libs ip 
opkg install kmod-usb-ohci kmod-usb-storage kmod-usb2
reboot

Tips4 You’ll have "bluetooth" and "bluetooth_6lowpan" added under /etc/modules.d/, but "bluetooth_6lowpan" is also pointing to bluetooth module. Use vi to edit "bluetooth_6lowpan" and change the content to be bluetooth_6lowpan then bluetooth_6lowpan module could also be loaded automatically.

Test Bluetooth 6lowpan connection

Reboot and then OpenWRT should now be ready to do Bluetooth 6lowpan connection

There is some configuration steps on LuCI, please refer to [3].

One necessary step is to do $hciconfig hci0 reset, as there is no BLE support to BT USB dongle on boot-up.

BTW, one good thing with RT-N16 is that it has 32M flash (large enough for OpenWRT) thus there is no need to mount extra USB storage for root file system.

Good luck!

[1] OpenWRT, hardware guide for ASUS RT-N16 http://wiki.openwrt.org/toh/asus/rt-n16

[2] Glenn Ruben Bakke, 6LoWPAN for Bluetooth low energy on OpenWRT https://devzone.nordicsemi.com/blogs/663/6lowpan-for-bluetooth-low-energy-on-openwrt/

[3] PK, "OpenWRT Series" #1: setting up TP-Link WDR4300 (or N750) for Bluetooth Low Energy 6LoWPAN https://devzone.nordicsemi.com/blogs/698/openwrt-series-1-setting-up-tp-link-wdr4300-or-n75/