OpenWrt Forum Archive

Topic: Trendnet TEW-632BRP, TEW-652BRP, DLink DIR-615 C1, CC WLN2206 working!

The content of this topic has been archived between 29 Mar 2018 and 29 Apr 2018. Unfortunately there are posts – most likely complete pages – missing.

RoundSparrow wrote:
codier wrote:

I see. just so curious, cause normal router like d-link, don't even need to press the reset button for 30 second. 192.168.0.1 (router ip) is always available there to let user upload firmware.
so kamikaze doesn't? it will always need recovery boot to be able to bring up the router IP?

You seem to be mixing up a few issues.  These are complex issues, we gave you the simple answer the first time wink

The 192.168.0.1 recovery IP Address is hard-coded into the router base firmware and not something you can change.  It works even if you flash a broken build onto the system (assuming you don't overwrite the recovery flash, make sure you never flash > 3.8MB on this router). It isn't normal router function when booted this way, it is only a way to flash the routers.  Many other routers, like Linksys WRT54G, normally use tftp pull for recovery mode.   I don't think these particular routers in this thread support tftp recovery.

Yes, you can flash a new firmware from the running OpenWRT.  In this thread directions were posted on how to flash a newer version of OpenWRT from OpenWRT using mtd command.  However, flashing back to factory firmware (from running OpenWRT) is something I don't believe anyone has tried.  Flashing can be risky business, I already bricked one router by not paying close attention (flashed 4.8MB onto the router and overwrote u-boot and recovery flash; can probably only be recovered from JTAG which on Atheros is rare experience).  So you better know what the heck you are doing or be willing to take some risks (I donate one $25 TrendNet to the router gods).

I encourage you to realize you are on bleeding edge with these routers.  OpenWRT seems to draw people with older hardware, we are the pioneers here on 802.11n with OpenWRT.  Only 10 or so people in the world are running OpenWRT on them and experimenting.  You are participating in an open source project, a lot of learning and trial and error can be required.  Weeks and months down the road, it will hopefully be simpler and better documented.  For now, we need people participating, testing, and experimenting.

Be glad these specific routers have a nice web browser recovery mode, it is a lot easier than getting the tftp process on most routers.

Got ya.. Thanks for the explanation.

Making some progress with the second ethernet port.  I now got it to appear, but not working yet.  I also have little clue on how to set the MAC address.

Index: target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c    (revision 14145)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c    (working copy)
@@ -112,7 +112,13 @@
     ar71xx_eth0_data.speed = SPEED_100;
     ar71xx_eth0_data.duplex = DUPLEX_FULL;
 
+        ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+        ar71xx_eth1_data.phy_mask = 0x1;
+        ar71xx_eth1_data.speed = SPEED_100;
+        ar71xx_eth1_data.duplex = DUPLEX_FULL;
+
     ar71xx_add_device_eth(0);
+        ar71xx_add_device_eth(1);
 
     ar71xx_add_device_spi(NULL, tew_632brp_spi_info,
                     ARRAY_SIZE(tew_632brp_spi_info));

generates this output:

eth0: Atheros AG71xx at 0xb9000000, irq 4
eth0: connected to 0 PHYs
eth1: Atheros AG71xx at 0xba000000, irq 5
eth1: connected to PHY at 0:00 [uid=004dd042, driver=Generic PHY]

I've tried:  1) up eth1  2) set ip,  3) ping.
Probably that "Generic PHY" is my issue.

RoundSparrow:
Have you tried building a binary for the WNR2000 with these drivers?  I have 2 of these routers and want to try out OpenWRT with one in client mode, but I don't have the skills to make my own.

I suggest we use the thread on the WNR2000.  Bottom line is that the WNR2000 u-boot does some kind of checksum calc that is an issue with flashing.  The Trendnet is a pretty good starting point on this platform as they are inexpensive (on sale for $25 here in the USA several times) and they have a nice recovery flash if we screw them up wink

I'm really just doing testing and trying to keep things moving forward.  I wish we could get more people involved on this router platform - it has a lot of potential and they are a lot cheaper than the beloved Linksys WRT54GL.  It is Gabor Juhos (key OpenWRT developer) who is doing the real work here.  I just donated a Planex router to him that is in the mail from USA --> Hungry that I think will probably help us with some of the non-Trendnet (DLink) flashing.  For now, the WNR2000 is tftpboot only... you can automate it, but you need a second system around to be tftpd server when units are booted.  And settings won't be saved (ramdisk).  Although don't be chicken to experiment, I did.  the tftp recovery the WNR2000 is little tricky, but you can recover from a bad flash.

(Last edited by RoundSparrow on 23 Jan 2009, 05:05)

Jeremy Collake helped me figure out how to get to u-boot prompt on these routers!  The trick is:

1) Hold down reset while connecting power to go to recovery boot.
2) Issue Control-C from the serial port console.  I just hold down control-c and it works for me, not sure on the exact timing.

