Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Allow custom numbering scheme in PadArray and QFN scripts #371

Merged
merged 2 commits into from
Jan 5, 2020

Conversation

rnd2
Copy link
Contributor

@rnd2 rnd2 commented Jun 7, 2019

Custom pin numbers for the pad array can be passed to PadArray
as a list through the keyword argument pad_numbers.
This bypasses the increment functionality.

Additonally, add the ability to define custom pin numbers per side on a QFN
package, as some packages use a non-standard numbering scheme.

This is needed for KiCad/kicad-footprints#1553 and it seems that there is also related issues (#323, #280)

As an example, here is the definition from the pull request mentioned above using the changes I suggest. Notice the EP_pin_number for the exposed pad and pad_numbers_{top,right,left,bottom}

Texas_X2SON-4-1EP_1.1x1.4mm_P0.5mm_EP0.8x0.6mm:
  device_type: 'X2SON'
  library: Package_SON
  manufacturer: 'Texas'
  #part_number: 'mpn'
  size_source: 'http://www.ti.com/lit/ds/symlink/drv5032.pdf#page=28'
  ipc_class: 'qfn' #'qfn' | 'qfn_pull_back'
  #ipc_density: 'least' #overwrite global value for this device. (if used, pad values are closer to TI's suggested fp)

  body_size_x:
    minimum: 1.05
    maximum: 1.15
  body_size_y:
    minimum: 1.35
    maximum: 1.45
  overall_height:
    maximum: 0.4

  lead_width:
    minimum: 0.17
    maximum: 0.27
  lead_len:
    minimum: 0.15
    maximum: 0.25

  EP_size_x:
    nominal: 0.8
    tolerance: 0.05
  EP_size_y:
    nominal: 0.6
    tolerance: 0.05
  # EP_paste_coverage: 0.65
  EP_num_paste_pads: 1 #[2, 2]
  EP_pin_number: 5

  pitch: 0.5
  num_pins_x: 2
  num_pins_y: 0
  #include_suffix_in_3dpath: 'False'
  #include_pad_size: 'fp_name_only' # 'both' | 'none' (default)

  pad_numbers_top: [1, 4] # left to right
  #pad_numbers_right: [5, 6] # top to bottom
  pad_numbers_bottom: [2, 3] # left to right
  #pad_numbers_left: [8, 7] # top to bottom

  thermal_vias:
    count: 1
    drill: 0.2
    # min_annular_ring: 0.15
    paste_via_clearance: 0.1
    EP_num_paste_pads: 1 # [2, 2]
    EP_paste_coverage: 0.75
    grid: [1, 1]
    paste_avoid_via: False

And the resulting footprint:

DMR004A_script_fp3

Edit: Add related issue

@codeclimate
Copy link

codeclimate bot commented Jun 7, 2019

Code Climate has analyzed commit daa4e69 and detected 0 issues on this pull request.

View more on Code Climate.

@tolot27
Copy link

tolot27 commented Jun 7, 2019

I recommend checking for duplicates and in case of (consecutive) numbers for gaps. If such occurs, a warning is the minimum.

@rnd2
Copy link
Contributor Author

rnd2 commented Jun 7, 2019

I recommend checking for duplicates and in case of (consecutive) numbers for gaps. If such occurs, a warning is the minimum.

That sounds like a good idea. Probably a warning is the best approach, as there might be some packages which reuse pin numbers.

@poeschlr poeschlr self-assigned this Sep 27, 2019
@poeschlr
Copy link
Collaborator

Using an array to get the pin numbers into the array function feels a bit non pythonic. My guess is that it must work with generator functions. I will get back to you when i am not as tired as today. (If it takes more than a few weeks then ping me.)

pad_numbers = [self.initialPin] * self.pincount
elif type(self.increment) == int:
pad_numbers = range(self.initialPin, self.initialPin + (self.pincount * self.increment), self.increment)
elif callable(self.increment):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this as an entry point for custom pin-number generator functions

@rnd2
Copy link
Contributor Author

rnd2 commented Sep 29, 2019

When you say generator functions I believe you don't just mean to use a python generator (i.e. yield), but actually define pin-number generator functions for the most common uses cases and use the total pin number as the function's input.

And I guess these functions can be plugged to callable(self.increment) (see comment).

Does this sound right?

@rnd2 rnd2 force-pushed the support-custom-pad-numbers branch 2 times, most recently from 1f5f73c to ff6e1b3 Compare December 7, 2019 18:47
@rnd2
Copy link
Contributor Author

rnd2 commented Dec 7, 2019

With the latest changes, the definiton for DMR4000 will be:

Texas_X2SON-4-1EP_1.1x1.4mm_P0.5mm_EP0.8x0.6mm:
  device_type: 'X2SON'
  library: Package_SON
  manufacturer: 'Texas'
  #part_number: 'mpn'
  size_source: 'http://www.ti.com/lit/ds/symlink/drv5032.pdf#page=28'
  ipc_class: 'qfn' #'qfn' | 'qfn_pull_back'
  #ipc_density: 'least' #overwrite global value for this device. (if used, pad values are closer to TI's suggested fp)

  body_size_x:
    minimum: 1.05
    maximum: 1.15
  body_size_y:
    minimum: 1.35
    maximum: 1.45
  overall_height:
    maximum: 0.4

  lead_width:
    minimum: 0.17
    maximum: 0.27
  lead_len:
    minimum: 0.15
    maximum: 0.25

  EP_size_x:
    nominal: 0.8
    tolerance: 0.05
  EP_size_y:
    nominal: 0.6
    tolerance: 0.05
  # EP_paste_coverage: 0.65
  EP_num_paste_pads: 1 #[2, 2]
  EP_pin_number: 5

  pitch: 0.5
  num_pins_x: 2
  num_pins_y: 0
  #include_suffix_in_3dpath: 'False'
  #include_pad_size: 'fp_name_only' # 'both' | 'none' (default)

###### Custom pad numbering #####
  pad_numbers:
    generator: 'ccw_dual'
    axis: 'x'
###############################

  thermal_vias:
    count: 1
    drill: 0.2
    # min_annular_ring: 0.15
    paste_via_clearance: 0.1
    EP_num_paste_pads: 1 # [2, 2]
    EP_paste_coverage: 0.75
    grid: [1, 1]
    paste_avoid_via: False

@poeschlr
Copy link
Collaborator

@pointhi this looks good to me have you any input?

@pointhi
Copy link
Owner

pointhi commented Dec 28, 2019

@poeschlr I'm okay with this

rnd2 added 2 commits December 28, 2019 14:49
Custom pin numbers for the exposed pad can be passed
through the keyword argument EP_pin_number.
If not defined the EP number is pincount+1.
Adds the ability to define custom pin numbers per side on a QFN
package, as some packages use a non-standard numbering scheme.
This commit adds python iterators to use for incrementing the pin numbers.

To use the generators the key `pad_numbers` must be present on the package.
@rnd2 rnd2 force-pushed the support-custom-pad-numbers branch from ff6e1b3 to daa4e69 Compare December 28, 2019 15:38
@rnd2
Copy link
Contributor Author

rnd2 commented Dec 28, 2019

@pointhi When you merge this I will make a PR for the definition neeeded for KiCad/kicad-footprints#1553.

@poeschlr
Copy link
Collaborator

poeschlr commented Jan 5, 2020

As @pointhi gave the ok i assume i am ok with merging this. Thanks

@poeschlr poeschlr merged commit d88a9cf into pointhi:master Jan 5, 2020
@poeschlr poeschlr removed the question label Jan 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants