home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / internet / mswincom.zip / MSWINCOM.TXT
Text File  |  1993-07-31  |  19KB  |  398 lines

  1. Path: nlbbs!pagesat!decwrl!elroy.jpl.nasa.gov!swrinde!cs.utexas.ed
  2. !math.ohio-state.edu!sol.ctr.columbia.edu!news.kei.com!ub!csn!teal.csn.org!rjn
  3. From: rjn@teal.csn.org (Robert J. Niland)
  4. Newsgroups: comp.dcom.modems,comp.answers,news.answers
  5. Subject: MS-Windows COM and Ns16550A UART FAQ
  6. Summary: Improving Windows 3.x COM performance and reliability.
  7. Keywords: uart 16550 16450 8250 datacomm windows serial modem turbocom
  8. Message-ID: <CAy4Bq.GH9@csn.org>
  9. Date: Thu, 29 Jul 1993 21:43:00 GMT
  10. Expires: Mon, 16 Aug 1993 00:00:00 GMT
  11. Sender: news@csn.org (news)
  12. Reply-To: rjn@csn.org (Robert J. Niland)
  13. Followup-To: comp.dcom.modems
  14. Organization: Colorado SuperNet, Inc.
  15. Lines: 377
  16. Approved: news-answers-request@mit.edu
  17. Supersedes: <none>
  18. Nntp-Posting-Host: teal.csn.org
  19. X-Newsreader: TIN [version 1.2 PL1]
  20.  
  21. Archive-name: windows-com-faq
  22. Last-Modified: Mon Jul 27 15:49:50 MDT 1993
  23.  
  24.  
  25. FAQ: The 16550A UART & TurboCom drivers                 Edition: 27 Jul 93
  26.                                                         Expires: 27 Sep 93
  27. This article applies to:
  28.   Intel-based systems running
  29.   Windows 3.0 and 3.1,
  30.  
  31. to a lesser extent:
  32.   DOS applications not running under Windows,
  33.  
  34. but NOT to:
  35.   Windows 2.0 or prior,
  36.   Windows/NT,
  37.   OS/2 or
  38.   PC Unix.
  39.  
  40. One of the unadvertised limitations of most current Windows PCs is that
  41. their RS-232C (serial, COM) performance is seriously deficient.  Almost
  42. everyone who purchases a high-speed modem (V.32bis, V.32, PEP or HST)
  43. discovers the problem the first time they try to download a file or accept
  44. an incoming FAX (at 9600+) after upgrading the modem.  Overrun, "CRC" and
  45. retry errors abound, even when the only active application is the datacomm
  46. or FAX program.  If the transfer completes at all, it may take even longer
  47. than with the old 2400bps modem.
  48.  
  49.  
  50. There are three reasons for the problem:
  51.  
  52. 1. The Universal Asynchronous Receiver/Transmitters (UARTs) used in
  53.    most PCs are primitive Ns8250 or 16450 devices with single-byte FIFO
  54.    (First-In, First-Out) buffers.  If the operating system/driver cannot
  55.    read and flush each character at high interrupt rates, the next
  56.    incoming character overwrites the FIFO and the previous one is lost.
  57.    Plain DOS, being a fairly single-minded environment during datacomm,
  58.    can usually keep up; Windows can't.
  59.  
  60. 2. Windows has more operating system overhead than plain DOS, and
  61.    interrupts often take longer to service.  Overruns are much more likely
  62.    than under DOS.  As soon as you report to your PC/modem vendor that you
  63.    are losing data, you may be advised that "you need to upgrade to a
  64.    16550".  However, since there seems to be a conspiracy of ignorance
  65.    about this issue,  you'll often get no useful advice at all.  Most of
  66.    the store-front and mail-order sources I spoke with in attempting to
  67.    solve my own problem had never heard the term "16550" and many didn't
  68.    even know what a UART was.
  69.  
  70. 3. Even if your PC has 16550A UARTs (and PS/2's do), or if you can
  71.    upgrade your mother/COM board or add a new COM board, you may STILL
  72.    experience errors and overruns because the standard MicroSoft Windows
  73.    COM drivers don't take full advantage of the 16550A.  Windows 3.1 is
  74.    improved in this regard over 3.0, but I still recommend a driver
  75.    upgrade.  Applications like ProComm+/Win (which is what I use) cannot
  76.    get around this problem by themselves.
  77.  
  78. If you have a modem CARD (i.e. an "internal" modem), you may or may not
  79. have a problem, as the modem part of the card can be designed to be aware
  80. of the state of the UART, and avoid overrunning it; however, I wouldn't
  81. want to bet that the card designers were that clever, and would generally
  82. insist on a 16550A UART when buying modem card.  Some modem cards don't
  83. even have conventional UARTs, but if they are to work with standard
  84. Windows drivers, they need to simulate one.  Use MSD.EXE (below) to see
  85. what the modem card is, or is pretending to be.  In any case, if it is
  86. pretending to be an 8250 or 16450, even though it may be immune from data
  87. loss, system overhead will be higher during I/O.
  88.  
  89.  
  90. The Hardware Situation.
  91.  
  92. This applies to:
  93.   Serial/COM ports/cards
  94.   Internal modems/cards
  95.  
  96. ..but NOT..
  97.   External modems (What matters is the UART seen at the PC backplane.
  98.                    What's in the modem is generally irrelevant.)
  99.  
  100. A UART is present anywhere that a serial bit stream needs to be converted
  101. to a parallel byte stream, and vice versa.  An external modem may well
  102. have two; one to convert the mark/space stream to bytes (for internal
  103. error control, compression, flow control and protocol processing), and
  104. another to convert the user-ready bytes to an RS-232C one/zero stream.
  105.  
  106. The computer's COM port will have yet another UART, and this is the most
  107. important one.
  108.  
  109. The UARTs on most PC COM ports are based on National Semiconductor Ns8250
  110. or Ns16450 chips (or silicon megacells inside VLSI chips where you can't
  111. replace them).  You can identify the ostensible UART type on your system
  112. by running the MicroSoft diagnostic program:
  113.  \DOS\MSD.EXE      {for DOS 6.0, with or without Windows}
  114.  \WINDOWS\MSD.EXE  {for WIN 3.1 on DOS 5.0}
  115. Be sure to run MSD in DOS *before* bringing up Windows.   The Windows
  116. serial API may prevent MSD from accurately identifying a 16550 if you run
  117. it from a Windows DOS prompt.
  118.  
  119. The Ns16550 UART has separate 16-byte transmit and receive FIFOs with
  120. configurable trigger levels, and can run reliably at clock rates up to
  121. 460,800 bps, although with current modem technology, there's no point in
  122. pushing your luck by going over 115,200 bps, and many modems have a max
  123. DCE-DTE (modem-computer) rate of 57,600. The 16550 has shorter access
  124. cycle times than the 16450 or 8250.  The 16550 also has DMA capability,
  125. but it is not clear that any PC drivers ever use this.  For more technical
  126. info, see National Semiconductor Application Note AN-491.
  127.  
  128. So, what UART component hardware do you have?
  129.  
  130. Try to locate the UART on your mother board, multi-function I/O card, COM
  131. board or ISA/MCA modem card.  If you can't find a socketed component with
  132. the numbers "8250" or "16450", your COM ports are probably buried in VLSI,
  133. and you won't be able to perform a chip replacement. If you have an actual
  134. 8250 or 16450 chip, but it is soldered in, I don't recommend replacing it
  135. unless you are an experienced solder-sucker operator.  If you can DISABLE
  136. your VLSI or soldered-in COM ports (as I chose to do), you can at least
  137. add an aftermarket COM board.  Disabling the UART may require throwing
  138. switches or configuring non-volatile BIOS registers.
  139.  
  140. If you have one or more socketed 8250 or 16450 chips, you can buy plug-in
  141. Ns16550AFN (40-pin), Ns16550AFV (chip carrier) or PC16C550CN (low power
  142. CMOS version) ICs from several suppliers typically for $9 to $15 each.
  143. The "N" chip is the normal 40-pin dual-in-line package.  Other styles are
  144. available, but avoid any Ns16550 chips without a letter suffix (the
  145. 16C550C are presumably all OK).  The 16550A is compatible with the
  146. line-driver support chips used by your 8250 or 16450.
  147.  
  148. Early non-"A" Ns16650 chips have bugs, although National will reportedly
  149. exchange those of their own manufacture for free.  Clone chips are
  150. available from various IC makers other than National.  The manual for the
  151. TurboCom driver states support for the following (apparently equivalent)
  152. chips:
  153.  
  154. National Semiconductor: 16550A, 16551,
  155.                         16552 (two 16550s in one chip)
  156.                         (PC87312 SuperIO chip has two 16550's inside)
  157. Chips&Technology:       82C607
  158. Texas Instruments:      t16c550a
  159. Silicon Systems:        73M550
  160. VLSI                    16C550
  161.  
  162. TurboCom warns about the pre-"A" Ns16550 and Western Digital 16C550, and
  163. says that problems have been reported with early IBM PS/2 55SX and 70
  164. systems (IBM reportedly will upgrade them).
  165.  
  166. If you DON'T have socketed 8250/16450 chips, you'll need to buy an after-
  167. market COM or multi-function board.  If you have a modem card ("internal
  168. modem"), you may not be able to upgrade without replacing the card
  169. altogether. In any case, to add a new COM or multi-function card, you'll
  170. need to either disable the COM1/2 port(s) you are replacing, or re-assign
  171. them to COM3/4 (although watch out for IRQ conflicts without TurboCom).
  172.  
  173. Although cheaper cards are available, in the interest of getting my
  174. problem solved quickly I elected buy a Modular Circuit Technology MCT-AIO+
  175. card from:
  176.  
  177. JDR Microdevices
  178. 2233 Samaritan Drive
  179. San Jose  CA  95124
  180. (800) 538-5000 voice US
  181. (408) 559-1200 voice other
  182. (800) 538-5005 FAX US
  183.  
  184. The MCT-AIO+ (and the "+" is important) sells for $89.95.  It is an 8-bit
  185. ISA card providing:
  186.  
  187. Port Type  Connector  Address and IRQ        Comments
  188. COM        DB9M       COM 1,2,3 IRQ 2,3,4,5  Ns16550AFN in socket
  189. COM        ribbon     COM 2,3,4 IRQ 2,3,4,5  Ns16550AFN in socket
  190. Parallel   DB25F      LPT1,2,3  IRQ 5,7
  191. Game       ribbon
  192.  
  193. The kit includes a ribbon cable and DB25F connector for the secondary COM
  194. port, a ribbon cable/connector for the game port, two bulkhead plates for
  195. the ribbon-based connectors and a 9F-to-25F adaptor cable.  Each port can
  196. be individually disabled, and the COM ports have TX, RX, RTS, CTS, DTR,
  197. DCD, and DSR jumpers.
  198.  
  199. JDR also sells a Super-I/O multi-function card that adds IDE.
  200.  
  201. I have heard from several people about less expensive m-f I/O cards
  202. with 16550As:
  203.  
  204. TSD Systems
  205. (407) 331-9130
  206. $19.95 for the card, plus $9.95 per 16550.
  207.  
  208. Greenfield Trading and Distributors
  209. (518) 271-2473 (voice), (518) 271-7811(FAX).
  210. Their card is $33 w/one 16550, $45 w/2, and they sell 16550AFNs for $13.
  211.  
  212. R&S DATA SYSTEMS, INC.
  213. 820 East Highway 434
  214. Longwood, FL  32750
  215. PHONE: (407) 331-1424
  216. FAX: (407) 331-8606
  217. 2COM/LPT/Game card w/2 16550s for $39
  218.  
  219. I have no personal experience with any of the firms except JDR.
  220.  
  221. Meanwhile, back at the MCT card from JDR... I only needed two serial
  222. ports, and am running out of IRQs on my PC, so I disabled my built-in
  223. VLSI-based 8250 ports. However, with the TurboCom driver (below), I could
  224. have set the internals as COM3 and 4, using IRQ sharing.
  225.  
  226.  
  227. The Software Situation
  228.  
  229. Simply upgrading to 16550A UARTs will not completely solve all overrun
  230. problems.  The standard MS serial drivers don't take full advantage of the
  231. 16550A. The Windows 3.0 drivers are even less capable, and the Windows 3.1
  232. drivers have the following limitations:
  233.  - They enable only the receive FIFO, and only at rates above 2400 bps.
  234.  - They never enable the transmit FIFO, which  results in an interrupt
  235.    rate of 10x during uploads.
  236.  - They set the trigger level at 14 bytes (too high - it's easy for 2
  237.    more bytes to arrive before the driver can read the FIFO).
  238.  - The Ports menu of the Control Panel only allows speeds up to 19200.
  239.    With a V.32bis modem,  sparse data and text can easily compress 3:1
  240.    or more, suggesting that a host DTE connect rate of 57,600 bps would
  241.    be effective.
  242.  - Windows provides no workaround for apps that don't provide port
  243.    speed options above 19200 bps.
  244.  - The API won't accept rates above "CBR_128000".
  245.  - The API won't let DOS programs know there is a 16550 there, and even
  246.    if it did, DOS programs that aren't 16550-aware get little benefit
  247.    from a 16550 port with the standard drivers.
  248.  - They don't allow IRQ sharing for COM3,4.
  249.  - The BIOS doesn't initialize COM3,4 properly in many systems, and Windows
  250.    doesn't necessarily clean this up properly when booted..
  251.  
  252. These problems are reportedly NOT solved in Windows NT (alpha, beta or
  253. initial release) nor in DOS 6.0, and may or may not be addressed in any
  254. Windows releases after 3.1 (but before 4.0). Rumors suggest they "may" be
  255. solved in Windows "4.0".
  256.  
  257. A few applications provide their own drivers.  For example, "WFXCOMM.DRV"
  258. is now available for Delrina's WinFAX Pro (although I have no data on how
  259. to obtain it, or whether or not it is a full-featured generic COM driver,
  260. nor how it compares to TurboCom).
  261.  
  262. If you are running "FOSSIL" drivers, such as in a "Waffle" BBS, the "BNU"
  263. driver reportedly has reasonable 16550A support. Since I am about to
  264. install the UUCP parts of Waffle on my system, I expect to have more
  265. information shortly.
  266.  
  267. I would also be interested in gathering data on the state of 16550A driver
  268. support in OS/2 and the various PC Unix systems.
  269.  
  270.  
  271. The TurboCom Drivers
  272.  
  273. You can get replacement drivers that solve all of the above problems, for
  274. all ordinary Windows COM apps, by buying a copy of "TurboCom", current
  275. version 1.2, from:
  276.  
  277. Bio-Engineering Research
  278. Pacific CommWare Division
  279. 180 Beacon Hill Lane
  280. Ashland  OR   97520-9701
  281. (503) 482-2744 voice
  282. (503) 482-2627 FAX
  283. (503) 482-2633 BBS
  284. MCImail:    344-5374
  285. CompuServe: 71521,760
  286.  
  287. Price was around $50 as I recall.  Bio-Eng is not set up to accept credit
  288. cards, so I had to send a check.  Egghead and 1-800-Software list TurboCom
  289. but as far as I know, they don't stock it.  Bio is not a software company
  290. per se.  They apparently needed reliable hi-speed serial connections for
  291. an in-house instrument application, wrote their own driver, discovered a
  292. market for it, and revised it to be a general purpose COM driver suite.
  293. They recently upgraded it for Windows 3.1.  It is run-time licensed.
  294.  
  295. I now have my host (DTE) connect rate set to 57,600 bps for most of my
  296. datacomm apps, and I am having ZERO problems with downloads. I routinely
  297. see transfer rates that exceed 2,000 bps. I am also using 115,200 bps when
  298. linking an HP95LX to my PC, with lossless bi-directional I/O. Uploads to
  299. various remote systems are another matter, because many hosts are still
  300. using antique UARTs and drivers.
  301.  
  302. Note that 19200 is still the highest rate that the Windows 3.1 Port menu
  303. in Control Panel will allow in configuring a COM port's defaults. Many
  304. apps also limit your options to 19.2K max.  TurboCom gets around this by
  305. allowing you to specify, on each port, a factor that will set the real
  306. UART rate to a multiple of the rate passed through the Windows APIs and
  307. dialog boxes.
  308.  
  309. I also have CTS/RTS hardware flow control enabled, and I suggest that you
  310. do the same.  You need to enable it separately for:
  311.  - Windows (Ports dialog in Control Panel),
  312.  - in the modem (usually via a modem-specific "AT" command), and
  313.  - in the comm application (if control provided)
  314. Also make sure your cable has wires for pins 4 (RTS) and 5 (CTS) on the
  315. 25-pin side.  Cheapo 3-wire (TXD, RXD, GND) cables won't work.
  316.  
  317. In RTS/CTS hardware flow control, the modem asserts/drops CTS (Clear To
  318. Send) when it is ready/not-ready and the computer similarly wiggles RTS
  319. (Request To Send).  This avoids having to insert reserved flow control
  320. characters in the data stream (which you cannot do if the data is
  321. non-encoded binary).
  322.  
  323. Even if you only ever transfer 7-bit ASCII data, Xon/Xoff (ASCII DC1/DC3
  324. or hex 0x11/0x13) is not a sufficiently reliable method of flow control.
  325. The informal convention (established by DEC) for Xon/Xoff hysteresis is
  326. that the sender may transmit another 16 (yes, sixteen) bytes after receipt
  327. of the Xoff character from the receiving system or device.
  328.  
  329. The 16 byte FIFO in the 16550 is clearly not big enough to let us rely
  330. exclusively on Xon/Xoff.  The 16550A doesn't do CTS/RTS all by itself.
  331. It provides alerts and status signals to the driver.  The 16-byte FIFO,
  332. however, provides a margin to prevent the FIFO from overrun while the
  333. driver responds and asserts RTS.
  334.  
  335. Even with hardware flow control, a 16550A with TurboCom can still
  336. experience overruns in very busy systems, with lots of apps running and
  337. serious swapping in progress. If this is your situation, you may need to
  338. buy a co-processed COM board, but this will cost you more than a
  339. 16550A/TurboCom upgrade.  A review of two such boards, and a review of
  340. TurboCom, can be found in the February 1993 issue of "Windows Sources"
  341. magazine. I suggest trying a 16550A/TurboCom upgrade first, and experiment
  342. with process priorities and time slices if you are a "power user" whose
  343. thrashing system still runs into comm problems.
  344.  
  345. Several people have asked:
  346.     "If I can't afford both a UART and driver upgrade,
  347.      which individually produces the most benefits?"
  348.  
  349. If you have Windows 3.1, upgrading just the UARTs will solve most of
  350. your problems.
  351.  
  352. If you have Windows 3.0, upgrading just the UARTs will generate a much
  353. smaller benefit.  I would suggest starting with the UARTs, then upgrade
  354. to 3.1, then add TurboCom if needed.
  355.  
  356.  
  357. Closing Soapbox Comments
  358.  
  359. The state of RS-232C serial datacomm support is an embarrassment across
  360. the computer industry.  Because it is the oldest standard I/O interface,
  361. the job of designing hardware and writing software often seems to be
  362. assigned to the least senior or lowest ranked engineers at computer
  363. hardware and software companies.  The design of the average serial port is
  364. at least ten years behind the state of the art. In my last job, with a
  365. major workstation vendor, I lobbied for improved serial ports when they
  366. were doing the initial designs of a new system.  That family of machines
  367. was subsequently introduced with 16550 ports.  However, this is the
  368. exception.  Few computer companies seem to have any champions for decent
  369. I/O (The second oldest port - Centronics parallel - only recently became a
  370. formal standard and obtained rudimentary bidirectional capabilities).
  371.  
  372. You may as well learn what you can about serial I/O, because this
  373. situation shows no sign of improving soon, even though proposed V.FAST
  374. modems are just a year away.  When V.FAST arrives, I expect cries of
  375. outrage from Windows users world-wide whose 8250- and 16450-based PCs
  376. "sort of" work today with V.32bis, but will fail miserably at V.FAST's
  377. 28Kbps link rates and well-over-56Kbps compressed DCE-DTE rates.  Without
  378. a hardware-buffered UART (like the 16550) and without software drivers
  379. that use that UART to best advantage, a V.FAST modem will be a waste of
  380. money.
  381.  
  382. Regards,                                          1001-A East Harmony Road
  383. Bob Niland                                        Suite 503
  384. Internet:  rjn@csn.org                            Fort Collins CO 80525
  385. CompuServe: 71044,2124                            (303) 223-5209
  386.  
  387.                      Copyright 1993 Robert J. Niland
  388.                            All Rights Reserved
  389.  
  390.   Permission is granted to make electronic and hardcopy reproductions of
  391.   this edition of this article for personal non-commercial use, provided
  392.   that no material changes are made to the article or this copyright
  393.   statement.  All other copying, storage, reproduction or redistribution
  394.   of this article, in any form, is prohibited without the express written
  395.   consent of the author,  Robert J. Niland.
  396.  
  397. EOF
  398.