Tutorial - Reverse Engineering _Getting Gerber back to your CAD
Document Sample


Tutorial - Reverse Engineering
Build a CAD Database from Gerber Files
(CAM350 version 6.0 and up)
(Richard Nedbal)
Reverse Engineering is the process of starting with Gerber files, then adding information such that an intelligent
CAD database can be exported to a CAD system. In addition to the Gerber data, the exported database contains
components and a complete netlist. Reverse engineering is done in cases where the original CAD database doesn't
exist, yet CAD edits must be made, to keep a board in production. It is also used when a company has older
"legacy" designs and needs to archive CAD data rather than Gerber files where possible.
Reverse Engineering Summary:
The steps are pretty easy:
* Import the Gerber files and prepare them.
* Extract a netlist.
* Build the components (parts) using the silkscreen as a guide.
* Place the parts.
* Check the results and export the CAD database.
These are the 5 basic steps, but of course, there is a lot of checking and verification that needs to be done as you go.
This tutorial will guide you through the process and share with you the "tricks of the trade".
You've been told:
"Regardless of how well you understand this process, you will still screw up
your first reverse engineering job".
Detailed Reverse Engineering Procedure:
1) Prep 1: What have you got?:
First, make sure that you know what you have. It really helps is you have a fully assembled board to refer to. The
silkscreen often does not contain enough information about component shapes and outlines, and the component pins
are not always easy to recognize. An example is a part such as a transformer that has mounting lugs. Are these lugs
electrical? Because if they are, they are considered a pin and must be defined as such. How about an edge
connector with mounting holes that are not electrical? These must be drilled using nonplated drills.
Do you have - or can you get - a bill of materials (BOM)? This helps when naming the components and the BOM
provides a list of parts, their reference designator and quantity. Yellow lining each refdes on the BOM as you go
helps to make sure that you didn't miss any parts.
How about pin numbering? Do you know the sequence of the pins on parts such as edge connectors? The pin
numbering sequence doesn't really matter to the process, unless you have a prior schematic or some other document
that much match when you're done. Obviously comparing the reverse engineering result to a netlist that is reference
designator and pin number based, requires that the pin numbering match. In many cases you just don't know or it
doesn't matter. Take, for example, a resister. Which pin is pin #1 and which is #2? If you get them backwards
(which is likely) will it matter?
If the silkscreen layer is incomplete, then get a fabrication drawing, BOM or some other method to determine each
ref/des. If all ref/des are not known, you can make them up as you go, but here again, it won't match a prior
schematic
2) Prep 2: (Load and clean up the data):
To completely reverse engineer a set of Gerber files requires the generation of parts or components. The parts
become the footprint library for a design. The Utility command called QuickPart allows the assigning of reference
designators and pin numbers to each part location, but it does not build a part library. Therefore, you do not use
QuickPart in the reverse engineering process.
2a) Import the Gerber files and check the layer alignment. The layers MUST be aligned for anything else to work.
Use Edit/Layers/Align to move the data a layer at a time.
Note: Sometimes layers such as the silkscreen will not have any fidutials or alignment
marks to use as snap points for Edit/layers/Align. In this case, I just turn on only
the silkscreen layer, do an Edit/Move/Select All, then I turn on the appropriate Top
or Bottom layer and place the silkscreen as best I can. Make sure you have the
"Snap Box" turned off (S Hot Key) or the data may snap to something, and not end
up where you want.
I strongly suggest that you have and use an NC-Drill file if possible. This layer would be tagged NC Data and
it clearly defines the layer to layer connectivity. Without a drill layer the system has to "deduce" connectivity
from the pad type and this is a guess at best. If all you have is a Gerber file that graphically represents the drill
data (this is NOT an NC-Drill layer), then select Tools/NC Editor… from the main menu, then Utilities/Gerber
to Drill. This command looks at the size of the flashes that are on the Gerber layer, builds a matching NC Tool
Table and creates a new layer that becomes the actual NC-Drill layer. Upon returning to the CAM Editor you
should remove the original Gerber layer.
2b) You should have a border layer that contains ONLY the outline of the board. If the Gerber data set didn't
include one, then I look at the others layers to see if the data exists. Then I add a new layer and copy ONLY
the outline to this new layer. This layer will be tagged as a "Border".
2c) Set the draw and flash colors differently. Setting the draw color different from the flash color makes
identification of drawn pads much easier. I recommend using noticeably different colors. This is done using
the controlcolor.scr script or interactively via Tables/Layers or the Y hot key.
2d) Tag the layers properly (Tables/Layers) and put them in order (Edit/Layers/Reorder). No system can know
what the function of each layer is. “Tagging” each layer tells the software how to process the electrical data.
Only electrical layers are looked at, so masks and graphic layers are superfluous and should be removed from
the data set. "Tagging" is critical especially for internal planes. Most internal planes are tagged as “Negative
Plane” because the actual copper would be the reverse image of what is displayed. Use the N hot key to
visualize. After tagging, use Edit/Layers/Remove to remove any layers that are not required. You can then use
the layerord.scr or the controlcolor.scr macros to set the correct layer order.
Note: The term "negative plane" refers to it's image polarity and has nothing to do with
the polarity of the voltage that will be used. Tagging the VCC power plane as a
positive plane, and the VSS ground plane as a negative plane may feel right but it'll
only create chuckles when you call me later.
3) Perform the draw-to-flash (Utilities/Draw to Flash) conversion as required. The step is required because netlist
extract defines the end of a net as where a draw ends at a flash. In addition, component pins must be flashed.
Although not required, I convert thermals on negative planes too! You should also consider converting vector
filled areas to "real" polygons since large vector filled areas do not go back to PADS very well, and the amount
of data slows down the process and makes the database larger.
4) Run Utilities/Netlist extract. This process will compute net connectivity based upon the previous steps. Nets
will be numbered ($net1, $net2, etc.). A small "plus" will be displayed on the through-hole padstacks. (These
padstack markers can be turned off under Settings/View Options.) No padstack marker means the pad was
processed as SMT. If you have composite layers, refer to the white paper entitled "Composite Layers.doc"
Tip: PADS Power-PCB only understands a net as a pair of pins. Because of this you should NOT extract a
netlist with "single point nets" checked.
5) It’s a good idea to save the .CAM database at this point.
The CAM database stores all the information, and since you have gone through several steps it’s a good idea to
save it at this point. The original Gerber files are no longer needed.
Tip: You are entering an area where you will be wanting to switch back and forth, between different layer sets.
For example, for net checking you may want to have all the electrical layers on, and later during part
building you may want only the Top and the silkscreen layers on. Using the layer bar to turn layers on
and off can become tedious. Now is a good time to set up the user layer sets you are likely to want to
switch between. I typically have 3 sets: All the electrical layers, all related Top layers and all related
Bottom layers. Go to Table/Layer Sets/User. Hot key 1 becomes all electrical layers, hot key 2 becomes
all top layer, and hot key 3 becomes all bottom layers.
Now from the CAM editor hit the number 1 key, then the 2 key, then the 3 key. You should be
instantaneously switching views without have to touch the layer bar. Notice also, that I always include
the Border layer for reference.
6) Hit the #1 key (all electrical layers) and run Analysis/Net Check. Each net will be flashed as it is checked and
the process will find floating traces, locations where D2F should have been run, or nets that it may consider as
open. This is a required step, do it. If errors are found, Net Check will create a new “netcheck” layer tagged as
a temporary layer. Turn on that layer by itself to see the errors (if there were any).
Note: The default color for this new temporary layer is color #1, which is typically dark red, which makes it
hard to see. I go to File/Setup/Colors and change the lower left color to white.
Color #1
Note: PADS wants the traces to touch the center of pads. The Gerber data may have traces that touch pads
but do not share a vertex. Netlist Extract will process this condition correctly because as far as the
copper is concerned they're connected. But this will cause errors when going back to PADS.
To find this condition, run Analysis/Net Check with "Center Line" checked rather than "True Shape"
which is the default. Net Check will show flight lines, also called ratsnests, for each net where this
happens. I close my eyes when I run this because some old designs never seem to worry about trace
ends hitting the center of a pad and I've seen hundreds of rats nests. It does NOT make your day. To
correct this condition you use Edit/Move Vertex on the line end and snap it to he center of the pad, or
delete vertex to remove overshoots. Then you rerun Net Check/Centerline until this errors disappear.
You DON'T want to see THIS
Ratsnest line
Line vertices
missed pad
centers
Example of net
check problems
(centerline) with
Fill mode toggled
Small extra
segment to outline mode
"overshoot"
under pad
Another cause of ratsnests is small line segments that overshoot the pad center. You have to toggle
the fill mode (F hot key) to see these, and they must be eliminated (Edit/Delete Vertex).
In cases where there are a lot of edits required to clean up line ends, you will find yourself switching back and
forth between Edit/Move Vertex and Edit/Delete Vertex. This can really slow you down, so I program those
two commands to function keys F4 and F5. I also program Add/Wire to F8 because sometimes it's easier to
just delete the offending segment(s) and reenter the wire from scratch. I use Add/Wire NOT Add/Line,
because I want the net connectivity checked as I make the entry. Here's the Macro/Assign/Function Keys
dialog box from my system:
Example of my Macro/Assign/Function Keys
dialog box.
I also us F3 and F7 for two scripts that I use a
lot but I deleted their entries from this picture
to reduce confusion.
Also note that F1 and F10 are not available
because they have preassigned tasks by
Windows.
PS: Don't forget to remove the temporary layer after you get "Net list is OK"
Note: If you have negative plane layers that contain splits, you should do an Info/Query/Net and select
inside each area. Only thermals inside the split area should highlight. This verifies that the nets are in
fact segregated by the split lines.
Example of an
INFO/Query/Net
Inside an isolated
negative plane area.
Since you may have spent quite a bit of time fixing up the connectivity, it's a good idea to save the database at this
point, perhaps under a different name to preserve previous edits.
7) Run Utilities/Build Part.
As ref/des and part outlines become part of the components, they will be placed on new layers called refdestop
and refdesbot. The original silkscreen layer is left untouched. This is so you can overlay the silkscreen layer
and the appropriate refdes layer to verify that you have not missed any parts.
Tip: Since you probably created Layer Sets in step 5 above, add the refdes layers to the appropriate layer set.
Hot key #1 will remain unchanged but 2 and 3 will have the new layers added. For example:
1 = Top, all internals and planes, Bottom and Border
2 = Top, Silktop, Refdestop, and Border
3 = Bottom, Silkbot, Refdesbot and Border
The build part process is as follows:
a) Turn on only the Top layer set (Hot Key 2) and zoom into a component.
b) Run Utilities/Build Part. "REF" is attached to the cursor. Now is the time to check the button bar to
make sure the ref/des text height and orientation is correct. I use 50 mils for most text heights. "T"
turns the REF text 90 degrees and "M" flips it to the other side.
c) Click the REF where you want the default ref/des location to be - usually directly over the current
reference designator. This can be changed on an instance by instance basis later. If the "REF" text
overlaps anything else on the silkscreen layer it will be highlighted also. In cases like this I just
select an area nearby where other data won't be selected.
d) You will then be prompted to window around the outline of the part. The cursor is a "crossing
window" so only portions of the outline need be selected. If no outline information is present, you
may just enter two points in a blank area to skip this step.
e) You are prompted to enter the pin sequence. The button bar shows the starting pin # and the "inline
pins" check box is defaulted ON. The pin numbering will start with pin #1, and you only have to
select the end pins that are in a row. The system will automatically number the intermediate pins.
Note: The next pin number will always be displayed on the button bar and, if desired, you can change the
pin # in this field to another number, or even an alphanumeric (A1 will increment to A2, etc.).
d) End the pin entry sequence with the right button. After pressing the right button you will get a
dialog box that allows you to go back and change anything that you did. Assuming everything is
correct just select OK.
e) The next dialog box will allow you to enter the footprint name. This dialog box also tells you what
side the system is building the part from. Make sure you're building from the correct side! Enter
the “Footprint Name”. This is the name that the system will use to store the part in the internal part
library. For example, a 16 pin DIP might be called Dip16. Do not enter any spaces in this name,
and do not enter something like 7400. This is the footprint name, NOT the device name! You only
need to build one footprint for each unique part (part and footprint are synonymous).
Note 1: If you miss a part you can always come back and create it later. It is recommended that, while you are
learning the process, you do only one part at a time until the process feels comfortable. Also, you
only need to build one part, regardless of the orientations used.
Note 2: Until I get comfortable, I usually cancel Utilities/Build Part and go directly to Add/Part. You will see
that there is one footprint in the project library (the external library is used when a list of parts exist in
a separate file). I select the part and place it over the data I just built it from. Everything should
match up and now the new refdestop layer has been automatically created. Specific details of the
Add/Part process follow in #9 below.
Note 3: Once a library has been created, you can always go to the Part Editor and export the library (.plb
extension) for use in other reverse engineering jobs.
8) This may be a good time to go to Tools/Part Editor and see how the footprints are stored, how they can be
edited in the Part Editor, how the library can be exported, where the origin of a part is (it's always pin #1), etc.
Note: Only the pin locations are stored as part of the footprint - pads shapes are not! This is done so that
when Add/Part is run later, the same footprint can be used even if the pad shapes are different from
location to location. The Add/Part process will use whatever pad shapes are present as long as their
locations match with the pin locations.
A few comments on the process:
I usually stay at step #7 for a while. I pan around the design, building one part at a time adding it to the library, then
going to Add/Part to add it to the design, and I may even switch to the backside to build a few parts from there, and
watch the refdesbot layer get created. This way I can watch the project library grow, saving the database
periodically, and watch the silkscreen slowly get overdrawn with the appropriate refdes layer. Soon it becomes
apparent that the refdes layer drawing over the silkscreen is a good way to check that all the parts have been built
and placed - at least on that side. To aid me in this, I change the color for the refdes layer to something noticeably
different from its related silkscreen layer. This is really the only way to check that a reference designator hasn't
been missed because the system will allow missing reference designators in the sequence, and those little decoupling
caps or small resistors are easy to overlook. You will also start to notice that the system will draw a thin white box
around each part, using dotted lines for parts on the backside.
9) The process of ADDING A PART.
Select Add/Part…
a) Select a footprint and press OK
b) You will be asked to enter a Device Name and Reference
Designator. Only the ref/des is required and that's the only field I
ever use.
c) Note also, that this is where you could go to an external library and
load a part from there. Any part loaded from an external library
gets copied into the current project library.
Add/Part is the process of actually instantiating each component. Add/Part replaces the data on the
silkscreen layer with a part. A white box is drawn as a visual indicator that there is a part there rather
than just Gerber graphics. A solid white line is used for top-side parts and a dotted white line is used for
bottom-side parts.
c) Pin #1 of the selected part becomes attached to the cursor. The object snap is automatically turned ON so
that the part snaps to the selected pad. It’s a good idea to turn off the grid snap (S key) during this
function. If you want to rotate the part before you place it, just press the T (Turn) key. If you want to
place the part on the back side of the PCB, press the M (Mirror) key (all graphics and Ref/Des will
mirror). Once the part is placed, you press the right button to commit and the pins become part of the
appropriate nets. You are now prompted to select the Ref/Des and move it on top of the silkscreen
Ref/Des. Here again, you can use the T and M keys to rotate or mirror the ref des as required. After
placing the Ref/Des, you hit the right button to commit, and the part is instantiated, the Ref/Des is
automatically incremented, and you are ready to place the part in the next location. You can change parts
while in the Add/Part command by selecting the part pulldown on the button bar. The next Ref/Des
number is always displayed on the button bar. If you are not doing the placement in Ref/Des order, you
can change the Ref/Des on the button bar at any time just by typing it in. The system will not allow
assigning the same Ref/Des again, and the next time you come back to this part, the next unused Ref/Des
will automatically be selected as the default.
Note 1: The instantiated component's Ref/Des and outline information is placed on a NEW layer which is
automatically tagged as refdestop or refdesbot. This is done so that the original silkscreen layer
remains untouched and can serve as a visual check so that no parts are missed. If I have access to a
Bill of Materials I also yellow line each refdes as I go to make sure I don't miss any.
Note 2: I suggest selecting Settings/View Options and set the part outlines to "draw after graphical data" at the
bottom of the dialog box. This will make the part outlines more visible.
Note 3: I also suggest that you view part outlines for each side separately. Even though the part outlines on
the top are shown as solid, and on the bottom as dotted, it can get crowded on a dense board when
both are shown. (One of those scripts I mentioned above in step # 6 switches the part outlines on and
off.).
9) Proceed with steps # 7 and 8 until all parts have been built and added. Check your work often, save it often, but
feel free to take a break at any time. All information becomes part of the .CAM file you save, so opening the
database later will take over where you left off. No information is lost.
When you think you have completed the process, look at the silkscreen layer(s) and see if there is any other
information - not related to parts - that should eventually exist in CAD the database. If there is, copy this data
to the appropriate refdes layer. Then when you're sure - remove the original silkscreen layer using
Edit/Layer/Remove and reorder the layers putting the refdes layer(s) where the silkscreen layers were in the
layer sequence.
Then after the final save, select File/Export/CAD Data and choose the target CAD system.
There - wasn't that easy?
Special Notes and Considerations
Building parts from the backside.
If you build a part from the backside, the system should detect this automatically, and show you that the part is
on the backside in step 7E above. Regardless of the side the data was built from, the system will always store
the part in the library as if you built it from the topside. This makes the overall process more reliable because
parts are always stored the same way, independent of how they were built and how they are instantiated. I also
use View/Backside to make reading of the reference designators easier. With View/Backside I often forget
that I'm actually working on the backside.
Adding parts to the backside.
You hit the M key to flip the part for the placement on the backside. Although not required, I use
View/Backside again. This does not automatically mirror the data, or in any way affect the database, it just
changes the view of it by effectively "flipping the board over". Parts can be added to the backside without
changing the view. Some people leave the view in the normal front side mode, which makes it easy to see that
the part has been mirrored when the M key is pressed.
Building double-sided parts
An example of a double-sided part would be an edge connector that has SMT connections on both sides of the
PCB. CAM350 can handle this, as long as your target CAD system can. We suggest turning ON only the
topside when the topside pins are being selected then, while still in the Build/Part command, turning ON the
backside when selecting those pins. Also, if there are multiple rows of pins, you can use inline pins for each
row, but remember to uncheck the Inline Mode when you select the first pin of the next row. Some edge
connectors have a pin sequence that are not in rows and require that you point at each pin.
Checking your Padstacks before you get started
CAM350 displays a black cross on every through-hole padstack. Before you get started, make sure that SMT
pads do not have a padstack marker and that through-holes do.
Exploding Nets
If the netlist extraction was incorrect for any reason, such as you forgot to do draw-to-flash conversion, you
can use Edit/Change/Explode Netlist to remove the net connectivity. Alternatively, you can just run the netlist
extract again and let it automatically explode the nets. This can be done at any time even after the build part -
add part process.
Exploding Parts
If you notice that you made a mistake after you've already added the part and moved on to another command,
you must explode the incorrect part before trying to add another part. If you try adding a part on top of another
part you'll be sorry at the mess you have to clean up when explode results in redundant data all stacked up.
Netlist Extract note
As stated in 2a above use drill files to assure proper layer to layer connectivity. This is very important for all
boards, and absolutely required for boards that contain blind and buried vias. If no drill file is present, the
system will assume that round or square pads that are coincident on both sides on the PCB, are through-holes.
If this case exists, the netlist extract process may be incorrect.
Add Part note
Add/Part will verify that the pin locations match the Gerber data before it will allow the part to be added. It
uses a 2 mil tolerance to handle pads that are not perfectly aligned. Nevertheless, the overall pin count must
match exactly and placement should match. If they don't you will get a warning message that some pins don't
match. DO NOT PLACE THE PART if you get this message. Find out what's wring - fix it - and then move
on.
Get documents about "