全部博文(230)
分类: 嵌入式
2009-10-14 21:38:28
Gerber is a standard electronics industry file format used to communicate design information to manufacturing for many types of printed circuit boards. In many ways, Gerber is the electronics world's equivalent of PDF. This odd little format, a hybrid machine control language and image, is a core component of the electronics manufacturing supply chain. If you're involved in building electronics for fun or profit you have (or soon will) come across it. You may even come to depend on it.
I've written this article to provide a general explanation of:
I hope you find this article useful, and generally accurate. In any case, I am happy to receive your comments, suggestions and corrections – just drop an email to editor@circuitpeople.com.
The content of a Gerber file is ASCII text (i.e. English letters, digits and a few special characters) and looks like a human could almost read and understand. Here's an example:
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*5,1,8,0,0,1.08239X$1,22.5*%
%ADD10C,0.0080*%
D10*
X000281Y000835D02*
X002472Y006196D01*
M02*
When the format was first created, these commands called out instructions for a special kind of machine called a which used them to create a picture on photographic film by precisely controlling a light source. Today, however, photoplotters aren't always a part of the process and Gerbers are treated more like image files. So why doesn't the industry just use image files like postcript? It's a bit of a catch-22: The machines use Gerbers because CAD/EDA/CAM software creates Gerbers; And, the software creates Gerbers because the machines use Gerbers. Alternative formats like ODB++ exist, and are probably superior to Gerber for the most part (except for mandating the use of more expensive hardware and software, all controlled by one company). Nonetheless, Gerber is here for the long-haul so we're well served by a little understanding of it.
There are two "standards" for Gerber files out there: the "old" and the "new". The old standard (D) spreads information for a single layer accross at least two files. The new standard (X) allows all the information for a layer to be contained in a single file. The biggest benefit of this comes down to data management (or in plain English, the fact that it's much easier to keep track of one file than two files).
The types of instructions Gerber file instructions are (roughly):
Instruction types #3 and #4 are shared between the X and D variants of Gerbers. That is, the old and new formats share the same commands and capabilities when it comes to basic drawing of lines and simple shapes. However, the new "X" version also allows the definition of some important options as well as reusable blocks of data called apertures and macros. In a version "D" file set (rememeber, always at least two files) the apertures are defined in an external file that can be one of many different formats. This is why an "X" file (ahem) can be viewed and rendered by CircuitPeople standalone -- all the pad shape and line widths are built into the one file -- and why "D" files are considered less desirable by PCB fabricators.
Gerber files containing blocks of text starting and ending with percentage symbols ("%...*%") are probably the RS-274X variety. Sometimes we see files with parameters but with external aperture definitions, which is an error but our software will accomodate it. Configuration parameters control various things in the rendering process, including whether the geometry should be considered white drawn on black, or black drawn on white.
Apertures define the thickness of traces, size and shape of pads. Macros (AM parameters) define complex shapes for registration marks, logo, lettering and other special geometry that appears in a design. Macros are a "less often" used feature of Gerber, though many CAD systems employ them for filling the gaps in the original speficiation for features such as pad teardrops, rotated rectangles and rectangles with rounded corners. Macros support complex composition rules, and even some equation-driven parametrics. It's a shame they aren't use more often in CAM output.
It's worth noting (reiterating, maybe?) that one reason manufacturers shy away from the "D" variant gerbers (the ones with a apertures defined in an external file) is that customers often forget to include them with their order. Don't do that. If you do, the best thing that can happen is that your order will be delayed. At worst, it won't be delayed and you'll discover it only after assembling components only to find it non-functional.
Gerber has three drawing primitives: flashes, lines and arcs with thickness, and polygon fills. It can be a challenge to represent complex geometry using only these shapes. Luckly, RS-274X also adds "Step and Repeat" which allows us to create patterns of features. CAM systems are clever in the way they create Gerber files. For example, the system may "pour" a large area of black (copper) then draw over it with a "scratch" layer of wide geometry, then finally draw a copper trace down inside the clear. Only three commands are issued, but the result seems more complex:
..placeholder...
The purpose of the PCB is to mechanically support components as well as move the proper number of electrons to where they are need. That is, the PCB is made with channels (traces) of conductive material along which electricity flows (if you will) from component to component.
A "bare" PCB is one that has yet to have components attached, and is generally constructed of alternating layers of conductive material and non-conductive insulating material. Copper is the most commonly used conductor with various forms of fiberglass, FR-4 being the most common, as the insulator. However, due to requirements for high thermal conductivity, strength or dielectric many other materials are used as well. There are a lot of ways to make a PCB, but in this paper I'm only going to talk about one common method. A subtractive PCB manufacturing process is one that starts with sheets of composite material with a uniform layer of copper plated of the entirty of one or both sides. Channels (traces) are formed by selectively removing portions of the copper conductor, leaving behind the traces we see on finished boards. In this process, Gerber files provide the "picture" of where copper should remain:
I literally mean a picture of where the copper should exist on each layer – imagine clear for no copper, black for copper. But there is more to a PCB than just copper, which when exposed to air oxidizes making it difficult to adhere to with solder. Over the copper will be a layer of solder mask (commonly green) and probably some white letter referred to as silkscreen, legend or nomenclature. As with the copper, Gerber files provide pictures of where the solder mask paint, silkscreen paint, or cut-outs in a stencil will go. In addition, it isn't uncommon to supply locations and for holes in a Gerber file – each size of hole represented by a different symbol – as well as the shape of the board.
You can probably sympathize with the poor manufacturer. For a "simple" two layer PCB, they can receive up to nine files:
In addition to these files, a manufacturer will need other information that generally isn’t included (and shouldn’t be included, IMHO) in the Gerber data:
And the list goes on. Obviously, this process leaves plenty of room for errors, which brings up the topics of automation and DFM. But before going there, we need to take a side-track into how the PCB manufacturing process works.
While the construction of a PCB is conceptually simple, correctly manufacturing the circuit board can be complex. A general outline of the traditional PCB manufacturing process for a simple two layer board (meaning a board with two conducting layers) may look like the following:
Viola! Your board is ready to have components attached (aka. PCB "assembly") and start service in your project or product.
From the above you might have noticed the part where Gerber files were made into "films" sounds a little antique. Well, the truth is that it is antique. Although these steps are commonly in use, many fabricators use a technique akin to inkjet technology for applying silkscreen (aka. "nomenclature," or "legend") to the board. Similarly, solder mask and etch resist can be applied in a computer-controlled "spray painter". Hence, films may not actually ever be used, and for PCB designs involving very small features or high layer counts almost certainly won't be.
Every shop has a unique variation on the above process, and new technologies are available almost weekly. So, if you visit a fabrication shop, expect to find some other technologies and processes to be in play. But the overall process should follow the general outline above.
What's all that have to do with Gerber files? Well, lots of things. I'm going to break them down into two areas: Legacy Issues and DFM.
As mentioned earlier, the Gerber format was originally used as NC to drive mechanical systems that selectively exposed photographic film to light in a darkroom environment. To make a pad, these machines would "flash" light through an appropriate shaped aperture. To make a trace the machine would keep the light on while moving to create a "drawn" line or arc. As you can probably guess, that isn't the way it's done today. Those old photo plotters were functionally limited, notoriously unreliable and expensive. Remember those "aperture definitions" in the Gerber format? Yep, those used to indicate physical holes of different sizes that would be used to control the amount of light exposed onto the film.
Today, the machines have evolved into something much more like a laser printer, using a beam of light bounced-off rapidly moving mirrors to expose the film. And, as I mentioned above, in some cases similar machines expose the etch resist and solder mask directly rather than use films as well. In its role as a vector image format, Gerber is not unlike Adobe PostScript, Windows Meta files, or SVG. But, because it was not intended for this purpose, some nuisance issues come into play when Gerbers are used for PCB specification:
Whether you view it as an image format or NC data, Gerber doesn't include any sort of "intent" about the design. Worse, it contains no protections from creating designs that are very difficult, if not impossible to manufacture. Here are some common errors to avoid with your PCB designs:
Holes in PCB can be plated with conductive material to carry electrons from one "layer" to another (holes used in this way are referred to as vias) or non-plated. Depending on which set of layers are connected by the hole, vias may be referred to as "buried", "blind" or "though holes":
The above example 4-layer PCB cross-section shows a rigid core of material prelaminated with conductor on each side and two "foil" layers separated from the core by a thin layer of insulating material The different types of plated holes are labeled. A non-plated through hole (NPTH) is drilled after the board has been fabricated, so it doesn't contain any plating on the internal wall and therefore doesn't electrically connect traces on one layer to another. These types of holes are generally used for mounting hardware (stand-off, push-tabs, etc.) or other non-electrical uses. Plated through holes (PTH) penetrate all layers of the PCB and have interior walls plated with copper. Such holes can be used for mounting "through hole" components, or as mentioned above exist only to carry electrons between conductive layers (vias).
The goal of this article was to provide readers with a little background on the Gerber file format(s) as well as provide some hints on common pitfalls when communicating with manufacturing. I hope I have acheived that goal. If I have, please let me know. If I haven't, definately let me know. Thanks, and enjoy!