Apologies from atommann (an engineer from JLCPCB), about Gerber X2 files at JLCPCB

I am not saying you are a salesman, only that you sound like one.

But regardless, I apologize. You are right, no one should care who you are or what you do.

1 Like

Notes from jp who maintains the kicad gerber implementation and gets involved with UCAMCO who writes the spec.

2 Likes

Today I collected some information about the defective boards I see recently. I think these are not all of them.

Case 1
2020-12-05
Defect: Traces on top and bottom layers are missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.8)-1*%

Case 2
2020-12-09
Defect: Traces on top and bottom layers are missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.6)-1*%

Case 3
2020-12-07
Defect: Traces on top and bottom layers are missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.7)-1*%

Case 4
2020-12-29
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-7681-ge37a89cdbf)*%
%AMRoundRect*

Case 5
2021-01-03
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,5.99.0-unknown-e48f2a70fe~106~ubuntu20.04.1*%
%AMRoundRect*

Case 6
2020-12-31
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,5.99.0-unknown-81d4e06f00~106~ubuntu20.04.1*%
%AMRoundRect*

Case 7
2020-12-05
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,5.99.0-unknown-1a9878d6d~106~ubuntu18.04.1*%
%AMRoundRect*

Case 8
2020-12-24
Defect: Bottom silkscreen is missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-6667-gfc6fc88219)*%

case 9
2020-12-24
Defect: Some pads' soldermask were lost
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.6)-1*%

case 10
2020-12-23
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-7551-ge9817932e0)*%

We can see all of them are Gerber X2 files.

Because the RoundRect macro is still new (maybe it was introduced two months ago?), so we can see not so many boards are affected.

1 Like

This is a useful thread. I do not want to see more personal attacks or rudeness :policeman:

8 Likes

@atommann, Here’s a set of gerbers plotted with different settings in the latest Kicad 5.99 (8244-g9424d66d22). KiCad 5.99 generates different kinds of special shapes with aperture macros by default. I have plotted them with and without x2 and aperture macros. This is the set of pad shapes:

Here are the gerber files: gerber.zip (37.1 KB)

Can you send back the same set processed by your default process?

Here’s the whole project for reference: Flashpads.zip (329.6 KB)

2 Likes

The reason why I didn’t mentioned Configuration #3 and #4 is related to how engineers process X2 files at JLCPCB.

Configuration #3
[X]Use X2 format
[ ] Disable macro

Configuration #4
[X]Use X2 format
[X] Disable macro

As I mentioned in JLCPCB - strange issue with rounded rectangle pads + kicad nightly, the CAM-A is the main tool, it can not import Gerber X2 files at all (Honestly I did not used CAM-A, but other people always told me this, I’ll try myself once I got a chance). Now the engineer finds that he cannot import files into CAM-A, what he’s going to do? The answer is he has a secondary CAM which is CAM-B. CAM-B can read X2 files but it can not do the job right every time.

Configuration #1
[ ]Use X2 format
[ ] Disable macro

CAM-A shows the RoundRect macro correctly in my test before, so #1 may work too for KiCad 5.99. Why I chose #2 is because lots of CAM and Gerber readers have problem with aperture macros as lots of people already mentioned in this and other threads.

1 Like

Thank you very much for the test files. I’ll post the processed files back when they are done.

These custom polygons remind me another issue related to aperture macros (basically some Eagle users are affected): https://www.eevblog.com/forum/manufacture/jlc-pcb-reorientation-of-octagonal-pads/

