OpenWrt Forum Archive

Topic: U-Boot mod for routers with AR9331/AR9344

The content of this topic has been archived between 3 Apr 2015 and 7 May 2018. Unfortunately there are posts – most likely complete pages – missing.

alphasparc wrote:
djdeeles wrote:

I flashed latest binaries from pepe2k with some overclock (hexedit). But i got some memory errors. I need to pay attention because i dont have any jtag or programmer experience.

720/480/240 flashed succesfully and run memtester it's fails on some tests. Then lowered memory clocks.
720/400/200 ran memtester it's passed on each test and stable.

I want to go higher frequencies. Can i run 780mhz cpu with 400/200 memory clock? Does memory clocks limit cpu or linked?
Any suggestions about clock combinations with hex values?

IIRC the stock frequency is 560/480/240.
Does your Router pass memtester at Stock settings?

Not tested at stock settings. It's like going to fail at stock settings smile

djdeeles wrote:
alphasparc wrote:
djdeeles wrote:

I flashed latest binaries from pepe2k with some overclock (hexedit). But i got some memory errors. I need to pay attention because i dont have any jtag or programmer experience.

720/480/240 flashed succesfully and run memtester it's fails on some tests. Then lowered memory clocks.
720/400/200 ran memtester it's passed on each test and stable.

I want to go higher frequencies. Can i run 780mhz cpu with 400/200 memory clock? Does memory clocks limit cpu or linked?
Any suggestions about clock combinations with hex values?

IIRC the stock frequency is 560/480/240.
Does your Router pass memtester at Stock settings?

Not tested at stock settings. It's like going to fail at stock settings smile

I have seen dozen of WDR3600/4300 with faulty memories, failing on stock clocks in memtester.

pepe2k wrote:
djdeeles wrote:
alphasparc wrote:

IIRC the stock frequency is 560/480/240.
Does your Router pass memtester at Stock settings?

Not tested at stock settings. It's like going to fail at stock settings smile

I have seen dozen of WDR3600/4300 with faulty memories, failing on stock clocks in memtester.

Can I try 780/400/200 or 780/450/225 combinations?  Does memory clocks limit cpu or linked?

I believe you can.
The CPU PLL is independent of the RAM.
Just a question what is the brand of the RAM in your unit?
Hynix/Samsung/Winbond?
From experience Hynix and Samsung can definitely clock 500/250 for RAM and AHB and still pass memtester.
If your unit can't do 240 AHB you can try 230 and so on unit it passes.

(Last edited by alphasparc on 2 Dec 2014, 11:17)

alphasparc wrote:

I believe you can.
The CPU PLL is independent of the RAM.
Just a question what is the brand of the RAM in your unit?
Hynix/Samsung/Winbond?
From experience Hynix and Samsung can definitely clock 500/250 for RAM and AHB and still pass memtester.

Hynix H5PS5162GFR. I'm thinking to try 780/450/225 clocks. Any recommendations.

My advice is start low go high, because if it starts to crash you can still recover easily.
If you start high go low, you better have your soldering iron and pray that your soldering skills are not rusty.

Simple eg.
Test Max stable RAM:
Since 480 not stable then 470  memtester until stable
For CPU since 720 stable then 730 memtest + wireless + iperf + USB until not stable.
Try not to test CPU and RAM concurrently more haste less speed have a understanding of performance state

(Last edited by alphasparc on 2 Dec 2014, 11:38)

Flashed the new uboot through the older version's webpage successfully for wdr3600. Is there any way I can overclock the ram versions just to try them out in a failsafe manner?

HW:TP-LINK TL-WR340G
Original 2MB flash and 16M RAM. Modified to 16/64MB.
It is an generic AR9331 board. Bootloader compiled for target WR740N v4, openwrt for WR741ND v4.

Bootloader modified from git Nov 8 2014.

Issue: When an ethernet cable is connected to the wan or lan switch port, the bootloader fails to uncompress image or freezes completely.

*********************************************
*   U-Boot 1.1.4  (Nov  9 2014, 18:23:34)   *
*********************************************

AP121 (AR9331) U-Boot for TL-WR74xN/D v4

DRAM:   64 MB DDR 16-bit
FLASH:  Winbond W25Q128 (16 MB)
CLOCKS: 400/400/200/33 MHz (CPU/RAM/AHB/SPI)

LED on during eth initialization...

Hit any key to stop autobooting:  0 