So now you can do things like tftpboot.  HOWEVER, WARNING:  DO NOT update the u-boot environment.  DO NOT d something like this:

ar7100> setenv bootdelay 3
ar7100> printenv
bootargs=console=ttyS0,115200 root=31:03 rootfstype=squashfs,jffs2 init=/sbin/init mtdparts=ar7100-nor0:128k(u-b)
bootcmd=bootm 0xbf030000
baudrate=115200
ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee
ipaddr=192.168.0.1
serverip=192.168.0.103
stdin=serial
stdout=serial
stderr=serial
ethact=eth0
bootdelay=3

Environment size: 354/65532 bytes
ar7100> saveenv
Saving Environment to Flash...
Protect off BF040000 ... BF04FFFF
Un-Protecting sectors 4..4 in bank 1
Un-Protected 1 sectors
Erasing Flash...Erase Flash from 0xbf040000 to 0xbf04ffff in Bank # 1 First 0x4 last 0x4
erasing flash sect 4, size = 65536
Erased 1 sectors
Writing to Flash... write addr: bf040000
done
Protecting sectors 4..4 in bank 1
Protected 1 sectors
ar7100> reset

This ended up corrupting the normal boot with Bad checksum error (it must have overwritten the Linux Kernel Image I had).  I'm speculating it has to do with the config swapping that the recovery mode does... that this is an alternate u-boot config and isn't intended to be writable.  Lucky for me, a reflash from the recovery bootloader restored things to good order wink

however, I came up with an idea.  The corruption of the Linux kernel Image aborts to the u-boot prompt with the primary configuration!  so these steps:

1. corrupt the Linux kernel image causing u-boot to abort after "Verifying checksum" and give u-boot prompt.
2. setenv bootdelay 3
3. saveenv
4. reboot into recovery mode.
5. flash new firmware.

Alas, this didn't work, it ignored my bootdelay param.  However, this information is good news.  It is now an option to tftpboots on these routers.  Juse use the hold-reset then press Control-C while system boots.

WARNING: DO not  "saveenv" with u-boot, it will corrupt router and may brick it.

(Last edited by RoundSparrow on 26 Jan 2009, 16:39)

Got the second Ethernet (WAN) interface working!  At least on the trendnet 652. If someone wants to confirm the 632 please report back.  Patch submitted: http://lists.openwrt.org/pipermail/open … 03662.html

NOTE:  On the 652, I'm getting: eth1 Link encap:Ethernet  HWaddr 00:00:00:00:00:01 
I have no idea what the normal convention for getting the Mac Address in OpenWRT.  Perhaps this is a sign my driver patch is missing a step?

(Last edited by RoundSparrow on 23 Jan 2009, 21:04)

Ok, I uploaded latest build of openwrt.  This has new compat-wireless ath9k drivers, I patched it for eth0 and eth1 (WAN port now works), hostapd is full version 0.6.7.  Based off trunk svn 14158

http://sites.google.com/site/stephengutknecht/

make sure you get the file with openwrt_14158 start of filename.
WARNING:  The ath9k WiFi driver is not mature on these routers; we have serious CPU performance usage that limits wifi throughput to under 10Mbps... you can see softirq usage high on the router using top.

(Last edited by RoundSparrow on 23 Jan 2009, 21:53)

My intention for now is to see if I can just extend the capability of this router by adding more apps to it.

I've downloaded the GPL code that trendnet made available on their web site.  I'm able to modify the stock busybox to add more features, add dropbear, and my own app onto it.
I use the firmware mod kit to build a new firmware with my extended rootfs, and the router just takes it with no problem.

The trendnet rootfs starts /etc/rc.d/rcS after init.  It then executes /sbin/rc which starts the rest of the application.  Unfortunately, /sbin/rc is a closed source program, as is httpd so you're kind of limited on the app starting order.  The httpd is also closed-source.  It seems to have built-in .cgi which won't recognize any other cgi, but it does display any static file you add to /www.  If you want to add your own cgi, you'll have to add another httpd of your own, run on a different port and add the link to the .asp pages on /www.

Like I mention, I'm able to add my own app and run it just fine.  However, my app has a unique persistent storage requirement - it needs to save a text file.  This router has nvram, but I don't want to use it because my app needs a complex data structure, not flat like what nvram does.  The stock nvram does allow you to set/get/show options.  On the command line, it shows that it has a save and restore (file) option, but I don't think those options work.  I dig around the rooffs tree and find a nvram.h file which exposes the functions of the libnvram.so library.  Some of the notable functions defined in nvram.h are: nvram_set(), nvram_get(), nvram_unset(), and the 2 functions that seem to be missing from the nvram executable: int nvram_file_save() and int nvram_file_restore().  Just like in the command line says, these 2 functions take in a name and a file name (char*) as input parameters.  So I write a small program that call these 2 functions.  I compile and link it to the libnvram.so, and it happily creates my executable. 

