OpenWrt Forum Archive

Topic: D-Link DIR-615 HW rev C1 USB

The content of this topic has been archived between 9 Apr 2018 and 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Yes, the AR9130 does have onboard USB, so it is possible to add USB to this board.  However, at this point I think the signal lines (to the USB placeholder on the PCB) aren't actually connected to the chip.  This mod might not be feasible on this board, unless we can successfully trace the signal lines to the respective USB pinouts of the AR9130... or find another trace to the USB pinouts of the AR9130.

Well... There is no ar9130 datasheet in public so we known nothing about ar9130 usb pins sad To trace signal lines someone should blow off processor from pcb of bricked dir-615 and look under it.

More info:

Pull-down resistors 15K - soldered.

1. Booting without ethernet wires connected: D-=0, D+=0; inserting USB2 flashdrive: D-=0, D+=0; (no pull-up on d+! internal pull-down enabled ?)
2. Booting with ethernet wires connected: D-=3.3V, D+=0; (internal pull-up enabled?); inserting flash: (D-=3.3V, D+=0)

So:

1. USB datalines connected to AR9130
2. Looks like they connected to atheros GPIO pins (led pins ??) or USB pins works in GPIO mode.


Is there any way to get specs for 9130 ?

regressor wrote:

More info:

Pull-down resistors 15K - soldered.

1. Booting without ethernet wires connected: D-=0, D+=0; inserting USB2 flashdrive: D-=0, D+=0; (no pull-up on d+! internal pull-down enabled ?)
2. Booting with ethernet wires connected: D-=3.3V, D+=0; (internal pull-up enabled?); inserting flash: (D-=3.3V, D+=0)

So:

1. USB datalines connected to AR9130
2. Looks like they connected to atheros GPIO pins (led pins ??) or USB pins works in GPIO mode.


Is there any way to get specs for 9130 ?

look at this - http://www.atheros.com/pt/bulletins/AR9 … lletin.pdf

"Interfaces:
- USB 2.0: host, device, OTG modes"

I'm interested too this topic smile

ddwrt wrote:
regressor wrote:

More info:

Pull-down resistors 15K - soldered.

1. Booting without ethernet wires connected: D-=0, D+=0; inserting USB2 flashdrive: D-=0, D+=0; (no pull-up on d+! internal pull-down enabled ?)
2. Booting with ethernet wires connected: D-=3.3V, D+=0; (internal pull-up enabled?); inserting flash: (D-=3.3V, D+=0)

So:

1. USB datalines connected to AR9130
2. Looks like they connected to atheros GPIO pins (led pins ??) or USB pins works in GPIO mode.


Is there any way to get specs for 9130 ?

look at this - http://www.atheros.com/pt/bulletins/AR9 … lletin.pdf

"Interfaces:
- USB 2.0: host, device, OTG modes"

I'm interested too this topic smile

Look at the PCB. The board have USB!

melodic wrote:

Look at the PCB. The board have USB!

We were hoping it was that simple... but it is not.  To my knowledge, no one has gotten USB to work on this board.

(Last edited by LinkZ on 21 Oct 2010, 21:49)

The board have USB. But signal on its lines is not ok. This is may be:
1. pcb design problem - wrong processor pins connected (they connected!)
2. config problem - bootloader do some wrong configuration on start

Add: I bought tp-link wr941nd and got usb on it. The platform is almost same.
USB on 941nd require to solder USB_RREF (pull-down) resistor 4.7K near main cpu ar9132.
I'll try to find this resistor on dir-615 board.

Also wr941 usb require u-boot changes:

void ar7100_usb_initial_config(void)
{
    ar7100_reg_wr_nf(AR7100_USB_PLL_CONFIG, 0x00001030);
}

(Last edited by regressor on 7 Jan 2011, 04:34)

UP - New info added...
TODO:
1. Find RREF cpu resistor pads near cpu (it has +3V from cpu and ground connection)
2. Add usb pre-initialization code to openwrt