Kinda off-topic: The author of Horizon EDA sent me files to test the Aperture Macros, I made 5 physical copies myself, and I felt lucky that I got the defective boards (because that’s what I expected :slight_smile:

I found that Gerbv can convert Gerber X2 to RS-274X file easily: Just open the file, Ctrl+s to save the active layer, then the file will be converted.

The contents of RoundRect macro from KiCad 5.99:

G04 Aperture macros list*
%AMRoundRect*
0 Rectangle with rounded corners*
0 $1 Rounding radius*
0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*
0 Add a 4 corners polygon primitive as box body*
4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*
0 Add four circle primitives for the rounded corners*
1,1,$1+$1,$2,$3,0*
1,1,$1+$1,$4,$5,0*
1,1,$1+$1,$6,$7,0*
1,1,$1+$1,$8,$9,0*
0 Add four rect primitives between the rounded corners*
20,1,$1+$1,$2,$3,$4,$5,0*
20,1,$1+$1,$4,$5,$6,$7,0*
20,1,$1+$1,$6,$7,$8,$9,0*
20,1,$1+$1,$8,$9,$2,$3,0*%
G04 Aperture macros list end*

And this is the converted Aperture Macro by Gerbv:

%AMMACRO12*
4,1,4,0.013223,0.001044,0.001044,0.013223,-0.013223,-0.001044,-0.001044,-0.013223,0.013223,0.001044,0.000000*
1,1,0.017224,0.013223,0.001044*
1,1,0.017224,0.001044,0.013223*
1,1,0.017224,-0.013223,-0.001044*
1,1,0.017224,-0.001044,-0.013223*
20,1,0.017224,0.013223,0.001044,0.001044,0.013223,0.000000*
20,1,0.017224,0.001044,0.013223,-0.013223,-0.001044,0.000000*
20,1,0.017224,-0.013223,-0.001044,-0.001044,-0.013223,0.000000*
20,1,0.017224,-0.001044,-0.013223,0.013223,0.001044,0.000000*
%

What’s the difference? Looks like only the parameters are replaced with the real numbers.

I noticed circles (aperture macro primitive code 1) in RoundRect has 5 parameters (the 5th is rotation) but in MACRO12 it has 4 parameters. In Gerber Aperture Macros are hard for everyone, Lukas mentioned the extra rotation parameter for circles crashed CAM350 at Seeedstudio.

I’m also curious:

  1. Why traces are lost for some Gerber X2 files but most of them are OK?
  2. Why only two rounded corner are missing and other twos are kept for the rounded rectangle pads?

Regarding the 2nd question, I want to test CAM-B without the 5th parameter for circles.

EDIT on 2021-01-11

I tested how the 5th parameter will affect CAM-B, the result can be found here:

As a child I used ballpoint refill with the ball removed to paint my PCBs and then I etched them in iron trichloride.
That worked, but I don’t regret that I joined the modernization crusade and stared to use IBM-XT with 640k RAM and without HDD to design my PCBs. That needed frequently swapping 320kB diskettes in drive B: (in A: there were the main Racal-Redac diskette not needed to be swapped).
That worked, but I don’t regret that I joined the modernization crusade and started to use for PCB designs the PC with HDD. I used to plot my PCBs at the back sides of cards from a large wall calendar (in 2:1 scale), then to order the photocopy of it and go with that photographic plates to small (those time) PCB manufacturing factory.
That worked, but I don’t regret that I joined the modernization crusade and started to replace my own plotting with sending the gerber files directly to that PCB manufacturing factory as soon as they purchased a photoplotter.
And so on…

5 Likes

I am afraid there is a mix between aperture macros and the (new) X2 format.

Aperture macros are a old feature of RS274X format an are not related to X2 format.
Aperture macros are used to describe a “complex” pad shape from more basic shapes (primitives).
Pads need usually to be flashed, therefore need a shape that is not painted, but drawn all in once.
This is due to the fact pad shapes are also used in post processing in CAM tools (tests, solder mask creation …)
Aperture macros can be defined by a set of primitives (circle, rect …) having a defined size, or having a size defined by variables (notation: $1 $2 …)
When shapes are defined by variable, only one aperture macro is needed by a shape (for instance round rect shape)
When shapes are defined by absolute values, one aperture macro is needed by a pad with a given size.
So one can have a lot of one aperture macros. This is obviously not a good idea.

By the way, Gerbv (not the Kicad Gerbview) does not handle correctly aperture macro rotations, like unfortunately many other Gerber viewers although this parameter is described in Gerber doc since at least 10 years)
(This is the reason Pcbnew does not use (unfortunately) rotated complex aperture macros).

X2 format is an other thing (having nothing to do with apertures):
X2 format adds metadata to Gerber files:

  • Identification of files (type of layers: copper, layer, silk screen) that avoid the ridiculous used of non standard protel extensions.
  • Net info: needed for CAM tools to automatically test the board.
    It is also used in the Kicad Gerber viewer: one can highlight a net, or all pads of a component for instance. Just this feature is enough to use the X2 format.

Note also one can create Gerber drill files and Gerber pick and place files (known as X3 extension)
At least they are correctly defined in Gerber file format.