Booting image at: 0x9F020000

   Image name:   OpenWrt r43220
   Image type:   MIPS Linux Kernel Image (lzma compressed)
   Data size:    1057588 Bytes = 1 MB
   Load address: 0x80060000
   Entry point:  0x80060000

Uncompressing kernel image... 

Sometimes this is appended:

Uncompressing kernel image... ## Error: LZMA error num: 1

## Error: failed to execute 'bootcmd'!
HTTP server is starting for firmware update...

Link down: eth0
Link down: eth1
Link down: eth0
Ethernet mode (duplex/speed): 1/1000 Mbps
HTTP server is starting at IP: 192.168.1.1
HTTP server is ready!

But if the boot process with the connected cable is interrupted by the terminal (1x enter) and then the command "boot" is run, everything is OK.

uboot> boot

Booting image at: 0x9F020000

   Image name:   OpenWrt r43220
   Image type:   MIPS Linux Kernel Image (lzma compressed)
   Data size:    1057588 Bytes = 1 MB
   Load address: 0x80060000
   Entry point:  0x80060000

Uncompressing kernel image... OK!
Starting kernel...

[    0.000000] Linux version 3.10.58 ......

Normal boot without any eth connected:

*********************************************
*   U-Boot 1.1.4  (Nov  9 2014, 18:23:34)   *
*********************************************

AP121 (AR9331) U-Boot for TL-WR74xN/D v4

DRAM:   64 MB DDR 16-bit
FLASH:  Winbond W25Q128 (16 MB)
CLOCKS: 400/400/200/33 MHz (CPU/RAM/AHB/SPI)

LED on during eth initialization...

Hit any key to stop autobooting:  0 

Booting image at: 0x9F020000

   Image name:   OpenWrt r43220
   Image type:   MIPS Linux Kernel Image (lzma compressed)
   Data size:    1057588 Bytes = 1 MB
   Load address: 0x80060000
   Entry point:  0x80060000

Uncompressing kernel image... OK!
Starting kernel...

[    0.000000] Linux version 3.10.58 

After the linux boots, connecting eth does not have any effect, everything works. First I thought some hardware issue but if the boot command loads the image, it seems to be some SW initialization related.

t_n wrote:

HW:TP-LINK TL-WR340G
[...]
It is an generic AR9331 board.
[...]

Are you sure? Could you post photo of the board?

Its almost identical to this
http://wiki.openwrt.org/_detail/toh/tp- … tl-wr741nd

The RAM mod needed population one resistor for address line.

The bootloader for wr703n behaves the same.

Even the newest version of uboot-mod has this problem.

t_n wrote:

Its almost identical to this
http://wiki.openwrt.org/_detail/toh/tp- … tl-wr741nd

Really, TL-WR340G? I thought that TP-Link uses "G" in model name for 802.11g only devices.

t_n wrote:

The RAM mod needed population one resistor for address line.

The bootloader for wr703n behaves the same.

Even the newest version of uboot-mod has this problem.

Could be related with too high SPI clock (33 MHz), I have already seen similar problems on fake Winbond chips from China.
Or some other issue.

Have you tried some original U-Boot image from TP-Link (you may find some in my GitHub repository)?

(Last edited by pepe2k on 10 Dec 2014, 20:50)

Solved:It was a hardware problem.

(Last edited by t_n on 15 Dec 2014, 18:45)

I have tried compiling the u-boot_mod and followed the steps from here:


