Author Topic: Pcbnew Footprint Wizard - QFN troubles  (Read 3381 times)

0 Members and 1 Guest are viewing this topic.

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Pcbnew Footprint Wizard - QFN troubles
« on: April 16, 2019, 08:49:42 am »
Hiho,

I'm trying to make a footprint for an IS31FL3736 QFN40 LED driver. None of the footprints from the Kicad library really fit, the land pattern in the datasheet requests 0.22mm wide pads of 0,715mm length and a center pad with 3.4mm length. Package is 5mm square, pad pitch is 0.4mm. When I enter these numbers into the QFN wizard, I get an unusable footprint. The corner pads are always touching and are way too close to the center pad. Can someone help me out finding the right values to enter?

Best regards
Matthias
Everybody likes gadgets. Until they try to make them.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: nl
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #1 on: April 16, 2019, 12:12:27 pm »
In KiCad's default libraries (V5.1) there is a:

Package_DFN_QFN / QFN-40-1EP_5x5mm_P0.4mm_EP3.6x3.6mm
and this seems to be quite near to your dimensions.

I had a peek at:
http://www.issi.com/WW/pdf/31FL3736.pdf
But that datasheet does not have much info on package size and land patterns, and I do not feel much for hunting for a datasheet with a land pattern of your specifications.

Then I punched in your numbers in the Footprint Wizard and understood better wat you meant, I also got overlapping pads in the corners.
The Footprint wizard for QFN uses the center of the pad for it's calculations, and if the pads are "too long" then you get overlap in the center.
So I started playing a bit with the settings of the Footprint Wizard, which is very easy, because every time you enter a value you get live feetback of the generated footprint.

In the end, instead of making the outside of the package 5*5mm, I generated the footprint for a package of 5.6mm * 5.6mm. This shifts all the pads 0.3mm to the outside, and they do not overlap anymore.

Note that there are 3 sets of parameters you can enter. On the left of the screenshot there are:
"Pads", for dimension of te pads themself.
"EPad", for the center pad.
"Package", for the dimensions of the package itself.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: nl
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #2 on: April 16, 2019, 12:37:02 pm »
I experimented a bit more, and there seems to be an error in the generation of the pads in the Footprint Wizard for QFN.
I made it generate another QFN40, with very narrow pads this time, and after generating it you see that (again) the pads overlap in the corners.
I used your length for the pad length (0.715mm), but when I measure the actual pad length it is more than a mm long.

[Edit]
I experimented a bit more, and discovered that the value for "fillet" is added to the length of the pads.
"Fillet" is a setting for the corner radius of rectangular pads and this is new in KiCad V5. It seems that the Footprint Wizard has not been updated properly to work with these pads.

The Footprint wizards are also only a start for generating custom packages. Once a footprint is generated, you can edit everything in the Footprint Editor. It's for example easy to move a row of pads an exact distance by first draggig a box around your row of pads, then click the right mouse button for the context menu and select "Move Exactly... [Ctrl +M]" from the context menu and punch in some numbers for the distance you want to move your selected block.

A small note about library management:
KiCads libraries are normally Read only, and you should not change that. If you want to use custom footprints, then first make a library for your own, and put your custom symbols in your custom library.
« Last Edit: April 16, 2019, 01:37:32 pm by Doctorandus_P »
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: nl
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #3 on: April 16, 2019, 01:31:12 pm »
Me Again.

I wanted to know if the pad size errors also occured in other footprints, so I experimented a bit more with other footprints wizards, and the QFN seems the only affected.

You can also use the QFP wizard to generate your QFN package. For the QFP wizard pad sizes and locations are handled as separate parameters.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #4 on: April 16, 2019, 05:51:44 pm »
I experimented a bit as well and I think I understand fillet and length now. Length and fillet join at the package border, so the full pad length is fillet + length, and length is just what is inside the package outline. I can now calculate these values and generate a correct footprint that matches the land pattern in the data sheet, without messing with the package dimensions.
I will update the thread when I get back to the PC.

Gesendet von meinem Nokia 6.1 mit Tapatalk

Everybody likes gadgets. Until they try to make them.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: nl
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #5 on: April 16, 2019, 06:07:38 pm »
There was a change in the way pads are defined between KiCad V4 and V5.
The fillets for rounded corners of pads have been added in V5 and it seems that the footprint wizards have not been updated for this change.
You can see that the QFN library parts have rounded corners, but you can not draw these with the QFN Library Wizard.

