D-Link DIR-685

D-Link DIR-685

The D-Link DIR-685 is some kind of high-profile product from D-Link, it is labeled an Xtreme N Storage Router whatever that means. It is based solely around the Gemini platform, and ARMv4 Faraday silicon design. It has the following features:

  • Router: WAN+4 LAN
  • 2x USB ports
  • Wireless card (this is by default a Ralink RT2880F mini PCI iNIC card currently NOT supported by Linux in any way)
  • Mini SATA drive bay
  • Small video screen (!)

Currently using this device with OpenWrt requires UART access.

ModelVersionSoCCPU MHzFlash MBRAM MBWLAN HardwareWLAN2.4WLAN5.0100M portsGbit portsModemUSB
DIR-685Storm SL35163008, 32128Ralink RT2880, Ralink RT2820, 1x mini-PCIeb/g/n--5-2x 2.0

This is preliminary flashing instructions until Stable has the merged the working code

There are two proper ways to install onto the DIR 685. You can not use the normal HTTP server. You must do one of the 2 following options (both which require UART):

* hit CTRL-C on uart during bootup, to get into web upgrade mode (bootloader's firmware page upgrade on port 80).

* hit CTRL-C on uart during bootup, to get tftp mode. (recommended)

Using this method, new installs are downloaded using TFTP, see the generic OpenWrt TFTP instructions. NOTE: as of 2020-08, the image working out of the box can be found here: https://dflund.se/~triad/krad/dlink-dir-685/openwrt-gemini-dlink_dir-685-squashfs-factory.bin The changes required have not yet propagated to stable openwrt.

The firmware can be reflashed from the RedBoot derivative “Boot Menu” that comes up if you have a serial console and hammer Ctrl+C during startup like this:

  • Select “Y: Upgrade Kernel” by pressing “Y” (this “kernel image” contains all of OpenWrt including root filesystem)
  • Select TFTP or serial download (see elsewhere for how that works) Download the openwrt-gemini-dlink_dir-685-squashfs-factory.bin file using TFTP, you need to rename it because the boot loader cannot handle this long filename. I just name it openwrt
  • The boot loader will erase and flash the image looking something like this:
  Erase flash (0x30040000): Size=32768000 ........
  Program flash (0x30040000): Size=6750212 ........
  • This takes a while. When this ends, reboot to start the new firmware and it should come up. You can hit 0 on the redboot menu.
  • Let Openwrt load, and wait at least 5 minutes for network to fully initialize upon first boot. DHCP will work on the four switch ports, and the wan port will acquire an IP also.

Now OpenWrt is installed on your router, and you can proceed to basic configuration.

Upload the openwrt-gemini-dlink_dir-685-squashfs-sysupgrade.bin image to the routers /tmp directory. If your networking is set up properly it should be just something like:

  scp openwrt-gemini-dlink_dir-685-squashfs-sysupgrade.bin root@192.168.1.2:/tmp

Then issue sysupgrade:

  sysupgrade /tmp/openwrt-gemini-dlink_dir-685-squashfs-sysupgrade.bin

The DIR-685 will flash the firmware upgrade and reboot.

There is no need to wait for the JFFS2 to initialize when upgrading the firmware: this is just needed on factory installs.

This gemini ethernet switch uses a DSA (distributed switch architecture) switch which is a reasonably new feature in the mainline kernel (v5+). It allows for individual ports to be configured with more features than just VLAN IDs. Because of this, the network setup is slightly different. Upon typing ifconfig, you should see a distinct 'lan#' port for each lan port on the switch. Users interested in more details can refer to the DSA section in the kernel docs.

If you slot in a hard disk in the device this can be pretty easily partitioned, formatted and used for storage, e.g. for using the router as a NAS device. With a completely blank disk the procedure is something like this:

  • Log in to NAS or use the console if you have one.
  • fdisk /dev/sda press n, ENTER, ENTER, ENTER, ENTER, w to create /dev/sda1
  • mkfs.ext4 /dev/sda1
  • Use the ''block'' tool to set up the partion for mounting:
  • block detect | uci import fstab
  • uci set fstab.@mount[-1].enabled='1'
  • uci commit fstab
  • Reboot
  • When the device comes up df should show you /dev/sda1 mounted as /mnt/sda1

The same procedure can be used for a USB disk, just augment the above. If you have both an internal harddrive and a USB disk attached, the internal harddrive will be /dev/sda and the USB disk will be /dev/sdb.

A basic configuration as an OpenWrt NAS is very simple and straight forward, for this memory-constrained device it is recommended to use ksmbd as SMB server if you desire to use the SMB protocol to access your NAS (such as with Windows and many media players). The most common SMB server samba4 is unfortunately too memory hungry and can make the device thrash and hang, and connections and transfers time out as a result.

Enable hdparm in your build by:

make menuconfig

From the top menu: Base system → Customize busybox options → Miscellaneous utilities → hdparm

This tool is used to instruct the harddrive to spin down when unused. Not doing that will be annoying since the drive will always be spinning.

If you rebuild the firmware image from scratch to get ksmbd you can do like this:

scripts/feeds update
scripts/feeds install ksmbd-server
make menuconfig

From the top menu, select Network → Filesystem → ksmbd-server, then select as 'y' (star) to get into default install and rebuild OpenWrt. I usually also install the utils, but they are only needed if you want to create individual users. After you put the resulting ext4 filesystem on the drive, rebooted and made basic set-up like above /dev/sda should exist and you can proceed to set up a samba share:

chown nobody /mnt/sda1
chgrp nogroup /mnt/sda1

Edit /etc/config/ksmbd to contain something like this:

config globals
    option 'workgroup'              'WORKGROUP'
    option 'description'            'ksmbd on DNS-313'
config share
    option path                   '/mnt/sda1'
    option name                   'dns313'
    option create_mask            '0666'
    option dir_mask               '0777'
    option read_only              'no'
    option guest_ok               'yes'

Reboot and you can browse to the IP number (etc) of your NAS, use the dns313 share and upload and download files that will appear in /mnt/sda1, of course you can set up whatever partition etc you like.

Open case PCB front PCB back

  • A Ilitek ILI9322 display controller for 320RGBx240 connected to a panel with the label LM918A01-1A SY-B4-091116-E0199 connected to the main PCB with a flat cable (we know this is driven by a ILI9322 from the boot messages)
  • A touch input module PCB with a Cypress Semiconductor CY8C214 MCU, with a LED connected to it (the WPS flashing LED), connected to the main PCB with a flat cable
  • A Sunon Maglev GM0502PFV2-8GN 0.4W fan connected to the main PCB, software controlled
  • A soldered (!) Alpha Networks WMP-N08 Mini-PCI RaLink RT2880F-based wireless network card, inside the shield box is a RT2850L antenna driver. The Linux driver is named “ralink_RT2880_iNIC” and is version v1.1.8.3 in the source drop but it doesn't contain the source code.
  • Main PCB:
    • A blue LED indicating power on
    • A Spansion S29GL256 256 Mbit (32MB) CFI NOR-flash memory
    • A Hynix HY5DU121622DTP-D43 512 Mbit (64MB) SDRAM classed at 200MHz
    • A Bothhand GST5009 LF 1000 Base-T magnetic module (galvanic isolator) facing the WAN port
    • A RealTek RTL8366RB switch using GPIO for control
    • Two LFE9407 Delta LFE9407 LAN Filters (also galvanic isolators) facing the four LAN ports
    • A TI SN54LVC14A schmitt-trigger array
    • Inside the shield box:
      • The Storlink SL3516 SoC ASIC
      • RealTek RTL8366SR ethernet PHY/switch
      • Another Hynix HY5DU121622DTP-D43 of 64MB SDRAM so in total we have 128MB SDRAM
      • An LXC16373 latch array

For background and generic information see the generic serial console documentation.

The J3 header on the top in the front picture is the serial port connector. This is the pin assignment:

 o o o _ o
 | | |   |
 | | |   RX
 | | VCC
 | GND
 TX

Once the UART is properly connected open (in this case) /dev/ttyUSB0 in your serial console (terminal) program and set it to 19200 baud, no hardware flow control (obviously, do you see any CTS or DTS leads) 8 bits, 1 stop bit.

The 19.07.3 release requires a 2.5“ HDD connected via the Sata port with one ext4 partition which is loaded w/19.07.3. Regardless, the router will fail to init network properly with the following message:

[   15.820748] Realtek RTL8366RB ethernet switch driver version 0.2.4
[   15.858429] rtl8366rb rtl8366rb: cannot find mdio node phandle
[   15.893840] rtl8366rb rtl8366rb: using GPIO pins 502 (SDA) and 501 (SCK)
[   15.934347] rtl8366rb rtl8366rb: ACK timeout
[   15.960182] rtl8366rb rtl8366rb: unable to read chip id
[   15.991666] rtl8366rb rtl8366rb: chip detection failed, err=-110
[   16.027876] rtl8366rb: probe of rtl8366rb failed with error -110

Users are advised to use the img on dflund.se until the official openwrt image is tested as working.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/04/24 20:34
  • by linus