Now we need to install some packages on Ubuntu (if you haven't already):

sudo apt-get update
sudo apt-get install git
sudo apt-get install openjdk-7-jdk
sudo apt-get install minicom

To compile pepe2k's u-boot_mod:

cd /home/user

git clone https://github.com/pepe2k/u-boot_mod.git

cd u-boot_mod

wget http://downloads.openwrt.org/attitude_a … .2.tar.bz2

tar -xjvf OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2

mv OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ /home/user/u-boot_mod/toolchain

Now open up /home/user/u-boot_mod/Makefile in your favourite text editor and change:

export MAKECMD=make –silent ARCH=mips CROSS_COMPILE=mips-linux-gnu-

to

export MAKECMD=make ARCH=mips CROSS_COMPILE=mips-openwrt-linux-uclibc-

under that line add a new one:

export PATH:=$(BUILD_TOPDIR)/toolchain/bin/:$(PATH)

Save and exit.

Now run command make clean_all

and make tplink_wr740n_v4


And I always get this error. I am using ubuntu 14.07.

/u-boot_mod$ make tplink_wr710n
make[1]: Entering directory `/home/rsd/u-boot_mod/u-boot'
# max delay time for button pressing
# don't show info about console (in, out, err...)
> Configuring for TP-Link TL-WR710N at: Jum Dis 19 20:59:51 MYT 2014
make[1]: Leaving directory `/home/rsd/u-boot_mod/u-boot'
make[1]: Entering directory `/home/rsd/u-boot_mod/u-boot'
Makefile:147: warning: overriding commands for target `.PHONY'
Makefile:145: warning: ignoring old commands for target `.PHONY'
Makefile:233: warning: overriding commands for target `board/ar7240/ap121/libap121.a'
Makefile:201: warning: ignoring old commands for target `board/ar7240/ap121/libap121.a'
Makefile:233: warning: overriding commands for target `cpu/mips/libmips.a'
Makefile:201: warning: ignoring old commands for target `cpu/mips/libmips.a'
Makefile:233: warning: overriding commands for target `cpu/mips/ar7240/libar7240.a'
Makefile:201: warning: ignoring old commands for target `cpu/mips/ar7240/libar7240.a'
make[2]: Entering directory `/home/rsd/u-boot_mod/u-boot/tools'
ln -s ../common/environment.c environment.c
ln -s ../lib_generic/crc32.c crc32.c
make[2]: Leaving directory `/home/rsd/u-boot_mod/u-boot/tools'
make[2]: Entering directory `/home/rsd/u-boot_mod/u-boot/tools'
make[2]: `.depend' is up to date.
make[2]: Leaving directory `/home/rsd/u-boot_mod/u-boot/tools'
make -C tools all
make[2]: Entering directory `/home/rsd/u-boot_mod/u-boot/tools'
gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x80010000 -DUSE_HOSTCC -O2 -c mkimage.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
make[2]: *** [mkimage.o] Error 1
make[2]: Leaving directory `/home/rsd/u-boot_mod/u-boot/tools'
make[1]: *** [tools] Error 2
make[1]: Leaving directory `/home/rsd/u-boot_mod/u-boot'
make: *** [tplink_wr710n] Error 2

Any ideas anyone?

whereis cc1 does not bring up anything..

(Last edited by arell50 on 19 Dec 2014, 15:31)

For those wdr3600 who which failed memtest at stock what is the RAM and AHB Clock that fixed it?

I run at 720 400 200 without problem

djdeeles wrote:

I run at 720 400 200 without problem

Is that the highest? I am more interested in the RAM and AHB Frequency.
I am planning to start embbedding the uboot into factory images so more people will be able to use it so I want to offer a fix for those "memtester" fail units.

(Last edited by alphasparc on 20 Dec 2014, 13:06)

I didnt try too much but 480 & 450 not stable for me. I'm open for suggestions smile

djdeeles wrote:

I didnt try too much but 480 & 450 not stable for me. I'm open for suggestions smile

440? Minus 10 until stable

Tried 720/420/210 still errors. I think 400/200 will be safe.

memtester version 4.3.0 (32-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 50MB (52428800 bytes)
got  50MB (52428800 bytes), trying mlock ...locked.
Loop 1/1:
  Stuck Address       : ok
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok
  Block Sequential    : ok
  Checkerboard        : ok
  Bit Spread          : testing  23FAILURE: 0x02800000 != 0x02000000 at offset 0x00fd6b80.
  Bit Flip            : testing 184FAILURE: 0x00000000 != 0x00800000 at offset 0x00032d04.
FAILURE: 0x00000000 != 0x00800000 at offset 0x001c0244.
FAILURE: 0x00000000 != 0x00800000 at offset 0x004f2c64.
FAILURE: 0x00000000 != 0x00800000 at offset 0x005e9624.
FAILURE: 0x00000000 != 0x00800000 at offset 0x008cad04.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00c8ad04.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00e0cfa4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00e46da4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00e47624.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00e49e64.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00e724e4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00e73484.
FAILURE: 0x00000000 != 0x00800000 at offset 0x00edd204.
FAILURE: 0x00000000 != 0x00800000 at offset 0x010930e4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x0109afc4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x010ee844.
FAILURE: 0x00000000 != 0x00800000 at offset 0x01256884.
FAILURE: 0x00000000 != 0x00800000 at offset 0x015c1624.
FAILURE: 0x00000000 != 0x00800000 at offset 0x01732d04.
FAILURE: 0x00000000 != 0x00800000 at offset 0x017e3dc4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x017e50e4.
FAILURE: 0x00000000 != 0x00800000 at offset 0x018c3864.
FAILURE: 0x00000000 != 0x00800000 at offset 0x018fc384.
  Walking Ones        : ok
  Walking Zeroes      : ok
  8-bit Writes        : ok
  16-bit Writes       : ok
dony71 wrote:
pepe2k wrote:
dony71 wrote:

Will you help take a look on the code if you have time?

I will, post somewhere your code. Does your code base on my modification?

hi pepe2k,

have you got a chance to take a look at source code?
today i compile another u-boot with DEBUGOUT enable in athrs26_phy.h
i'm very puzzle because i don't see anything wrong on DEBUGOUT print below,
but ping still unsuccessful

=============================================================
U-Boot 1.1.4 (Apr 16 2014 - 16:51:50)

AP94 (ar7100) U-boot 0.0.12
DRAM:  b8050000: 0xc0140180
32 MB
Top of RAM usable for U-Boot at: 82000000
Reserving 224k for U-Boot at: 81fc4000
Reserving 192k for malloc() at: 81f94000
Reserving 44 Bytes for Board Info at: 81f93fd4
Reserving 36 Bytes for Global Data at: 81f93fb0
Reserving 128k for boot params() at: 81f73fb0
Stack Pointer at: 81f73f98
Now running in RAM - U-Boot at: 81fc4000
id read 0x100000ff
flash size 8MB, sector count = 128
Flash:  8 MB
In:    serial
Out:   serial
Err:   serial
Net:   ag7100_enet_initialize...
No valid address in Flash. Using fixed address
start auto negogiation on each phy
PHY Base: 0x0 PHY Addr: 0x0
PHY Base: 0x0 PHY Addr: 0x1
PHY Base: 0x0 PHY Addr: 0x2
PHY Base: 0x0 PHY Addr: 0x3
associated PHY
Port 0, Neg Success
Port 1, Neg Success
Port 2, Neg Success
Port 3, Neg Success
Initialize software status
eth0: Phy Specific Status=0010
eth0: Phy Specific Status=0010
eth0: Phy Specific Status=0010
eth0: Phy Specific Status=0010;
                               eth0: 00:03:7f:09:0b:ad
eth0 up
No valid address in Flash. Using fixed address
start auto negogiation on each phy
PHY Base: 0x0 PHY Addr: 0x4
associated PHY
Port 4, Neg Success
Initialize software status
eth1: Phy Specific Status=0010
eth1: 00:03:7f:09:0b:ad
eth1 up
eth0, eth1
Hit any key to stop autoboot:  0
ar7100> ping 192.168.1.5

enet0 port0 up
Using eth0 device
sending ARP for c0a80105
ARP broadcast 1
ARP broadcast 2
ping failed; host 192.168.1.5 is not alive

hi pepe2k,
long forgotten bugs
have you got chance to take a look on this?

I bought a flash S25FL127S, but when programming it says jedec id: 010017h. :S Does it work?

EDIT: Didn't work. I have to recompile the code. smile


EDIT: :S Have some weird stuff going on. When I plug in the programmer everything is ok and jedec is same as S25FL127S should have, but after some commands it truns to 010017H. :S Going to solder a new programmer and get other computer. smile


EDIT: Really Really weird things going on with this chip. I had previously installed one 16mb chip same brand and same jedec as in uboot. Now my new chip sometimes showed normal jedec, but other times something really weird. Soldered into the 703n and It showed unknown jedec chip. Jedec was some numbers. Now I added those jedec numbers to uboot recompiled the uboot, flashed it on chip and it recognized my weirdly acting chip. Now I have working 16mb version, I'll not touch that uboot on that chip again. smile

(Last edited by Kaar3l on 26 Dec 2014, 00:03)

I am needing to "underclock" a router based on TP MR3220 V1.  Using an AR7241 SOC.  Trying to reduce the heat output from the 7241.

Based on what I read, there was some indications that it might work, but it also seems that it is not listed as supported so I suspect the u-boot mod does not work as-is on that SOC.

Can someone, or pepe2k, confirm this one way or the other?

Is it possible for to use the source for the u-boot mod and add support for 7241, or will the U-Boot not work on that SOC?

I also saw lots of posts to change the clock speed during runtime of OpenWRT using "io" commands, but that topic seemed to drop off so not sure if it was ever a viable solution or u-boot is the only option?

Thanks in advance, and pepe2k, you are the man for all this work you have done.