热度 19
2014-11-12 16:55
2087 次阅读|
0 个评论
In the past, PCB layout designers worked from schematics that were usually drawn in a meaningful way so as to show circuit functionality and to be readable. For example, cross-page connects indicated by angled wires pointing to each other. (See My own approach to PCB symbols .) The PCB designers made the physical parts placement follow the schematics in a logical way; components that formed functional groupings tended to remain co-located and the schematics could usually be read and understood by others -- including those who later had to use those schematics to deduce circuit operation and perform troubleshooting and repair. Re-creating a schematic from such a PCB was fairly easy. Then along came CAD/CAE. The art of schematic drawing became debased into an electronic Etch A Sketch capture tool, whose main purpose was to create a netlist so the PCB designer could use a "rat's nest" on-screen display to complete the planting of the copper traces. Any semblance of analog rules and communication between the design engineer and the PCB layout designer was lost in the digitized dumbing-down. All too often, the components were simply thrown at the virtual board and a multi-layer autorouter did the work. The PCB designer never even looked at the schematics and -- in many cases -- could not have understood them anyway. The resulting PCBs no longer consisted of nicely grouped functional blocks of circuitry; components ended up helter-skelter wherever they were originally (and randomly) placed. So there really was no longer any incentive -- or time in the development schedule -- for the design engineer to make the additional effort to draw readable and meaningful schematics; nobody read them anyway. I must admit that the first time I used CAD, I was rushed ("the schedule says this has gotta be done by next week!") and my schematic was atrocious. The CAD software was not user-friendly when it came to adding additional pages once a schematic had been started. Adding more and more functions as the design progressed, I had to snake wires around the periphery of the over-crowded drawings in a way that was totally incomprehensible to anyone reading the schematic. This didn't bother me too much at first -- I knew how the thing was supposed to work and the schematic did create the netlist, which was all the PCB layout designer required. Even then, the layout designer did not place my components where I told him to, causing the "privy too close to the well" problem discussed here on EE Times recently. But six months later, while trying to decipher a signal path from that unholy schematic, I swore that I would never draw such a useless piece of garbage ever again. Fast forward 30 years. Much of my effort is now spent studying and analyzing PCBs from defunct OEMs for which our sales people promise our customers "We can fix anything!" Never mind that we have never seen it before, have no clue what it is supposed to do, have no backplane to slide it into, have no user manuals, have no schematics, but -- absolutely yes -- we can repair it! (Also, pigs can fly; I saw it on a TV commercial for car insurance.) So, I have to turn these PCBs back into schematics, and then make those schematics readable so as to build test fixtures, write circuit descriptions, and clearly indicate the circuit functions for our troubleshooting technicians. And yes, I have seen many a PCB that was very obviously created by "splashing components" onto the "canvas" (much as is done by some modern art painters in a questionable state of sobriety) and clicking the auto-route button. How can this task be accomplished effectively? Two tools I have found to be indispensible are a decent low-delta-R-indication continuity tester for unambiguously sniffing out very low-resistance PCB nets and a schematic capture package with drawing features that go far above and beyond the ability to simply create a netlist. The schematic tool I use is freeware called TinyCAD (you can download it from SourceForge.net). While it is not perfect, it does have some very nice features that lend themselves to circuit analysis, along with basic schematic and mechanical drawing. Other drawing tools may be just as usable, but I have not studied them. The purpose of this column is to highlight the useful features of drawing software as applicable to reverse engineering. If you are aware of similar features in your own favorite drawing software, by all means comment on them below. The first thing to realize is that a reverse engineering schematic is not intended to ever produce a netlist, so you can get away with all sorts of misdemeanors that make your drawings visually more appealing. While TinyCAD sports an extensive library of component symbols that have a very limited re-sizing option, depending on the PCB size you may prefer to construct your components as graphic objects instead of electronic components. The advantages of doing this are that the graphic objects can then be colored to represent top-side or bottom-side surface mount locations on the same drawing; also, they can be made extremely small so that the entire PCB can fit on a single drawing page. Why a single page? Herein lies a TinyCAD weakness -- highlighting a net (more on this later) will crossover between sheets when all of the sheets are in the same drawing set, but only one sheet of this set can be made visible at any particular time. Bummer. This makes it hard to see all nodes of a net on-screen at a glance. To view more than one sheet at a time, one can open a second iteration of TinyCAD to show another sheet, but -- in this case -- highlighting a net will not crossover between sheets. Making component graphics small enough to get the whole PCB on a single sheet makes net highlighting visible across the whole page. The result is a horrendously complex and un-readable schematic when printed onto paper. But this is NOT the schematic that will be viewed by anyone other than the reverse engineer. Its only purpose is to transform a physical PCB layout into an on-screen drawing that captures the physical layout. The functionality schematics come later after the physical schematic nets have been deciphered and re-drawn to show meaningful functionally. The grid can be set to whatever size the user wants, but I have found that too small a grid can cause problems with block copies and moves. Best leave the grid size at "fine," and instead increase your drawing area by enlarging the page size as needed. For example, selecting a European page size A2 with font size 6 and printing at 64% scale on 11" x 17" paper gives you a single page drawing that is still readable, if you are getting on in years, a magnifying head visor helps. Printing the same at 129% gives you four 11" x 17" pages that can be taped together to give you a readable print copy. But most reading will be done on-screen, and the zoom and pan functions are very easy using the mouse scroll wheel and right-click-drag, respectively. Another tip to work around a TinyCAD weakness is to keep "Junction Dot Placement" set to automatic. While an option for manual placement can be used, block moves afterwards cause wires to "bend" and you will have to go in and straighten them all out again. Reverse analysis is a two-pass effort requiring an initial physical schematic based on actual PCB placement and package pinouts. This is followed by a series of functional schematics that re-draw the captured circuits in a logical and comprehensible fashion (and also catch errors when the functions appear to make no electrical sense). The physical schematic is a representation of the PCB as viewed from above. Components are drawn in the same orientation as on the PCB; transistors are shown in their representative packages with GDS or EBC physical pins; relay switches are sown with their terminals arranged in the same way as they appear from the top; ICs are drawn in their packages with their internal logic elements or functional names shown. Many times, a PCB does not have reference designators in the silkscreen, so relating a component location to a later functional schematic depends very strongly on the physical schematic. A physical representation can look like the image shown below. Orange is topside, green is bottomside surface mount components. Some capacitor graphics look shorted because a TinyCAD bug does not always transfer the invisible masking square when copying and pasting a selected block portion to MS Word. It would be nice if TinyCAD had a "group" function to tie graphic elements together, but one must resort to drawing a box around the graphics each time they need to be moved or copied. Confusing, yes? It's impossible to figure out what is going on electrically from the above image. However, once this has been re-drawn into a meaningful functional schematic, the result is a very readable and understandable depiction as illustrated below: This image is under construction. Temporarily color-coding the nets on the physical drawing make transfer to the functional drawing less prone to error. Elastic wires follow components when dragged around for readability. Unfortunately, TinyCAD does not keep wires connected when a component is rotated or flipped (mirror imaged). When drawing the bottom-side physical component locations, it can help to first draw the area partially to scale as seen from the bottom-side, then draw a block around the circuit and flip horizontally (mirror image) to make it a topside view as seen through the PCB, and then add the topside components. Obviously there has to be some adjustment in relative positions that do not allow exact scale representation, and the connecting wires have to fit too. You will observe in the previous drawings that individual wires can be highlighted in any color (using a standard or variable color palette) and any width. In fact, this is one of the most important features that makes TinyCAD so useful for reverse analysis. Say you have your physical schematic drawn out on a single page, with everything scrunched up close together; long runs of closely spaced wires; impossible to make any sense of the actual electrical functions. But click on a wire and set its color to bright purple, width to 25, and apply to the entire net -- suddenly that net jumps off the page at you. Any net throughout the page with the same name attached (case critical) will also brighten into visibility. The above drawing represents the physical layout of an entire two-PCB instrument joined by an inter-board connector. Naming nets on both sides of the connector with the same name allows highlighting that entire net in any color or line width. Later, the net connections can be re-drawn into a more representative functional schematic. This brings us to another very useful feature in TinyCAD with regard to functional analysis. If the wire "autodrag" option is turned off and wire angle set to "free," than any wires that connect together at angles remain graphically separated from their connecting wires, even when part of the same electrical net. This means that switching functions can be depicted and the actual switch contacts can be very easily "thrown" on-screen by clicking on the wire and dragging its endpoint to a different switch contact, after which the resulting nets can be highlighted as described above. An example of depicting switching functions on the fly is shown in the image above. This depicts a 6-pole, 6-position mechanical rotary switch with wiper contacts set to position "3," and all affected nets are highlighted in their own colors to show the electrical continuity in that switch position. Setting the contact wipers to a new position is just a matter of clicking on each contact wiper and moving the endpoint to the desired position. This feature can be applied to any switching function. For example, a DG508 analog multiplexer IC as it might appear on the physical schematic with a suggestion of functionality is shown below: But the functional representation illustrated below reflects this device's operation far more clearly as a rotary switch equivalent. Just grab the wiper end and rotate as required. Simulations, scope plots, and notes can also be placed onto the schematic to help understand the various functions as illustrated in the examples below: Another use of the wire highlight feature is in deciphering logic functions. While TinyCAD cannot do this automatically (it would be a nice feature in the ongoing development of future versions), when you have a bunch of gates, you can set inputs as Red=HI, Blue=LO, and mentally work through the logic graphically as illustrated below: TinyCAD is also reasonably good when it comes to capturing mechanical sketches as illustrated below: Another nice feature is the search function -- any text (note, component attribute, signal name) can easily be found this way. Remember "way back when" having to visually scour a paper plot for an elusive resistor? Individual nets can be given multiple names; all will show up in any highlight or text searches. Multiple nets can be given the same name; useful when highlighting a function such as a relay drive signal to its final destination through intermediate stages. This is one nice feature that can be used when a netlist is not ever going to be created -- doing such will tie all these intermediate stages together. Finally, when others need access to your drawings, you should have some form of revision control to keep track of the latest updated drawing. The easiest way to do this is to date and time stamp your drawings every time you save a version to a publically accessible corporate location such that the date/time printed in your drawing title block match the date/time (to the minute) of the file when saved on the public drive. Then there is no question as to whether a particular hard-copy is the latest rendition. CAD and CAE have certainly come a long way since I first fought with Daisy Systems Computer Aborted Engineering 30 years ago... Glen Chenier Engineer