Tobias:
I'm not familiar with the v2 board - are there any other crystals on it? I took a look at http://www.linksysinfo.org/modules.php? … =6#wrt54g2 but the pictures there are not detailed enough for me to get a good "feel" for the board. Can you take high resolution pictures?
Can you follow the tracks from the 48MHz crystal to find out where it goes? If the 48MHz is used elsewhere on the board, you really only want to change the frequency going to the UART; the circuit board layout will decide if this is easy. Can you find the UART on the board and figure out where its clock signal comes from?
If the 48MHz goes everywhere - don't forget that any multiple of 7.3728MHz will do nicely for the UART. To take an example, 4*7372800 is 29491200; if you got a 29.5MHz crystal, that would give you a baud_base of 1843750bps, and you could divide that by 4 to get 460937, which is a deviation of less than 0.03% from the baud rate you want (given 8N1 asynchronous communication, baud rates of sender and receiver can differ by several % without any problem). Compared to 48MHz, other components would run about 85% slower on 7.3728MHz - less than one sixth of original speed - or about 40% slower on 29.5MHz - a little over half the original speed.
Have you much experience of kernel hacking? I've tried reading 8250.c to figure out whether it autodetects the UART baud_base in some way, or just uses a value it gets some other way, perhaps some default compiled in. If you can figure that out for me I'd be very grateful - I'm still trying to figure out why pages like http://wiki.openwrt.org/OpenWrtDocs/Cus … 5717c211f5 recommend a strange frequency of 12.75MHz giving an even stranger baud_base of almost (but not quite) 7*115200; UART datasheets almost invariably recommend frequencies that are a power of two times 16*115200.
Edit:
I note from http://www.linksysinfo.org/modules.php? … id=6#table that the v1 and v2 boards have a different MCU (v1: BCM4072KPB; v2: BCM4712KPB); I can't see a separate UART on the v2 board, so it may be integrated into the BCM4712. I can't find a proper datasheet online for the 4712, but it probably uses that 48MHz to run lots of other integrated peripherals - including things like generating radio or ethernet data rates - so changing the crystal will probably break everything.
So... where to go from here? Here are the options that I can see, listed in order of increasing pain/messiness:
1. If the device you're connecting to is running its serial port well within spec or a bit slow, talking to it at 428571bps /may/ work (divisor set to 7). This is about 7% slow, but the total budget for speed difference on 8N1 asynchronous links is close to 10%. If the other device comes anywhere close to saturating the 460800bps link, even briefly, you're likely to see lots of framing errors; if you can configure it to send an extra stop bit, that should fix that.
2. If the device you're connecting to runs its serial port a bit fast, you could try talking to it at 500000bps (divisor set to 6); this is about 8.5% fast. Set your stop bits to 2. Some (maybe all?) 16550 clones will only require 1 receive stop bit even when sending 2, which will help a lot.
3. Change the crystal to 29.5 or 44.2 and hope this doesn't break everything else on board.
4. Get a v1.0 board, and fit a UART and a 7.3728MHz crystal (or a multiple). This will give you exactly the right baud rate, and full hardware handshaking too if you want it. The easiest way to get TTL serial connections is probably by soldering straight onto the PLCC44.
5. Put a PIC or similar in between the two devices to interface between two baud rates, as you suggested earlier. I wouldn't fancy this, though, given the lack of hardware handshaking on the v2 serial port - what happens if the PIC gets an overrun? It will need to signal this somehow; or your protocol on the WRT54G will need to be very resilient to characters that go missing without generating an error condition.
Boone:
No worries, for a moment you had me hoping there were WRT54G's out there with the UART fed by a programmable frequency generator :)
Christian
(Last edited by minus1 on 27 Apr 2006, 08:35)