This is not the case of Excellon drill files (no actual format defined) and not the case of P&P files.

6 Likes

Which is fair enough, except all indications are this is an Aperture macro parsing problem and not an X2 parsing problem. As others have said, X2 doesn’t change pad information, it’s the complete fabrication information since now the layer order is encoded rather than relying on interpretation of the filenames

Now CAM-A not loading X2 (rather than raising warning on the additional commented content) is a CAM vendor concern since if you have an X2 parsing problem then you have a serious X1 parsing problem

The good news is the 1st step in resolving a problem is understanding there is a problem

3 Likes

Maybe KiCAD should have a CAM350 compatibility downgrade selector for the low cost fabs?

What you mentioned I guess is aperture macro primitive Center Line (code 21), Gerbv can handle it correctly since a specific version (I don’t know when).

In a CAM tool I know, there’s a configuration parameter controls how Center Line will be rotated:

  • No (default) - Rotate aperture macro primitive around it’s center point
  • Yes - rotate around the 0;0

If this parameters is set to “Yes”, which will comply with Gerber spec. If set to “No”, Center Line will rotate around its own geometry center which is wrong (and this is the default!).

I’ve had the X2 attribute issue with a number of fabs, including domestic (US) fabs like Advanced Circuits (although that was when I first tried the X2 option in early 2019. They may be able to work with these files now.)

After being notified of issues by the vendor I went back to the X1 format and have been using this since.

My workflow includes a quick check of the gerber files in Gerbv version 2.6A. I’ve found that if Gerbv opens it without error and it looks normal, none of the vendors I work with will have issues.

I plotted a copper layer of a board I have been working on recently, designed in the latest nightlies, that I know will successfully generate X1 gerbers. If I plot X2, I received the following errors in Gerbv:

image

I understand this version of Gerbv is probably 10 years old but it has always been a good representation of vendor capability.

I find that to be VERY interesting… I JUST got my second order in from JLCPCB the other day… a 2-layer and a 4-layer board. I used X2 Gerber option (5.1.6), and aside from a cosmetic issue on one board, they all turned out okay.

Does the gEDA fork/update pcb-rnd have a gerbv style viewer?

Yes, most of the orders with X2 files are OK and this is why I said “maybe my method (ask customers to re-plot RS-274X files) is overkill”

@eelik I scaled down your test file and placed 4 real orders for the 4 different combinations in 4 different colors, need to wait for about 4 days to get the them.

  • Board size: 80x50mm.
  • Octagonal pads are added.
  • Spacing between rows is 300 mil, real DIP-18 ICs can be soldered :slight_smile:
  • Some USB connectors are added because there are some spare spaces.
  • Traces are added to test if they’ll be lost.

Here’s the modified project: Flashpads-01.zip (1.0 MB)

EDIT on 2021-01-11

@eelik, Got the processed files.

I’m kinda disappointed because I found all my order has been processed correctly. Today I contact two relevant colleagues, they said the X2 to X1 converter is already handed to some engineers (who process Gerbers). And they are evaluating this converter/preprocessor, if it’s OK then all engineers will use it.

If you are careful enough you can find traces/evidences which shows my files are preprocessed before they were imported into the CAM tool.

For example, for Y91 (x2ap) in the file in ok folder you can see a temp folder X1_x2ap was created:

1. Path : (File) d:/foldername/88640f_y91_x2ap/yg/x2ap/X1_x2ap/Flashpads-B_Silkscreen.gbr

In Y92 (x2noap), in the yg folder, all my original X2 files are disappeared and they are replaced the RS-274X files except Flashpads-B_Silkscreen.gbr because this file is not used (no contents on bottom soldermask).

EDIT on 2021-01-16

Add photos.

4 Likes

I sympathise with you here. I don’t see KiCad as pushing X2, but rather that X2 is the out-of-the-box default. I always turn X2 off, because the cheap fabs I use have problems with it. So, sure, their CAM software are out of date or buggy, but the fabs are the ones that need to be nagged, not me. I’m not interested in getting review bounces just for a better standard when it has no effect on my simple jobs.

Similarly I continue to use Protel extensions, even though I approve of the use of a single extension from the viewpoint of a standard not using many suffixes. Although fabs seem to do some kind of parsing that works most of the time to identify the layers.

1 Like

I’ve been using gerblook.org for final validation of my files.

In China?