It's probably worth to mention that the libnvram.so does not read/write to /dev/nvram as the openwrt nvram does.  It actually read/write into /dev/mtdblock1, which is the "Config" patition of the 4MB NOR flash.  I have no clear idea what these functions do.  My guess, and I hope that the nvram_file_save() function takes a file and saves it to the persistent storage and the nvram_file_restore() fetches it from the flash (by the key name) and writes it out to a restore file.  When I run my own nvram which calls the save() function:

#mynvram save foo foo.txt

it seems to pause a little bit as if it's writing to the flash (i have no way to confirm it).  And when I run:

#mynvram restore foo /tmp/out.txt

it does produce a /tmp/out.txt, but empty.

Like I said, I have no clear idea of what these functions do, so I just gave it a shot to see where it goes, but they don't quite work the way I hope it would.

Has anyone gone further that I have and perhaps shed some light?  Do you know of any way to save a file to one of the mtd partition?

If you intend on working with the stock 2.6.15 static vendor firmware, I suggest you see the dd-wrt forum thread on the TP-Link 802.11n router that is similar.  It is almost identical AthSDK and user Lark went pretty far on stock firmware.

Yes, I've read that thread.  Lark has done quite extensive work, but there is only mention of nvram, not what has been done with it.  I think it ended with him saying that would be the next step, unless I'm missing something.

scerpio wrote:

Yes, I've read that thread.  Lark has done quite extensive work, but there is only mention of nvram, not what has been done with it.  I think it ended with him saying that would be the next step, unless I'm missing something.

Ok you did your homework; my only advice is to keep the stock firmware discussion over on dd-wrt  smile  Here we are pretty close to having a totally free and open solution.  Atheros has NOT released the source code of madwifi drivers for the ar9102/ar9103 chips so we have had to spend a lot of time reinventing the wheel.  A bit of a sore point wink

(Last edited by RoundSparrow on 25 Jan 2009, 16:23)

Updated first post with a warning about the erratic switch behaviour when you boot the router in firmware recovery mode.  Advise that you only connect the computer you are flashing from when you flash using the recovery mode.

Newegg just put on sale the Trendnet 652 for $25 with free shipping in USA.  Again, ath9k driver is not yet mature and slow performance - but this platform has a lot of potential!

http://www.newegg.com/Product/Product.a … 6833156242

RoundSparrow,

I updated the u-boot env and now it doesn't boot.  I tried the recovery with the dir-615 image, but it rejected it.  Which image did you use to get it to recover?

scerpio wrote:

I updated the u-boot env and now it doesn't boot.  I tried the recovery with the dir-615 image, but it rejected it.  Which image did you use to get it to recover?

updating u-boot environment (and saving it with savenenv) always seems to corrupt it.

Which brand and model of router do you have?  You sure you have the DIR-615 c1 download, unmodified?  When I corrupted mine the same way I recovered it by flashing to OpenWRT .webui file using the recovery loader and I was fine.  I never tried going from corrupted --> factory, but it should work if you have the proper file with the proper device ID on end.

Please see the warning about disconnecting all other Ethernet cables when using the recovery boot loader.

I have the TEW-652BRP. I use the dir-615 MOD image, but it rejects it.
The memory allocated for uboot env is large enough to accommodate the changes in the env.  It just somehow corrupts the kernel at address 0xbf030000 when you saveenv.  If you can just copy the kernel image to this address, it will be fine, I think.  The trick is how to get the kernel to the unit from here.  tftpboot is not available in this uboot.  I thought the recovery flash (http) should do it, but apparently not.

scerpio wrote:

I have the TEW-652BRP. I use the dir-615 MOD image, but it rejects it.

On the 652, the recovery bootloader expects UNMODIFIED 615.  Yes, it is confusing.

1) The original trendnet normal firmware website that you get with the router has a flash that expects the Trendnet ID.
2) The recovery boot loader expects the D-Link DIR-615 C1 ID.

Trendnet had no real intention of supporting or using the recovery bootloader... it isn't something a normal end user would even know about wink

If that doesn't work, use what I used... OpenWRT image.  I posted some here: http://sites.google.com/site/stephengutknecht/  You want the 'webui' extensions.

(Last edited by RoundSparrow on 26 Jan 2009, 18:53)

juhosg developed a better patch for the eth1 wan port and has commited new logic for MAC address on the platform.  With his path (which we test on both Trendnet 632 and 652) I believe this gives us VLAN now?  Anyway - his patch will be commited tomorrow.  His patch plus current SVN 14212

