Introduction
Today, most PCBs are produced using gerber files to communicate between hardware engineers and PCB factories. Before learning more about such a powerful file format, let’s briefly discuss its’ history.
Everything started with Heinz Joseph Gerber, an American inventor born in Vienna, Austria, who produced one of the world’s first drafting machines using a digital XY coordinate table which he developed in the 1950s.
However, in the 1960s Joseph Gerber found another application for his XY tables. He invented the first Numeric Controlled photoplotter used to generate photo tools which are an essential part in the process of producing PCBs. The plotters were actually vector plotters since the plotter’s head followed the PCB pattern.
Joseph Gerber’s company Gerber Scientific initially dominated the industry by building very accurate machines and soon, the name gerber became a synonym for photo plotting.
The standard drive format for the plotters was Gerber RS-274-D.
Since then, a number of new gerber formats have been released and next we will check their specifications.
RS-274-D
Also called Standard Gerber format, was used in the 1960s and 1970s to drive NC machines such as the aforementioned gerber vector photoplotters. Such photoplotter can be seen in Figure 1.
Figure 1. Photoplotter concept diagram – https://www.eurocircuits.com/gerber-past-present-and-future/
The main components of the photoplotter are:
Optical head – contains a light source.
Aperture wheel – a circular wheel that can be rotated to select different apertures. Apertures are 2D plane figures that can be simple shapes like circles or rectangles, but they can also be pretty complex.
Shutter – to enable or disable a path for light to reach a film.
X-Y Table – a holder for the film.
The usual workflow of a photoplotter was to move an optical head to the correct location with the shutter being closed. The next step was to select a proper aperture by rotating the aperture wheel. From here, the two most common cases were either to briefly open and close the shutter, so-called flash mode, to expose a pad on the film or to move the optical head in a line while the shutter is opened to expose a trace on the film. Given the proper commands for table motion, aperture selection, and shutter operations, one can construct just about any image on the film.
Standard Gerber was a fairly simple ASCII format consisting of commands and XY coordinates. To show what the format looks like here are a few lines from a gerber file:
G01*
X003920Y006991D02*
D16*
X004304Y006832D01*
M01*
From the file, a few things can be noticed:
Asterisk is used to define the end of the line of each command.
A command can be an instruction starting with letters M, G or D or it can be a coordinate expressed with X and Y values.
G-Codes or general function codes are initialization commands used to prepare the machine’s state before drawing. They can specify how the coordinate data should be interpolated if the polygon area fills feature should be on or off, as well as the unit of measurement (millimeters or inches).
The most frequently used G-Codes are:
– G01 – Sets linear/circular mode to linear.
– G02 – Sets linear/circular mode to clockwise circular.
– G03 – Sets linear/circular mode to counterclockwise circular.
– G04 – A human-readable comment.
– G90 – Set the Coordinate format to Absolute notation.
– G91 – Set the Coordinate format to Incremental notation.
D-Codes or draft codes are instructions to the gerber plotter. Commands D01, D02 and D03 are used to move the optical head to the specified x-y location with the shutter being in different modes. More specifically:
– D01- move to the x-y location specified with the shutter open.
– D02 – move to the x-y location specified with the shutter closed.
– D03 – move to the x-y location specified with the shutter closed, then open and close the shutter – known as flashing the exposure.
– D-Codes with values 10-999 are not commands, but data. They represent apertures or positions on the photoplotter wheel.
M-Codes or miscellaneous codes are used to identify the end of a file. The most commonly used are M00, M01, and M02 which are different types of program stop commands.
Gerber file is alone not enough to expose the film correctly. Another file called aperture or wheel file was needed to specify apertures on the aperture wheel. After that, an operator had to manually operate the photoplotter with the two sets of data and that process was prone to human errors during the operation. Since the RS-274-D gerber format was intended for a manual workflow and could not be automated, it was eventually declared obsolete in June 2014.
RS-274-X
Also called the Extended Gerber format was released in 1998. It is a superset of RS-274-D Standard Gerber. Extended Gerber includes the aperture list in the header of the Gerber data file. G-codes and D-codes from the Standard Gerber format are supported as well as codes referred to as mass parameters. Mass parameters are plot parameters that can affect an entire plot, or only specific parts of the plot, called layers. Their presence makes the Gerber data X data. The Extended Gerber is a clear, powerful, and complete standard to describe PCB layers and is well-suited for automated workflows which is the main reason it superseded RS-274-D. Extender Gerber’s main advantages are that it is supported by all PCB CAD and CAM systems and is thoroughly field-tested and debugged.
RS-274-X and RS-274-D files can be easily distinguished by inspecting the text files in a text editor. RS-274-X gerber file will have mass parameters after which the standard RS-274-D data will follow. A few examples of mass parameters are:
– %MOIN*%
sets units to inches
– %LNBOXES*%
name layer boxes
– %ADD10C,0.010*%
Define aperture D-code 10 – 10 mil circle
As can be observed, mass parameters start and finish with a percentage symbol and have an asterisk (same as RS-274-D data).
When gerber files are exported from a CAD tool (i.e. Altium Designer) in an RS-274-X format, each layer is exported to a separate file and has its own extension. As an example, a standard two-layer board designed in Altium Designer would have the following layers included:
.GTL – Top Copper.
.GTP – Top Paste.
.GTS – Top Solder.
.GTO – Top Overlay.
.BTL – Bottom Copper.
.BTP – Bottom Paste.
.BTS – Bottom Solder.
.BTO – Bottom Overlay.
.GMXY – X and Y being digits to indicate a mechanical layer; mechanical layers can be used to specify board outline and some additional information like board stack-up and board specifications.
However, gerber files are not sufficient to produce the PCB, because the drill data is not included. To transfer drilling information to the factory, Drill data in excellon format is needed as supplementary data aside from the gerber files.
RS-274-X format is widely used in the industry since it is practical, free, and simple. Although the format specifies the layers precisely, there is still a possibility of human errors in PCB production because some information regarding the PCB is not standardized. Critical board information that is not standardized includes layer ordering, layer representation, and differentiation between objects like SMD pads, via pads and component pads. The drawback of this information not being standardized is a potential loss of time in communication between designers and manufacturers.
To address those issues, Gerber X2 format was created.
Gerber X2
Also called Extend Extended Gerber is another extension of the RS-274-D standard released in February 2014. X2 adds attributes on top of the RS-274-X format. Attributes are standardized labels and can be applicable to whole files or just to specific objects. They can be used to define:
Gerber file’s function
Object’s function
PCB profile
Drill tolerances
And more…
It is important to note that Gerber X2 is backward compatible with the RS-274-X standard. This means that the systems that use the older standard will still generate the correct outputs. The added manufacturing data greatly reduces the chance of errors during PCB fabrication. In the case of Altium Designer, all layers exported in X2 format have the same extension (including the drill data).
Gerber X2 plus
Gerber X2 plus was released in April 2018. It expands the Gerber X2 standard by adding of Gerber Job file. The Gerber Job file enables the designer to specify additional board information that was previously not standardized and had to be communicated by means of separate documentation.
The Gerber Job file is in a human-readable format and can be extended by custom information.
It contains information about PCB characteristics like:
Header – information about the files, such as creation date.
General Specifications – overall board characteristics like surface finish, the board size, board thickness…
Material Stack up – specification of the stack up and materials used.
Design Rules – rules used in the CAD software while doing the layout of the board.
Files Attributes – polarity (positive/negative) and function of all Gerber files.
Gerber X3
With the release of the Gerber X2 plus standard, everything was precisely and well defined for the bare board in the gerber files. What was missing were component information and assembly documentation.
Gerber X3 was released in 2020 to address those points. X3 gerber format includes both the PCB layout data as well as the Bill of Materials (BOM) and Component Placement List (CPL). Combining the bare board and component data allows easier review and quicker import of the information to both the PCB factories and assembly houses, thus saving time and money.
X3 is backward compatible with all previous versions.
The owner of the Gerber standards is the company Ucamco. A quick summary of all gerber standards published so far can be seen in their brochure shown in Figure 2.
Figure 2. Gerber standards overview – https://www.ucamco.com/files/downloads/file_en/456/gerber-layer-format-specification-revision-2022-02_en.pdf?7b3ca7f0753aa2d77f5f9afe31b9f826
For further details of the gerber standards, check the link from the official Gerber Layer Format Specification available at the following link:
https://www.ucamco.com/files/downloads/file_en/456/gerber-layer-format-specification-revision-2022-02_en.pdf?7b3ca7f0753aa2d77f5f9afe31b9f826.
Rules to avoid PCB manufacturing issues
Now that we know the details of gerber standards, we still need to take care in the design phase to minimize potential errors.
Here are our top rules to follow:
Always include a board outline in a mechanical layer. It is often used to align all other layers.
Do not scale data, keep it on a 1:1 scale.
Make sure all gerber layers and drill data have the same offset from the origin of the coordinate system.
Do not use zero-size apertures.
Use the same units in your CAD software as in the gerber and NC drill output files to avoid conversion and rounding errors.
Use the same resolution for gerber and NC drill files to allow a perfect match. Use the highest resolution available in the CAD software.
Make sure no layers are mirrored. Every layer needs to be exported as it is seen from the same perspective (for example, looking from top to bottom through PCB).
An Example
Recently, we received a PCB that did not match the gerber files. Of course, this raised some questions. What was wrong is that on the bottom of the PCB, two round pads were covered with a solder mask, although gerbers specified them to be exposed. The first thing we tried was to upload the gerber files to the PCB manufacturers’ online gerber viewer. To our surprise the pads were not exposed, meaning the factory made the PCB exactly as it was displayed in their online gerber viewer. The difference can be seen in the following pictures.
The left picture shows pads as they are seen in Altium Designers’ 3D view and the right one shows the online gerber view of the PCB fab’s online gerber viewer. From the current findings about gerber standards we know that even if the PCB fab uses a different gerber format, it wouldn’t be a problem since they are all compatible. Eventually, we noticed that this part of the board was different in the way that pads and solder masks were manually expanded by adding arcs which was not correctly interpreted by an online viewer. To be precise, the solder mask opening was not interpreted correctly. After reading through PCB manufacturers’ specifications, the suggested fix was to modify the Gerber setup configuration in the Altium Designer and to enable the advanced option called Use software arcs. To fully understand why this could help to solve the issue, we’ve created and inspected gerber files, of a simple board that had just one of those manually created pads generated, with the use software arcs option being enabled and disabled and checked the bottom solder layer.
The gerber file without the Use software arcs feature enabled looked like this:
G04 Layer_Color=16711935*
Comment
%FSLAX25Y25*%
Format specification: Leading zeroes omitted; Absolute coordinates; Coordinates in 2 integer and 6 fractional digits.
%MOIN*%
The file units are set to inches.
G70*
Set units to inches.
G01*
Set mode to linear.
G75*
Must be called before creating the first arc.
%ADD11O,0.13386X0.11811*%
This is the critical line where the aperture is defined. Aperture name is D11 and it’s type is oval/obround (O) with the X value of 0.13386 and Y value of 0.11811.
D11*
Previously defined aperture is called.
X84646Y118110D02*
Current point is moved to the specified X-Y location.
G03*
Set mode to counterclockwise circular.
X84646Y118110I-5906J0D01*
Aperture D11 is used to draw a circle.
G01*
Set mode to linear.
M02*
End of the file.
The gerber file with Use software arcs enabled has a significantly increased number of commands. The reason behind it is that all apertures are approximated with lines. The downside is a lower accuracy and resolution, but the main advantage is ensuring compatibility with older versions of CAM (computer-aided manufacturing) software. CAMs are used by PCB factories to generate manufacturing data from gerber files and if those are outdated, they can misinterpret complex apertures. In our example, the oval aperture shape was not correctly processed.
With the findings regarding the Use software arcs option, original gerbers were regenerated with the option enabled. The following picture shows the view from PCB fabs’ online viewer.
The result is that the issue has been resolved and gerbers are now properly interpreted.
The important takeaway is to always check the gerbers in PCB fabs’ online gerber viewer. If complex apertures are not correctly read, or if the gerber viewer is not available, make sure to enable the software arcs feature.
Conclusion
The modern world would not be the same without PCBs and a huge part, in the early days of standardization in the field, had Joe Gerber, often described as Thomas Edison of manufacturing. We’ve learned that each new iteration of the Gerber standard added more information about the board to minimize potential communication misunderstandings between the designers and manufacturers to save time and money for both parties.
Finally, we’ve mentioned some rules to follow to minimize potential bugs and seen that manufacturers’ specifications should be checked in detail, as well as how gerber files are interpreted by their gerber viewer to avoid mistakes in production.