Pre-initialization code looks like this (code from u-boot and I don't know if this works in Openwrt):
#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
#define ar7100_reg_wr_nf(_phys, _val) ((*(volatile unsigned int *)KSEG1ADDR(_phys)) = (_val))
ar7100_reg_wr_nf(AR7100_USB_PLL_CONFIG, 0x00001030);

Looks like RREF is a R11 at the bottom of the pcb. I soldered it (4.7K) and now D-/D+ is ok (0V after boot, D+=3v after connecting flashdrive).
Trying to solve usb PLL issue. The code above is for ar9132 sad

Excellent.  Glad you're working on this smile

Partial success. I tried to init usb during openwrt load, but no success sad Then I tried to setup pll by hands at u-boot prompt:

AP81 (ar7100) U-boot
DRAM:  AP81 initdram

sri:ddr_init
32 MB
Top of RAM usable for U-Boot at: 82000000
Reserving 177k for U-Boot at: 81fd0000
Reserving 192k for malloc() at: 81fa0000
Reserving 44 Bytes for Board Info at: 81f9ffd4
Reserving 36 Bytes for Global Data at: 81f9ffb0
Reserving 128k for boot params() at: 81f7ffb0
Stack Pointer at: 81f7ff98
Now running in RAM - U-Boot at: 81fd0000
ar7100 flash_init
id read 0x10000107
flash size 400000, sector count = 64
Flash:  4 MB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   eth_initialize CONFIG_NET_MULTI
ag7100_enet_initialize
eth0: 00:18:e7:e3:98:72
ethernet found.
eth0
httpd start

hostaddr = 0xc0a8   1
ar7100> mw.l 0xb8050008 0x00001030
ar7100> boot

And got here:
scsi 0:0:0:0: Direct-Access     Kingston DT Mini 10       1.00 PQ: 0 ANSI: 2
sd 0:0:0:0: [sda] 7822288 512-byte logical blocks: (4.00 GB/3.72 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
sda: sda1 sda2
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI removable disk


Trying to make modded u-boot...

Ok. I did it. Again... smile

Part1: Software... (no need to flash u-boot - only Openwrt)

1. Download svn source code
2. Edit file target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c
  2.1. Add line #include "dev-usb.h" after line #include "dev-leds-gpio.h"
  2.2. Add line ar71xx_add_device_usb(); [s]after line ar71xx_add_device_eth(1);[/s] before line "if (nvram_parse_mac_addr(...."
3. Edit file target/linux/ar71xx/files/arch/mips/ar71xx/setup.c
  3.1 Add line ar71xx_pll_wr(0x08, 0x00001030); before line ar71xx_detect_mem_size();
4. Run 'make menuconfig' and select platform/profile and other options
(usb-core, usb-storage, usb2.0, block-extroot, etc - all what you want)
5. Compile image and flash it to router.

Part 2. Hardware

1. Solder usb socket (i soldered horisontal for testing but later i'll replace it with part of usb extender)
2. Solder usb power. My Dir-615C2 use 5V power source so I just solder a wire from power input to usb +5V line. But I think i'll install dc/dc 0505 isolator instead of this wire.
3. Solder two usb data line resitors (r237/r230 - 22 Ohms)

http://s007.radikal.ru/i302/1101/84/cac7bb371d58.jpg

3. Solder pull-down resistors at the bottom of the pcb. Use small 0603 smd 15k resistors (marked as '153').

http://i019.radikal.ru/1101/4b/ee639981b015.jpg

4. Solder usb_rref 4,7Khoms resistor at the bottom of the pcb near ar9130 processor (look photo). I soldered 0805 size because didn't find 4k7 0603 size at home. If your solder skills not good - ask to solder this in any cellphone repair service (size of 0603 resistor - 1.6x0.8 mm)

http://s015.radikal.ru/i331/1101/33/595e44a91088.jpg

5. Solder serial header (you'll need it smile

http://i003.radikal.ru/1101/66/e204df8339a6.jpg

Now check pcb... Twice! Connect serial and power router on.......
Wait until device boot and connect flashdrive. If you did all well you'll see at serial console:

http://i001.radikal.ru/1101/ee/67d38cbc514e.jpg


Now time to make memory mod.... big_smile

(Last edited by regressor on 26 Feb 2011, 13:15)

regressor, you did an excellent job! Thanks a lot. I would never found out about usb_rref part.
Can you upload compiled openwrt image? I compiled it in the past and it took hours. Also to test and make sure there is no problem on software part.

Dir-615 in addition to usb also has 6 free GPIO pins!

gpio7  -----> led21 (last right unpopulated led 21 resistor)
gpio2  -----> r2    (unpopulated resistor near cpu)
gpio0  -----> led12, r203  (unpopulated led 12 resistor)
gpio8  -----> tp5   (testpoint at the bottom of pcb near cpu)
gpio9  -----> tp6   (testpoint at the bottom of pcb near cpu)
gpio11 -----> tp7   (testpoint at the bottom of pcb near cpu)

siniy, i have image (it has preconfigured ip/gate/dns) but i have no idea how to upload it here.

Here is the link: http://www.sendspace.com/file/81yy9d
This is a dir-615c1-squashfs-factory image. Included: e2fsprog, ext2, usb, block-extroot
Default ip: 10.10.104.220

Great job, regressor!
Would it be working with DIR-615 rev. D4?

(Last edited by s0ull on 15 Jan 2011, 16:27)

No, D4 has different hardware...

A great job, regressor!

I have a TP-LINK TL-WR941ND router and the same problem. I've managed to bring it up and I successfully use it for some time now and the solution is exactly the same. I've posted a kernel patch https://lists.openwrt.org/pipermail/ope … 09141.html which is the same as yours, with the only (minor) diffrence that I bring the PLL up in dev-usb.c, in the beginning of__init ar91xx_usb_setup(void).

cheers

I tried to fire up PLL at usb setup, but it didn't work for unknown reason sad so I moved this code at the beginning of memory intialization.

It works for me for several months now. Initially I've put the USB PLL init between the ar71xx_device_stop(RESET_MODULE_USBSUS_OVERRIDE); and ar71xx_device_start(RESET_MODULE_USB_HOST); in the beginning of dev-usb.c's __init ar71xx_usb_setup(void). It seemed the logical place to put it but it didn't work. I don't know why - may be USB PLL init while the USB device is stopped doesn't take effect. So, next I moved the PLL init in the beginning of __init ar71xx_usb_setup(void), right before ar71xx_device_stop(RESET_MODULE_USBSUS_OVERRIDE); is called and it worked fine. I haven't tried it after ar71xx usb device start because all worked fine, but it may be even better since the USB device would be in a known state. I've installed usb flash dive (extroot), external usb hdd (with samba share on it), usb sound card, bluetooth, printer, 3g dongle, and all works fine.

regressor wrote:

Here is the link: http://www.sendspace.com/file/81yy9d
This is a dir-615c1-squashfs-factory image. Included: e2fsprog, ext2, usb, block-extroot
Default ip: 10.10.104.220

I have download it,Thanks for your sharing!

Looks like usb mod impact a wan-lan perfomance badly (both: wr941nd and dir-615c2). I had 95Mbit before (torrent) and now have 15Mbit (top shows ~20% cpu load during test). LAN-PC iperf test shows 95Mbit and 50% cpu).

Is there any way to find a bottleneck ?

Add: Both wr941nd and dir-615c2 has bottleneck at wan interface. This looks like atheros ar91xx chip bug (tplink and dlink didn't soldered usb parts!)

(Last edited by regressor on 30 Jan 2011, 14:43)

Ok perfomance and stability problem solved. Now I have 11MB/sec LAN-WAN  speed (55% cpu), 64MB of RAM and 4Gb flash drive. smile

The  ar71xx_add_device_usb(); line at file target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c should be added at the beginning of the dir615c1_setup function: just before "if (nvram_parse_mac_addr(...." line.