I will look into writing a bug report for this.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #6 on: April 16, 2019, 08:07:22 pm »
"Fillet" is not corner rounding. The wizard doesn't allow specifying that at all. The "solder fillet" is basically the alloy forming the joint between the contact and pad. I'm assuming that the QFN wizard allows specifying a separate parameter for the part of the pad outside of the package perimeter, to achieve an acceptable solder fillet between pad and contact. This is notoriously hard to achieve with QFN especially for fine pitch components <= 0.5mm.

I've attached the land pattern for the IS31FL3736, the calculation for pad length and fillet parameters, for 5mm package size:

length = (5-4.1)/2
fillet = 0,715 - length

length = 0,45
fillet = 0,265

These parameters reproduce the land pattern from the data sheet.
Everybody likes gadgets. Until they try to make them.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: nl
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #7 on: April 17, 2019, 01:54:30 pm »
It's 2 different kind of "fillets"

"Fillet" is also used for the roundings formerd by the soldifiie-ing solder.
This depends for a lagre part on the stencil thickness and the amount of solder, and KiCad has no knowledge of these parameters.

In technical drawings the term "fillet" is used for rounded corners. I just had a look at the Footprint Editor in Kicad, and there rounded pads are apparently defined still differently. ("Corner size" as a persentage of the pad widht).

But it does not matter much.
The more important thing is that I dropped a message yesterday on the KiCad forum, and apparently a pull request for a fix is available on github.

https://github.com/KiCad/kicad-source-mirror/commit/68e6308066a3bd0a4fcbf6aae8c4869d075aae3e

On my PC the Python code for the wizard is in:
/usr/share/kicad/scripting/plugins/qfn_wizard.py

I'm a total noob with Python, but I was curious, so I modified the python script by hand (guided by the patch suggestion), then compiled it with info I found on:
https://askubuntu.com/questions/324871/how-to-compile-a-python-file

and I copied the output to:
/usr/share/kicad/scripting/plugins/__pycache__/qfn_wizard.cpython-37.pyc

Then I started KiCad, and "fillet" has indeed been renamed to "offset", and pad length seems correct and offset moves the pas more to the outside.

It was pretty easy to do, even for a total Python Noob such as me. I do not know however how long it takes before the change is available in the official KiCad release.

I am very impressed by the quick response of the KiCad developers. I've seen it before that small fixes like this get fixed within a few days.


Some notes:
I always get confused by Python 2 and Python 3, and I may have compiled it wrongly...
Those scripts are in a readonly directory, which makes it a bit harder to modify. (Rightly so).
Make backups of the original files before changing anything. I like to prepend the original file with a date in ISO6801 format:
> cp qfn_wizard.py 2019-04-17_qfn_wizard.py

The official Footprints for QFN packages have rounded corners. These are also generated from scripts, but they use a different script then the Footprint Wizards.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #8 on: April 17, 2019, 02:08:51 pm »
Hey, that looks really quite interesting. I'll have to try that patch and see what difference it makes.

Thanks a lot for taking the time to help me!
 :-+
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #9 on: April 17, 2019, 02:39:08 pm »
Alright, checked the patch, but I'm not happy with it. The offset parameter is applied incorrectly, it actually moves the pads outwards by "offset/2", which is just ... un-intuitive?

It'd be much better to compute it like this:

        h_pitch = h_pitch / 2 - pad_length + pad_length/2 + pad_offset
        v_pitch = v_pitch / 2 - pad_length + pad_length/2 + pad_offset

The patch you mentioned went into the master branch 8 hours ago, so it will be part of one of the next releases, I guess. I'll comment on it so that it possibly gets fixed. Like this, it's just as convoluted as before.
Everybody likes gadgets. Until they try to make them.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: nl
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #10 on: April 17, 2019, 03:22:29 pm »
Your solution does indeed look more logical to me.

The most important thing is though that with this patch you can move the pads without hacking the component outline as I suggested earlier. It's also good to know that such Wizard scripts can be easily edited if you want a custom Wizard for some reason, without having to do much with the rest of KiCad. Understanding 150 lines of Python (without the comment, empty lines) is pretty doable, (but still an unwanted distraction when your goald is just to have a footprint).

A better solution is probably to start with having a look at the scripts that generate the official KiCad's libraries.
I am thinking along the lines of splitting such scripts in 2. One of the scripts could then double as the "Footprint Wizard", while the other script has some tables for number of pads and sizes and does the file handling to generate the library files.
Something like that would require more effort.

I might dive into this myself, I've always been a bit curious about Python, and I noticed that protocol decoders for Sigrok / Pulseview are also written in Python.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Pcbnew Footprint Wizard - QFN troubles
« Reply #11 on: April 29, 2019, 12:31:50 pm »
Looks like the suggested fix went into the repository 12 days ago  :-+
Everybody likes gadgets. Until they try to make them.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf