Skip to content

Commit afe3c02

Browse files
committed
fix diodes parsing, fix mcp4728p/n
1 parent 2d05a1b commit afe3c02

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

edg/jlcparts/JlcPartsDiode.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ def _entry_to_table_row(cls, row_dict: Dict[PartsTableColumn, Any], filename: st
2020

2121
row_dict[cls.VOLTAGE_RATING] = Range.zero_to_upper(PartParserUtil.parse_value(
2222
attributes.get("Reverse voltage (vr)", str), 'V'))
23-
row_dict[cls.CURRENT_RATING] = Range.zero_to_upper(PartParserUtil.parse_value(
24-
attributes.get("Average rectified current (io)", str), 'A'))
2523
row_dict[cls.FORWARD_VOLTAGE] = Range.zero_to_upper(PartParserUtil.parse_value(
2624
attributes.get("Forward voltage (vf@if)", str).split('@')[0], 'V'))
25+
if "Average rectified current (io)" in attributes:
26+
row_dict[cls.CURRENT_RATING] = Range.zero_to_upper(PartParserUtil.parse_value(
27+
attributes.get("Average rectified current (io)", str), 'A'))
28+
elif "Rectified current" in attributes: # different key for some files
29+
row_dict[cls.CURRENT_RATING] = Range.zero_to_upper(PartParserUtil.parse_value(
30+
attributes.get("Rectified current", str), 'A'))
31+
else:
32+
raise KeyError("no current rating")
2733

2834
try: # sometimes '-'
2935
reverse_recovery = Range.exact(PartParserUtil.parse_value(
@@ -36,7 +42,7 @@ def _entry_to_table_row(cls, row_dict: Dict[PartsTableColumn, Any], filename: st
3642
row_dict[cls.REVERSE_RECOVERY] = reverse_recovery
3743

3844
return row_dict
39-
except (KeyError, TypeError, PartParserUtil.ParseError):
45+
except (KeyError, TypeError, PartParserUtil.ParseError) as e:
4046
return None
4147

4248

edg/parts/DacI2c_Mcp4728.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def generate(self) -> None:
5454
'9': self.vout3,
5555
'10': self.vss,
5656
},
57-
mfr='Microchip Technology', part='MCP4728-E/UN',
57+
mfr='Microchip Technology', part='MCP4728T-E/UN',
5858
datasheet='https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/22187E.pdf'
5959
)
60-
self.assign(self.lcsc_part, 'C108207')
60+
self.assign(self.lcsc_part, 'C478093')
6161
self.assign(self.actual_basic_part, False)
6262

6363

edg/parts/JlcDiode.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ class JlcBaseDiode:
99
PACKAGE_FOOTPRINT_MAP = {
1010
'LL-34': 'Diode_SMD:D_MiniMELF',
1111
'SOD-123': 'Diode_SMD:D_SOD-123',
12+
'SOD-123F': 'Diode_SMD:D_SOD-123',
1213
'SOD-323': 'Diode_SMD:D_SOD-323',
14+
'DO-214AC(SMA)': 'Diode_SMD:D_SMA',
1315
'SMA,DO-214AC': 'Diode_SMD:D_SMA',
16+
'SMA(DO-214AC)': 'Diode_SMD:D_SMA',
1417
'SMA': 'Diode_SMD:D_SMA',
1518
'SMAF': 'Diode_SMD:D_SMA', # footprint compatible even if not the same package
1619
'SMB,DO-214AA': 'Diode_SMD:D_SMB',
20+
'SMB': 'Diode_SMD:D_SMB',
1721
'SMC,DO-214AB': 'Diode_SMD:D_SMC',
22+
'SMC': 'Diode_SMD:D_SMC',
1823
}
1924

2025

examples/test_usb_source_measure.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -917,11 +917,9 @@ def refinements(self) -> Refinements:
917917
(['conv', 'power_path', 'in_cap', 'cap', 'voltage_rating_derating'], 0.85),
918918
(['conv', 'power_path', 'out_cap', 'cap', 'exact_capacitance'], False),
919919
(['conv', 'power_path', 'out_cap', 'cap', 'voltage_rating_derating'], 0.9), # allow using a 35V cap
920-
(['conv', 'power_path', 'out_cap', 'cap', 'require_basic_part'], False), # high volt caps are rare
920+
(['conv', 'power_path', 'out_cap', 'cap', 'require_basic_part'], False),
921921
(['control', 'driver', 'cap_in2', 'cap', 'voltage_rating_derating'], 0.9),
922-
(['control', 'driver', 'cap_in2', 'cap', 'require_basic_part'], False),
923922
(['control', 'driver', 'cap_in3', 'cap', 'voltage_rating_derating'], 0.9),
924-
(['control', 'driver', 'cap_in3', 'cap', 'require_basic_part'], False),
925923
(['reg_vcontrol', 'cf', 'voltage_rating_derating'], 0.85),
926924
(['reg_vcontrol', 'power_path', 'out_cap', 'cap', 'exact_capacitance'], False),
927925
(['reg_vcontrol', 'power_path', 'out_cap', 'cap', 'voltage_rating_derating'], 0.85),
@@ -961,6 +959,13 @@ def refinements(self) -> Refinements:
961959
(['control', 'isense', 'ranges[2]', 'pwr_sw', 'ic', 'led_current_recommendation'], Range(0.002, 0.010)),
962960
(['spk_drv', 'pwr', 'current_draw'], Range(6.0e-7, 0.25)), # assume speakers will be pretty mild
963961

962+
# the basic parts in the 100kOhm range is pretty limited
963+
(['ramp', 'div', 'bottom_res', 'require_basic_part'], False),
964+
(['reg_v5', 'fb', 'div', 'top_res', 'require_basic_part'], False),
965+
(['reg_v12', 'fb', 'div', 'top_res', 'require_basic_part'], False),
966+
(['reg_vcontrol', 'fb', 'div', 'top_res', 'require_basic_part'], False),
967+
(['reg_vcontrol', 'fb', 'div', 'bottom_res', 'require_basic_part'], False),
968+
964969
# use more basic parts
965970
(['control', 'snub_c', 'cap', 'voltage_rating_derating'], 0.60), # allow use of a 50V basic part caps
966971
(['control', 'ifilt', 'c', 'voltage_rating_derating'], 0.60),
@@ -971,15 +976,22 @@ def refinements(self) -> Refinements:
971976
(['ramp', 'drv', 'gate_voltage'], Range(0.0, 10.0)), # gate max isn't parsed, but typically up to 20v
972977

973978
# reduce line items
979+
(['reg_vcontrol', 'rect', 'actual_part'], ParamValue(['reg_v12', 'rect', 'actual_part'])),
980+
(['conv', 'buck_sw', 'driver', 'boot', 'actual_part'], ParamValue(['reg_v12', 'rect', 'actual_part'])),
981+
(['conv', 'boost_sw', 'driver', 'boot', 'actual_part'], ParamValue(['reg_v12', 'rect', 'actual_part'])),
982+
(['control', 'err_source', 'diode', 'actual_part'], ParamValue(['reg_v12', 'rect', 'actual_part'])),
983+
(['control', 'err_sink', 'diode', 'actual_part'], ParamValue(['reg_v12', 'rect', 'actual_part'])),
984+
974985
(['convin_sense', 'Rs', 'res', 'res', 'part'], ParamValue(['vusb_sense', 'Rs', 'res', 'res', 'part'])),
975986
(['vusb_sense', 'Rs', 'res', 'res', 'require_basic_part'], False),
976987
(['convin_sense', 'Rs', 'res', 'res', 'require_basic_part'], False),
977988
(['reg_3v3', 'power_path', 'inductor', 'part'], ParamValue(['reg_v5', 'power_path', 'inductor', 'actual_part'])),
978989
(['reg_vcontrol', 'power_path', 'inductor', 'part'], ParamValue(['reg_v12', 'power_path', 'inductor', 'actual_part'])),
979990
(['filt_vcontroln', 'fb', 'part'], ParamValue(['dac_ferrite', 'fb', 'actual_part'])),
980-
(['prot_vusb', 'diode', 'part'], ParamValue(['control', 'tvs_p', 'kicad_value'])),
981-
(['prot_conv', 'diode', 'part'], ParamValue(['control', 'tvs_p', 'kicad_value'])),
982-
(['prot_3v3', 'diode', 'part'], ParamValue(['control', 'tvs_n', 'kicad_value'])),
991+
# the low-leakage TVS diodes aren't in the parts table, so directly insert the LCSC part
992+
(['prot_vusb', 'diode', 'lcsc_part'], ParamValue(['control', 'tvs_p', 'lcsc_part'])),
993+
(['prot_conv', 'diode', 'lcsc_part'], ParamValue(['control', 'tvs_p', 'lcsc_part'])),
994+
(['prot_3v3', 'diode', 'lcsc_part'], ParamValue(['control', 'tvs_n', 'lcsc_part'])), # note, 5v zener diode
983995

984996
# out of stock / unassembleable parts
985997
(['conv', 'power_path', 'out_cap', 'cap', 'part'], "C3216X5R1V226MTJ00E"),

0 commit comments

Comments
 (0)