ar71xx: using random MAC address for eth0
ar71xx: using random MAC address for eth1
ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xb9000000, irq 4
eth0: connected to 4 PHYs
eth1: Atheros AG71xx at 0xba000000, irq 5
eth1: connected to PHY at 0:04 [uid=004dd042, driver=Generic PHY]

I tested eth0 and eth1 and seems to be working great. juhosg is the real developer here, I'm just a cheerleader wink

isn't there a set number of times you can write to the flash memory ?

all those nightly builds are killing off the memory 1 flash at a time no?

geminijatt wrote:

isn't there a set number of times you can write to the flash memory ?
all those nightly builds are killing off the memory 1 flash at a time no?

Yes, there is a limit but it is very high.  The file system on the flash is much more concern than the flash process.  Don't worry, there are people using 6 year old WRT54G that they flash.  you can do 100,000 times - hopefully you don't reach such a limit wink  These routers have much newer FLASH chips.

I have a new update for those wanting binary download. svn r14212, patched with eth1 WAN port patch not yet checked in, 2.6.28 kernel.
http://sites.google.com/site/stephengutknecht/

NOTE:  Wifi seems to not work for me on r14212, maybe a new one in 24 hours.

(Last edited by RoundSparrow on 27 Jan 2009, 01:49)

Howdy.  Uploaded latest build.  This is openwrt trunk svn 14250 patched to fix an issue with ath9k startup that will be checked in shortly.  It is kernel 2.6.28.2 build!  Tested and works fine.  The ath9k driver still needs performance tuning and you will find CPU of the router goes to 100% and maxes out unencrypted transfers at 725KB/second (around 9Mbps).   The ethernet interfaces should all be in great working order with OpenWRT now!

http://sites.google.com/site/stephengutknecht/

new binary for svn 14284 uploaded.  http://sites.google.com/site/stephengutknecht/
compat-wireless has been updated again.  Since there hasn't been much testing feedback of late, I only uploaded the .bin file which you can flash from OpenWRT to OpenWRT upgrade with mtd command.  If you want to flash from stock firmware - put one of the older downloads on.

BIG NEWS!  The high CPU usage of the ath9k driver has been tracked to the LED on/off setting in the driver.  The LED support has been disabled and I'm seeing much lower CPU usage rates!  So this is the build to start doing some serious testing.

This is pretty much stock openwrt build 14334, but I did change the defaults for hostapd to be 130Mbps 802.11n rate (instead of 54Mbps).  If you want to try faster 40Mhz band, on the installed router revise ./lib/wifi/hostapd.sh file, changing the value of the ht_capab= line.

download the 14334 builds here:  http://sites.google.com/site/stephengutknecht/

Hi RoundSparrow,

Question, how can i update the firmware?

I am a newbie of OpenWRT and not familiar with Linux...
I have loaded the svn 14250 version of your binary into my new TEW-652BRP and stuck with the text interface.
Is there a web interface in your .webui binaries?
Also, I failed to get into the recovery page. No matter how long I hold the reset, it still boot into the regular OpenWRT os.
So I need a detail instruction about how to update the firmware with telnet...

Can you help me? Thanks.

- Wing

(Last edited by wz1012 on 1 Feb 2009, 01:45)

wz1012 wrote:

I have loaded the svn 14250 version of your binary into my new TEW-652BRP and stuck with the text interface.
Is there a web interface in your .webui binaries?
Also, I failed to get into the recovery page. No matter how long I hold the reset, it still boot into the regular OpenWRT os.
So I need a detail instruction about how to update the firmware with telnet...

Hi Wing,

1. There is no web interface in the default load I provided.  You can load one with the OpenWRT package manager.

2. The recovery page should work.  Are you holding reset BEFORE you plug in the router... then 30 seconds after you plug in the router?  It should NOT boot into normal, then the status light should blink.  The reset button is a little hard to hold, I suggest finding something that fits well.  I used a q-tip that I cut in half, the stem of the q-tip is perfectly sized wink  You will need this if you want to go back to Trendnet or D-Link vendor firmware.

3. To update the router from openwrt to openwrt... use the .bin file.  You can do these:
   A) make sure the router can reach the internet.  You may need to use UCI to set an IP Address to your main internet router.
   B) cd /tmp
   C) wget http://sites.google.com/site/stephengut … edirects=0
   D) mtd -r write openwrt_14334_k28p2-ar71xx-tew-632brp-squashfs.bin firmware

Router should reboot on own and go into the new OpenWRT, I think config gets reset back to default.

(Last edited by RoundSparrow on 2 Feb 2009, 23:54)

Sorry, posts 51 to 50 are missing from our archive.