The mythical port settings in Windows

Questions are asked and claims are made about the serial port settings in Windows so often, that the topic deserves its own page.

Many folks have found the port settings for their serial device, either in Control Panel or in the Device Manager properties for the port. They see something roughly equivalent to this:

This dialog seems to imply that the baud rate (or speed in Bits per second) is a property of the port and that a user can adjust this up or down to make the transfer speed increase or decrease as necessary. Further, the Flow control setting invites further hope that enabling it will alleviate issues with data transfers. It is often suggested that if you're having trouble transferring data between a piece of software on your PC and an external serial device, that lowering the port speed in this dialog will lead to more reliable performance due to the slower rate of transfer. Of course, the same goes for enabling flow control, because after all, why not be extra careful of your flow by controlling it?

What do the settings do?

In reality, none of these settings have any effect (other than placebo) on modern software. For decades now, application software has told the operating system what port settings it needs in order to converse with its assigned device, and the operating system makes those changes at the time in which the port is opened. That means that if you set your port to a pokey 2400 baud, and enable flow control just to be extra careful, those settings are immediately overridden as soon as your application opens the serial port itself. It is important to note that almost all serial devices speak at only one baud rate (or at least, only the baud rate they're configured to use). If the setting in this dialog truly affected all communication over this port, then adjusting it away from anything other than the correct setting would immediately prevent the software from communicating with the device. The same goes for flow control: a device expecting one of the flow control methods will generally refuse to talk to a computer that doesn't honor the same. Enabling it on your computer when the device isn't expecting it would have the same effect of disrupting communications.

So, why are these settings here?

The above begs the question: If this control has no effect, why is it even available in Windows?

The answer lies in the unending desire of Microsoft (and to some degree, Intel) to provide total backwards compatibility with the original PC machines of yesteryear. Before we had real operating systems (DOS was not really an operating system by the modern definition, but did provide some of these services eventually), it was up to each piece of software to control every aspect of the serial port during communication. Thus, the operating system (DOS, and later Windows attempting to support old DOS programs) provided a way to set the baud rate that would be used if an application were to just start reading and writing to the serial port. At this time, there was little or no notion of "opening the port" in an exclusive manner, so there was less opportunity to configure the settings. Thus, the Windows serial port settings dialog really only affects legacy programs from the early 1980s that depended on external configuration of the serial port. I'd be highly skeptical of anyone claiming to still be using such a piece of software on a modern machine anymore (certainly nothing with a modern GUI interface), and thus these port settings are almost completely useless.

Well then, how do I slow down communication with my device to avoid issues?

You don't. 9600 baud (which is used for most PC->radio communication) is so incredibly slow by today's definition, that you really shouldn't have any problem keeping up with it, even with a heavily-loaded system. If your system is too slow, something is seriously wrong. Remember that an i386 16MHz machine could do 9600 baud all day long with no trouble. Most machines in use today are at least a hundred times faster by even the most naive of measurements.

Selection_014.png (6.1 kB) Dan Smith, 01/31/2013 02:49 pm