Date: Tue, 2 Jan 96 22:04 WET From: uhclem@nemesis.lonestar.org (Frank Durda IV) To: hackers@freebsd.org, current@freebsd.org Subject: Information on 16550As (9Kbytes) Message-ID: <m0tXKQn-000CEfC@nemesis.lonestar.org>
next in thread | raw e-mail | index | archive | help
[Sorry for the cross-post, but I am trying to respond to two different threads on this subject in two different groups, and the information is useful in both. Please edit any Reply/Cc lines accordingly.] --------------- There has been some discussion about problems with the sio drivers and their handling (or mishandling) of 16550 UARTS, or their inability to correctly probe for this hardware. A similar discussion was occurring in comp.dcom.modems, and although I had posted a subset of the information there, it seemed prudent to put it in the FreeBSD mailing list for people who don't read comp.dcom.modems. Hopefully this will clear up the common misconception that if you have a chip with "16650A" written on it, you are in business as far as functionality and compatibility is concerned. This is false. The problem is that there is the real NS16550A, then there are "similar" ??16550[A]s made by other companies. Only a few vendors bother to actually license the National megacell (the only way to assure 100% identical function), and since National has patents on the added FIFO anyway, other competing vendors must take certain liberties with the design so that they can avoid patent infringement AND still work under the Windows driver. These differences may show up when using other drivers, or when particular events occur that were not well tested or considered in the Windows driver. If you are using another OS (like FreeBSD or any other non-MS operating system), then you may be in trouble. In working with numerous modem vendors and 16550-clone makers, I found that the benchmark to success according to the chip makers was whether or not MSD said their part was a 16550, plus whether one or two Windows-based applications using the Microsoft drivers from 3.11 WFW would run correctly. That was the main criteria. Not very impressive or exhaustive testing. This means that the Microsoft COM driver in 3.11 is the primary measure of compatibility, and if that driver didn't use a given feature of the hardware or use it in a certain way, differences between the genuine NS16550A and some other brand may not be show up in Windows, but could foul up any other driver that did use that feature, or accessed the chip differently (different port access ordering, different speeds, etc). National has a program called COMTEST (you can find it on their BBS and supposedly it is on SIMTEL mirrors) that compares your 16550 against the National chip. Of course, the program is biased, as National wants to show as many differences (read: terrible incompatibilities) between their part and these "imposters". I used COMTEST on chips from the other vendors and they did howl when they found out. But it did prove a point that their chips were different since the software was able to detect functional differences. It was then up to the vendor to convince me that the differences were so minor that they would never cause any application to malfunction. I tested parts made by National, TI, StarTech, and CMD plus some 16550s in the form of megacells embedded in internal modems using COMTEST. Here are some of the results: (These tests were performed in 1994 and may not reflect the current product performance of that vendor) Part number Errors aka "differences" reported National (PC16550DV) 0 * National (NS16550AFN) 0 National (NS16C552V) 0 * TI (TL16550AFN) 3 CMD (16C550PE) 19 StarTech (ST16C550J) 23 Rockwell reference modem with internal 16650 or an emulation (RC144DPi/C3000-25) 117 (test modified so that it would not abort due to excessive errors) Sierra modem with internal designed-by-Sierra 16550 (SC11951/SC11351) 91 (test modified so that it would not abort due to excessive errors) Now you can't learn a lot from the raw error count. For example, about half of the errors in the modems with internal UARTs was caused by the clone UARTs not supporting 5 and 6 bit characters modes. The real 16550/16450/8250 support these modes and COMTEST checks for this, but who uses 5 or 6 bit characters in a modern modem? So for a modem you can discount those errors (over 50), bringing the difference counts down a bit lower. Some of the remaining problems were still disturbing, like being able to read 16 bytes from the FIFO and the status still said the FIFO was not empty, interrupt priorities not identical, that sort of stuff. On the other hand, TI had the fewest differences, but the differences they had sounded critical to reliable operation: Error (3)...Tx FIFO reset : LS = 0 Error (7)...BI/FE/EIF test: IIR = c1 LSR = 60 Error (7)...IIR/LSR not cleared: IIR = x1 LSR = 60 (You will have to look at the COMTEST code to see exactly what test is being performed which causes these errors.) So far, I have not found any non-National parts that report zero errors in this program. Note also that even National has had five versions of the 16550 over the years and the newest ones behave a bit differently than the classic NS16550AFN that people worship. But COMTEST turns a blind eye to the differences within the National product line and reports no errors on the National parts (except for the original 16550_) even when I have erattas in my hand describing pretty annoying bugs in the A, B and C rev chips, so just be aware of the bias in COMTEST. Note that many of the errors COMTEST reports have to do with timing. In many of the knock-offs, when you read from one port, the status bits in some other port may not update in the same amount of time (some faster, some slower) as a *real* NS16550AFN and COMTEST looks for these differences. COMTEST could be useful because it could identify places in our sio drivers where we are looking for things in a certain amount of time that was OK on a National part (or whatever brand of 16550 the author of the sio driver happened to be using), and NOT OK on some of the other brands of 16550. Hopefully this would also explain some of the probes that fail to detect internal modems, where the status ports are usually not real latches but are instead an emulation done by the modem microprocessor, and so they will not have the same timing characteristics of state-machine hardware like a real 16550. All this probably means we just need to be a lot more forgiving and allow for the variances in timing. We are only talking about serial ports, so we can afford to waste a few cycles waiting for status bits to update/stabilize if it will make things work on more hardware combinations, as most people will be unable or unwilling to go out and buy genuine National parts to replace whatever happened to come with their serial ports. * FYI, National reorganized their part numbering system a few years ago, and the NS16650AFN no longer exists. (Look at the date code, that 9xxx number on the part. First two digits are the year, last two digits are the week in that year when the part was packaged. If you have a NS16550AFN, it is probably a few years old.) The new numbers are like PC16550DV, with minor differences in the suffix letters depending on package material and shape. (A description can be found below.) In some stores, you will pay $15 for a NS16550AFN made in 1990 and in the next bin are the new PC16550DN parts with minor fixes National has made since the AFN part, and they cost half as much. I know the newer LPCC parts were being bought in volume for $5 in 1993. Expect the price on the dwindling supply of "real" NS16550AFNs to keep going up until people figure out that the new part number is really the same function as the old part number. Here is the information on the National Semiconductor part number syntax: NSnnnnnrqp part numbers are now of the format PCnnnnnr[g]p The "r" is the revision field. The current revision of the 16550 from National Semiconductor is rev "D". The "p" is the package-type field. They are: "F" QFP (quad flat pack) L lead type "N" DIP (dual inline package) through hole straight lead type "V" LPCC (lead plastic chip carrier) J lead type If a "I" preceeds the package, it indicates an "industrial" grade part, which higher specs than a standard part but not as high as MilSpec. This is an optional field. So what we used to call a NS16550AFN (DIP Package) is now called a PC16550DN or PC16550DIN. I have no idea why National made this numbering change, nor do I know why they changed their old perfectly readable logo into the unreadable one they have now. Oh, if you run COMTEST on a 16550 that is in a modem or a modem is attached, you need to first issue a ATE0&W command to the modem so that it will not echo any of the test characters. If you forget to do this, you will get at least one error: Error (6)...Timeout interrupt failed: IIR = c1 LSR = 61 For the record, I made National parts the sole-source when external 16550s were specified on projects I was associated with since the other vendors either didn't bother to try to explain the differences or could not explain the differencesm, other than to insist that I should not worry about them because "Windows works great!". Frank Durda IV <uhclem@nemesis.lonestar.org>|(C) 1995 Frank Durda IV, All or uhclem%nemesis@rwsystr.nkn.net |Rights Reserved. Compuserve and ...letni!rwsys!nemesis!uhclem |MSN must obtain a license for |storage or carriage of this text. Please report violations. [Yeah, I know this needs to be added to the FAQ. I need to make a depersonalized version of it.]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0tXKQn-000CEfC>