D-Link DIR-505

The discussion on the DIR-505 is in this forum post. OpenWRT has been flashed to version A1 + A2. This is an ar71xx device.

Supported Versions

Apparently so far there are three versions of the dlink 505: DIR-505 A1, DIR-505L A1, DIR-505L A2.

They differ a bit on the “outer” hardware (switches, power supply stability, plugs), but the main router hardware is the same for all versions.
Since the main router hardware is the same for all versions, all of them work fine with Openwrt.

505L A1 = 505 + extra parts for voltage stability and the addition of a “Charge” mode on the mode switch, which allows for charging USB devices via the USB port on the unit.

Hardware Highlights

CPU

Ram

Flash

Network

USB

Serial

JTag

Atheros AR1311-AL1A

64MiB

8MiB

100mips x1 wifi Atheros 9380

1x 2.0

Yes

No

Installation

Web Interface

Starting with r37834 the device can be flashed via the web interface using a prebuilt factory image. For earlier versions (AA) you need the serial connection to flash the device or build the factory image yourself.

Since Barrier Breaker 14.07, prebuilt stable images are available at the links given above.

1 Store a copy of the OpenWrt firmware (.BIN) on the HDD of a local PC
2 Connect an Ethernet cable between the LAN port on the router and the network port on the local PC
3 Configure the PC with a static IP address other than 192.168.0.1 (e.g. 192.168.0.5)
4 Power down the router
5 Press and hold the reset button on the router for 3 to 5 seconds and re-plug the power without releasing the reset button
6 Continue to hold the reset button until the red power light keeps blinking on and off
7 Open a web browser and enter the following address: http://192.168.0.1/
8 Wait for the 'D-Link Router Recovery Mode' page to load
9 Click the [Choose File] button, select the OpenWrt router firmware stored on the local PC and then press [Upload]
10 After the new OpenWrt firmware has successfully loaded, a 'Success' page will display
11 If the 'Success' page fails to display, then repeat steps 4 through 9

Buttons

Use WPS button for reboot and shutdown

Mode-switch

There is a 4 position switch on the top of the unit. The fourth position is used by the DIR-505L model to shutdown the software and operate as a USB charger - on the DIR-505 the case keeps the switch from going into the fourth position.

You can use the mode switch for pretty much anything you want – however, keep in mind that the “Charge” position turns the router off and is pretty easy to accidentally switch to.

As an useful example look at this forum posting which enables different config modes based on the switch position.

The switch modifies GPIOs 19 and 20:

Switch position

GPIO 19

GPIO 20

“WiFi Hotspot”

0

1

“Repeater”

1

1

“Router/AP”

1

0

(GPIOs 21 and 22 may be connected to the switch, too, but report 0 all the time. The “Charger” position seems to affect GPIO23 but, again, is of no use within a powered down system.)

Photos

Front:

Back:

Note: those pads are really meant for Pogo pins (which you can get at places like sparkfun). If you solder to them, use a low-wattage soldering iron (15-30 watts) and use solder flux to clean the pads first. Then only solder magnet wire or a single strand of stranded copper wire (32 awg).

Opening the case

remove white sticker on the back, just below the power plug, and remove exposed screw.

pry the now unfastened cap straight up over power plug

remove yellow/green sticker (labeled with usb and internet/lan) that holds both halves of the case together

this step is kind of tricky, a good hint is, grab the router with both hands, your thumbs near the switch, placed left and right of the small space that seperates the case part with the dlink-logo on it from the high-voltage-plug-part

Place your pointing fingers on the other side of the case

dig with your thumbs in the appaering notch and use a little force until it seperates easlily

If you have problems, use a little screw driver to flip out the platics clips (but be careful they break very! easily)

there are three plastic tabs, one above reset hole, and one on each side of mode switch

Just stick a screwdriver in the hole at the bottom next to the ethernet port, and pry the two halves apart. DONT DO THIS! On top of the ethernet port, you can damage a capacitor you don't see and other parts from the power regulation board. If you use a screw driver, JUST and ONLY on the right side of the ethernet port as support to lever the case parts

Then stick the screwdriver in on the other side in the topmost air vent and pry the top part of the shell apart.

remove to screws that hold some the metal clips the power plug

pull the metal clips through the small gap

now pull power module straight up away from cpu board. they are connected via a four-way-power-connector and a two-way (don't what is it for)

Serial

See above photo for connections. 115200 bps, 8N1. You can use any 3.3V serial dongle for this, I used a 3.3v arduino serial programming cable.

When the case is open it may be more convenient to power the DIR-505 directly from a 5V power supply. The power connector is the female 4-pin header (2.54mm/0.1in spacing) and has a symmetric connection:

JTAG

Debricking

So there's two levels of “bricking”…mis-flashing the firmware, and overwriting the boot loader.

Since there's no jtag, if you overwrite the bootloader and it doesn't boot again, you're sol. That's almost impossible to do accidentally.

However, if you hold down the reset button at boot time, the original bootloader has a web interface that comes up, where you can re-flash the unit from.

Plug in your computer to the unit, assign it an ip address of 192.168.0.100, and boot the unit up while holding down the reset. Once the red light starts to blink slowly, release the reset, and go to 192.168.0.1 on your web browser. From there you can upload a new image. After successful flashing, you'll see a “Success” page in your browser.

LED red/green/on/off

After getting the “success” page in your browser you might notice a different behaviour of the LED, depending on which image you flashed:

Plesiu's AA image

Please keep in mind, that the LED might not come on after flashing / rebooting, since it usually signals WiFi, which might not be up right after flashing. So don't misinterpret the off-LED as “it's not working”, when it's just showing: “Wifi is off”. Try to access the router by telnet 192.168.1.1.

Trunk image

The LED goes from blinking red to blinking green, and then to steady green. Congratulations, your DIR-505 just has booted and is waiting for you to telnet 192.168.1.1 (at least it should be).

Bootloader Mods

U-Boot 1.1.4 modification for routers

Forum member pepe2k made a modification of U-Boot 1.1.4 for Qualcomm Atheros SoCs based devices (the project is still being developed, so new devices and SoCs will be supported in the future). Up to date information, binary images and sources can be found on official GitHub repository.

This modification started from wr703n-uboot-with-web-failsafe project, but supports more devices, all modern web browsers, has a lot of improvements and other modifications (like U-Boot NetConsole, custom commands, overclocking possibilities etc.).

An article (in Polish) about one of the first version of this project on www.tech-blog.pl

Hardware mods

as a beginner, you really should inform yourself about soldering in general and then obtain some practical experience! (It's really not that hard, just go try it.)

The internal WiFi antenna sometimes has a tendancy to short to the board. If you open the device, slip a piece of electrical tape, (or even better, shrink wrap tubing) around the vertical piece of metal that extends over the board to keep it from bouncing around. Otherwise if it shorts, the smoke comes out of the processor.

Notes

Other than similar routers (e.g., the TP-Link TL-WR703N), the D-Link DIR-505 uses the interface eth1 rather than eth0. This means that if you build your own firmware, you must configure /etc/config/network accordingly (option ifname 'eth1'), or you will not be able to connect later on via Ethernet.