A post on the Gargoyle forums refers me to setconsole, which isn't included in either version (stable/testing) anymore. I tried with several setconsole compiles of my own only to get an assortment of error messages. Because compiling a whole new firmware is entirely too much of a pain for something as simple as freeing up a serial port i ended up unpacking the kernel image and modifying the hardcoded string with a hex editor. Then repacking, padding, and flashing the modified image to the Fonera. (modify the string to console=/dev/null)
The LZMA SDK from 7zip can be used for the compression.
Make note of the kernel image size before unpacking, and pad with null bytes to that exact size after repack. This is not optional. Flashing will fail otherwise.
This worked, so I proceeded to disable the shell in /etc/inittab making the serial port usable again.
Thanks to the OpenWRT roots the rest was pretty easy on the software side.
the commands
opkg update
opkg install owfs
opkg install owhttpd
gave me all the tools I needed to work with 1-wire.
And ..
opkg install php4-cli
opkg install php4-mod-gd
gave me what I needed to code up web interfaces.
The CLI compile is required because the CGI one is Apache specific. Gargoyle has a small httpd lacking most of Apache's features. The CGI compile will error out however the CLI release can be made to work. There are certain annoyances like a missing $_GET/$_POST and the requirement to send a \n before page content and after headers, but they are not that serious.
( to fix get: parse_str($SERVER["QUERY_STRING"],$_GET) )
On the hardware side I opted to use a DS2480B 1-Wire Line Driver chip. This chip is used in the DS9097U adapters so it's basically the standard in UART to 1-Wire interfacing. I wanted to include fancy things on the board like a software controlled power switch and an activity LED, but in the end I abandoned both. The power switch didn't work out, and the LED was pretty useless due to the low activity on the bus. Because of this the original board is ugly and overkill. It is however extremely simple to hook this chip up. There are no external component requirements. POL VPP and VDD needs to be connected to together. Rest is obvious. (TXD,RXD, 1-w DQ and GNDs to appropriate holes/solderpads on the interface board, then TXD,RXD,GND to Fonera, and DQ and GND to some sort of connector for the 1-Wire bus. You can also get the 5V for the interface board by soldering to the Fonera's PSU connector)
Here's a simplified interface board:
eagle brd here
I opted to use an RJ9 connector simply because I had one on hand, and because it fit right next to the Ethernet's RJ45.
You might want to consider including the Fonera's 5V on your connector. It could become handy if you want to attach non-parasitic devices in the future. I opted not to do so. I will be building a "powered hub" out of a 5way phone-line splitter later.
For testing I used iButtons hooked up as seen below.
RJ11 Blue dot receptor -> Ghetto RJ9<->RJ11 cable -> Fonera
Simple OWFS testing: (connecting and removing iButton)
Success!
Now I have a LAN/WLAN/MicroLAN router :)
Great job. I was also thinking of doing that. Never found the time though. Certainly going to do this to. They did not add it to the owfs site yet.
ReplyDeleteCan you share the modified kernel?
ReplyDeletehttp://www.mediafire.com/?vv1k4ihgjjm
ReplyDeleteGood Luck :)
Congratulation that's a nice project! It wasn't possible to change kernel parameters passed-on to the kernel from redboot pompt?
ReplyDeleteInouk (from fon.com)
Thanks
ReplyDeleteBoth DD-WRT and Gargoyle seemed to fall back on their hardcoded strings and ignored the one I set in redboot for some reason. I added it to the exec command with -c. I couldn't get it to use anything I set there. I'm pretty sure I double-checked everything. Maybe someone else can get it to work that way, I gave up :)
This is very cool. I did something similar with my Fonera using OpenWRT Kamikaze build. I did not need to alter RedBoot at all to get serial to work, just had to make the small change to /etc/inittab to get serial working.
ReplyDeleteThat works if your build doesn't have system console set to /dev/ttyS0. If you just disable shells in inittab you can use the serial, but if the system console is still set there then kernel messages might disrupt whatever it is you have on serial.
ReplyDeletehey how you did this part? modify the string to console=/dev/null
ReplyDeletecan you tell me more detailed information? thanks :)
With a hex editor :)
ReplyDeletebtw i tried your compiled firmware but when it asks for admin password i put: admin
ReplyDeletebut it didnt work :S
The default might be "password" but I don't remember anymore. A search on the gargoyle site will prolly turn it up. I haven't compiled anything It's the official release's unmodified rootfs in that archive. My only modification was in the kernel.
ReplyDeletedo we need to change anything on redbot? password: password :) thanks :)
ReplyDeleteSince it's booting fine probably not :) No problem
ReplyDeletewhat version of Fonera did you use? i'm trying to make this project with Fonera 2100 with your firmware but it gives no data to serial port (http://www.jbprojects.net/projects/wifirobot/#software) and if you want to see my post on openwrt (https://forum.openwrt.org/viewtopic.php?id=24078) :)
ReplyDeleteIt should work fine with a 2100. Possibly some problem with your serial interface?
ReplyDeletenope, i tested it with serial console ( before disable that) and it works :S
ReplyDeleteI see. Maybe try skipping setserial/stty commands. (If you're using them) Port should be at 9600bps by default or the speed configured in redboot. Don't know. But it should work at one of those speeds. Works fine for me at 9600. Didn't do any testing at other speeds.
ReplyDeleteit isnt at 9600 by default i think, and my circuit needs that speed
ReplyDeleteIt is for me ;) Try setting 9600 in redboot fconfig.
ReplyDeletecan you tell me how i do that? :)
ReplyDeleteEnter redboot
ReplyDeleteEnter the fconfig command
Leave other settings intact (you may need to re-type the boot script, but it'll show the original. Just copy.)
When it gets to Console baud rate, delete original value and type 9600
When it asks you if you want to update the config choose yes. You can always choose no if you've made a mistake and retry.
Type reset or just powercycle the router.
What commands are used to unpack/repack the file properly with the [LZMA SDK from 7zip]? I have tried some ways but after comparing my files with the original files and your file I think I'm doing it wrong. So if you could answer this question I would be pleased, and a bit wiser.
ReplyDeleteNever mind my last comment. I solved it, I was just being particularly stupid at the time. Anyway, here is a link to the latest(2010-07-02) OpenWrt Backfire version (10.03, r20728) with the same modification as linked above. Still need to disable the shell in /etc/inittab . But after that you are gold. All owfs programs are available as packages in a slightly newer version (2.7p21-1).
ReplyDeletehttp://www.mediafire.com/?whhytzcqddj
http://www.mediafire.com/file/whhytzcqddj/backfire_10.03_nosercon.zip
Cool. thanks for link :)
ReplyDeletehey there, anyone know how to compile one program to that version of gargoyle? ( openwrt kamikaze 8.09.1)
ReplyDeletei have foenra 2100A and i need to install http://www.jbprojects.net/projects/wifi … ipsel.ipk, this is for white russian. it gave me this error when i tried to install it:
ReplyDeleteCollected errors:
* Packages were found, but none compatible with the architectures configured
i already had it installed with that version but now it doenst accept the package dont know why sad
i resolved to compile my package and it gaves me the same error :S
i have gargoyle firmware version installed on my Fonera ( 8.09.1 openwrt)
don't know what to do :S last month this worked perfectly :S
ciao Victor,
ReplyDeletesure I'm missing something, but if I connect my fonera to the DS2408, it won't boot.
If I connect that later it boots fine and everything works, but I caanot have that connected to have fonera booting.
I tried to see if I could get into redboot to see what was going on but it seems not even going into redboot.
any clue ?
Thanks very much
Luca
Not even RedBoot? That's strange..
ReplyDeleteDid you try connecting a PC to the serial port to see what's going on (if anything) during the boot process when the 2408 is connected?
You could also check if changing the Redboot serial console baud rate in fconfig to something else changes anything.
Hi Viktor,
ReplyDeleteFirst of all thanks for the answer.
I did an error. I supposed that the serial pins on the fonera were having the +5v power pin, while that is +3,3...... and I used that to power the 2480... removed that it works fine.
Thanks again for your time.
L