Installing dd-wrt on Fonera+ and accessing GPIO pins.

Installing dd-wrt on Fonera+ and accessing GPIO pins.

I bought a Fonera+ (model 2201) Wireless G router couple of years ago when I started to flash my Linksys routers with dd-wrt firmware. At that time Fonera was quite popular for it’s low price point and easy hardware/software hack through it’s exposed serial pins on the board and easy access to few GPIO pins. Fonera+ has Atheros WiSoC running at 180Mhz, 16Mb RAM and 8Mb of flash ROM, making it plenty of space to fit custom firmware. I recently flashed the latest version of dd-wrt (v24sp2) on it and thought I should do a write up on how I did it. Here is what you need to flash dd-wrt firmware on Fonera+:

1. USB to Serial cable (I used FTDI usb->serial cable)

2. Terminal client to communicate with Fonera+ over serial. I used TeraTerm.

3. Firmware from dd-wrt web site. I downloaded linux.bin for Fonera.

How to upload dd-wrt firmware to Fonera:

Step 1: Connect Serial cable to Fonera

Here is a diagram that shows the serial pin out of Fonera+:

I powered the fonera using the 5v from my FTDI cable, as I am missing the original power adapter. Let’s connect the RX wire from FTDI cable to the TX pin of Fonera+, TX wire from FTDI cable to the RX pin of Fonera and GND wire from FTDI to the GND pin of Fonera+.

Serial Cabel                   Fonera
————————————————–
TX                           RX
RX                           TX
GND                         GND

Step 2: Launch Terminal program

Next step is to launch Tera Term or any similar terminal client program you have. Choose the port the FTDI cable is connected to and set baud rate to 9600 (9600-8-N-1). Power up Fonera+ and keep an eye on the terminal window. Fonera runs RedBoot. As soon as you see the following text on the terminal windows, press Ctrl+C:

Board: FON 2201
RAM: 0x80000000-0x81000000, [0x80040290-0x80fe1000] available
FLASH: 0xa8000000 - 0xa87f0000, 128 blocks of 0x00010000 bytes
each.
== Executing boot script in 10.000 seconds - enter ^C to abort

Step 3: Flash DD-WRT firmware

Once you do that you will be on the Redboot prompt. Now from Redboot prompt we will flash the dd-wrt image on Fonera+. Type fis init in RedBoot prompt:

RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xa83e0000-0xa83f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa83e0000: .

Next type: load -m ymodem -r -v -b 0×80041000 linux.bin and hit enter. Then go to Tera Term menu->File->Transfer YMODEM->send and choose linux.bin file you downloaded from dd-wrt website. It will take several minutes to transfer the file to Fonera+ over serial. Once the file transfer is complete type: fis create linux and give it seveal minutes to complete the ROM erase/write process.

RedBoot> load -m ymodem -r -v -b 0x80041000 linux.bin
C C
Raw file loaded 0x80041000-0x802e3fff, assumed entry 
at 0x80041000

RedBoot> fis create linux
... Erase from 0xa8030000-0xa82f0000: .........
...................................
... Program from 0x80041000-0x80301000 at 0xa8030000: 
............................................
... Erase from 0xa83e0000-0xa83f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa83e0000: .

Once the ROM write is complete type fconfig. At this step we will edit some parameters to boot into our newly flash dd-wrt linux image. Here you will also see options to change the serial baud rate, boot wait time (seconds) etc. Feel free to change those two. Do not change anything that you are not sure about. Most important part of this step is to enter the boot script entry as follows:

RedBoot> fconfig
enter the bootscript: 
fis load -l linux
exec

Once the changes are done save the config file and type: reset, hit enter. This should reboot your Fonera+ router into dd-wrt.

Here is how mine looked with the FTDI cable hooked up:

Step 4: Configure DD-WRT

We will now configure dd-wrt to enable sshd. Connect a network cable between Fonera+ LAN and your computer’s LAN port. You will now be able to access dd-wrt web interface at http://192.168.1.1. Let’s change the default user name and password to something you would remember and proceed to enabling ssh access. This can be done on the Services page of DD-WRT web interface. If you do not want to go through SSH, there is another way to access GPIP via dd-web interface, skip to the end.

Step 5: Access Fonera over SSH

Once ssh is enabled lets open up TeraTerm or PuTTy whatever ssh client you have installed and connect to 192.168.1.1 and port 22. Your login will be root and password is same as the password you set when first setting up dd-wrt. Once you are successfully logged in you will see the linux shell prompt:

==============================================================

 ____  ___    __        ______ _____         ____  _  _
 | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || |
 || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_
 ||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _|
 |___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_|

                       DD-WRT v24

http://www.dd-wrt.com

==============================================================

BusyBox v1.11.1 (2008-07-26 03:51:42 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

root@DD-WRT:~#

Type /sbin/gpio enable 4 and hit enter, you should see the green power light on the Fenra come on. To turn it off type /sbin/gpio disable 4 and hit enter.

Here is a diagram showing the GPIO output:

fonera+ 2201 GPIO pins

You will be able to individually control all the four leds via /sbin/gpio [enable/disable] pin# command.

Fonera GPIO pin table:

GPIO 1 WLAN Orange LED
GPIO 2 WLAN Green LED
GPIO 3 LED between power and wireless LEDs
GPIO 4 Power Green LED
GPIO 7 Power Orange LED

There is way to execute the commands to access GPIO pins without SSH via dd-wrt web interface. Go to Administration->Commands tab on dd-wrt web gui and the the commands stated above in the commands text box and click on “Run Command”. You should see the leds come on and off depending on the command you execute.

The default firmware of Fonera used to change the power led from amber to green once the router initialization was complete. The dd-wrt firmware does not do that. To achieve that I typed the following commands in the Commands text box and clicked “Save Startup”, meaning these commands will execute every time the router initialization is complete:

/sbin/gpio disable 7
/sbin/gpio enable 4

The commands just turns of the amber power led on pin 7 and turns on the green power led on pin 4.

Have fun!

One thought on “Installing dd-wrt on Fonera+ and accessing GPIO pins.

Leave a Reply

Your email address will not be published. Required fields are marked *


six − 2 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>