View Single Post
 
Old 07-17-2005, 01:08 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Update to Direct Baud Rate Setting

I got a message from mkaras that pointed out some errors in my above post about setting the baud rate directly. Rather than rewrite it, I've decided to copy his message here:

Quote:
BillSoo:

In your string of postings in the CommTutorials section you had a piece on the setting of the baud rate for the COMM port by direct means using the INPOUT32 dll.

In this article you stated that the UART baud rate crystal was 115200 Hz and thus the fastest baud rate was thus 115200 bps (bits per second).

This is not actually true. From early PC days legacy COMM ports have used a crystal or oscillator frequency of 1.8432 MHz. A typical UART, including the PC UART, uses a clock rate that is 16 times faster than the actual baud rate. The divisor register in the PC UART actually holds a count that is used to divide the 1.8432 MHz master input clock down to the 16x rate used internal to the UART. The 16x rate is particularly important for the receiver section of a UART so that it can oversample the incoming serial data stream and find start bits, estimate the data bits center position and setup the optimum time to clock in the actual serial data stream.

You are correct that the legacy UART configuration in a PC has a top end baud rate of 115200 bps. There are however many newer hardware sets that support higher baud rates including 230400 bps, 460800 bps and others. The most common place to find this capability today is in some motherboard computer chipsets and in todays very common USB to RS232 adapter cables. I have some cables with drivers that support baud rates above 1000000 bps! Most times the higher baud rate capabilites come into play when the actual UART hardware is "hidden" from programmers that typically work with the likes of VB6 under Windows. The details of the non-legacy behavior of the UART are buried inside the Windows device drivers and so there is no need to be aware of how the 16x clocking is derived.

Good Luck
Michael Karas
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

Last edited by BillSoo; 07-20-2005 at 04:51 AM.