Posted: Sun Nov 08, 2009 5:19 Post subject: New Code to add Support for USR5465
I have been programming for about 30 years and building computers for at least 25. Among my specialties are designing hardware interfaces for embedded microcontrollers and writing compact code for same in assembler and higher level languages, which has been good for my wallet. I have successfully installed and configured DD-WRT on a variety of routers from multiple manufacturers, never having trouble till I undertook to try DD-WRT on one of my USR5465 routers. This post and this post detail the results of those experiments. I must say that before I tried the flash, and again before I asked for help when the flash didn't work, I searched for and read all pertinent forum posts and wiki articles for what little information there was about this device.
Since then, further experimentation has made me strongly suspect that support for the USR5465 was at best incomplete. Therefore I have dug more deeply into other resources and into the DD-WRT source code itself to resolve the matter. Finding my suspicions to have grounds in fact, I thought that the quickest way to get full DD-WRT support for the USR5465 and its "one-port twin" the USR5455 would be to simply provide the missing code myself, which I am happy to do (see below). The new code should add little overhead to the firmware, and if need be, I could help save some bytes and CPU cycles elsewhere to compensate for the addition. If this not the appropriate way to do this, I trust that others will kindly direct me how I should do otherwise. And by all means do point out any errors; that’s why I put this before the public.
Acknowledgment: I obtained the boardnum and the LED gpio assignments for the USR5465 from the diag.c code mentioned in this blog article. I was able to get the vlan ports and interface names from the nvram dump provided by the factory firmware.
Last edited by modervador on Tue Nov 24, 2009 2:58; edited 1 time in total
I think this is a better place for code suggestions:
http://svn.dd-wrt.com:8000/dd-wrt/timeline _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
Eko, thanks for your continuous effort and I look forward to helping this project in whatever small way I can.
Frater, your link took me to a timeline with no obvious way to post code suggestions, but I took the next step and registered, and voila! a "new ticket" button appeared, which is what I presume you wanted me to find. I'm new to this ticket thing, but I'll learn. Thx.
Thank you Eko for adding the code. Happy birthday, and congratulations on getting the N-16 going; that will make many people happy.
Here's an update. I flashed my USR5465 with dd-wrt.v24-13230_NEWD_micro-plus.bin and the behaviour is exactly the same as past experience. According to the LED patterns and ping responses (described previously), the router always reboots after turning on the USB LED and then apparently starting to bring up the radio. The evidence suggests that the internal_getRouterBrand() function of src/router/libutils/utils.c detects the USR5465 as some other router which is not compatible with the USR5465. It may be that its boardnum is not 35324 after all, and of course there is no simple way to read that parameter without the router fully booting. I'll activate a ticket. Based on private messages I've received, it seems there are several folks with USR 5465 and 5455 routers who might benefit from this.
According to the LED patterns and ping responses (described previously), the router always reboots after turning on the USB LED
So are you saying that turning on the USB led causes the router to reboot?
If so, then I suggest to take out those code lines until you are sure about the gpio's and the boardnum.
Hook up the serial port and take a boot log, it will likely tell what happens. _________________ Kernel panic: Aiee, killing interrupt handler!
So are you saying that turning on the USB led causes the router to reboot?
If so, then I suggest to take out those code lines until you are sure about the gpio's and the boardnum.
Hook up the serial port and take a boot log, it will likely tell what happens.
I'm saying the router always reboots after turning on the USB LED and then apparently starting to bring up the radio, as described in a post cited in the first post in this thread.
Since the behaviour is unchanged after adding code to detect the USR5465, it seems likely that the problem begins there. I think the USB LED comes on because DD-WRT "thinks" it's turning some other LED on (or off) for some other router. For example, there are several routers with boardtype=="0x048e" which use gpio1 for the power LED or for some other LED.
I'm resisting the serial port because it involves purchasing, soldering etc. and my electronics shop is in transition. Software seems more straightforward at the moment. I have seen other folks receive a "test build" to get their routers running such that they could grab the CFE and nvram without hardware hacking. I hope to successfully compile of DD-WRT from source someday soon myself, and I've got Ubuntu Karmic on a few machines and I've almost got it to compile with the 24_2 kernel, but I don't think the svn repository contains all the up-to-date make/install scripts. So I'm not all the way there yet, and I depend on the kindness of friends and strangers who have the actal means to compile.
test build,
If it runs, recheck gpios and board detection numbers.
send me cfe and nvram.
Don't use this build on any other router!
WOW!! Thanks! I guess you were busy doing actual coding while I was typing my previous post. (I am a slow typer when also looking at code on other screens.)
I am being called away now, so I will try this in a few hours and report back.
Last edited by modervador on Tue Nov 24, 2009 5:43; edited 1 time in total
Let us all break forth with the w00t. Attached screenshot is proof of the pudding. 256 kB CFE is also attached. (I'd email it to cfe dot backup at yahoo dot co dot uk but at the moment I'm behind a corporate firewall that blocks SMTP.)
WL0 LED blinks at the correct time (slowly when disconnected in client mode, swiftly when packets go in/out). External antenna is "right". Some relevant nvram values:
gpio poll 0 thru 8: no change with reset button. Reset button causes instant reboot before the value is updated on screen.
gpio disable 7: causes instant reboot, regardless of whether gpio enable 7 was done before or not.
gpio enable 2 turns USB (printer) LED on.
gpio disable 2 turns USB (printer) LED off.
No gpio enable/disable 0 through 8 seems to affect the WAN LED, which is always off in client bridge mode.
Power LED is always on, unaffected by gpio enable/disable.
I am corresponding with the writer of this blog, Vivek Unune. For now we can't rule out the possibility of two or more revisions for this device, each having different a boardnum. Apparently he read his as 35324, while mine is 38256. Also, he finds the USB gpio to be 1, while I find it to be 2.
Next on the agenda is to determine if the WAN LED can be made functional. Perhaps it depends on whether the router is in AP or client mode, with the WAN port enabled and/or configured as a 5th switch port.
Results of further testing. I have flashed a second USR5465.
In client bridge and AP mode, with a cable plugged into the WAN port:
gpio enable 4 turns WAN LED on. Blinks with traffic. Goes out if cable is removed.
gpio disable 4 turns WAN LED off.