home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / answers / windows-com-faq < prev    next >
Text File  |  1993-12-16  |  21KB  |  453 lines

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