Repository navigation
fix(hw): run the LED drivers from the buck, tie GNDA once and fix the photodiode polarity - #1
Merged
Merged
Conversation
Via `kicad-cli sch upgrade` / `pcb upgrade` (bread-infra scripts/upgrade_kicad10.sh). Verified lossless: identical netlist, footprint positions and routing. Note `sch upgrade` does not cascade into hierarchical sub-sheets, so every .kicad_sch is upgraded individually -- upgrading only the root sheet leaves sub-sheets on the old format, which looks migrated and is not.
KiBot's -s/--skip-pre SKIPS the named preflight, so `erc: kibot ... -s erc` skipped ERC and ran DRC, and `drc: ... -s drc` did the reverse. Both checks still ran, but every violation was reported under the wrong job name -- which is exactly what made a broken DRC look like a passing one.
KiCad's stock default severity for footprint_symbol_mismatch is `warning` (board_design_settings.cpp:189), and KiBot's DRC preflight only fails on errors. So `schematic_parity: true` ran the check and could never fail it -- a mismatch was reported on every CI run for months, buried in ~100 warnings, and every run went green. Raising it to `error` makes the parity gate real.
KiCad 10 added a Local History feature. On first save it creates <project>/.history and calls git_repository_init() on it, so the directory is a nested git repository. KiCad writes a .gitignore inside it, but that governs KiCad's own history repo -- this repo still sees an embedded repository and reports it untracked. Committing it would add a broken gitlink.
These parts exist in KiCad-Master-Lib; the boards referenced libraries that no longer exist (kml-custom, KML-Custom, and SparkFun libraries that never contained the part) or names the library has since changed. KiCad embeds footprint geometry in the .kicad_pcb, so the boards rendered and fabricated correctly and the rot stayed invisible -- it only surfaces on update-from-library, or when a generator tries to resolve a nickname. Nickname/name only. No geometry is changed: SparkFun-DiscreteSemi:AP63205 -> KMLib_IC_Power:AP63205WU-7_Buck_Regulator SparkFun-LED:WS2812-5050-4PIN -> KMLib_IC_SMD:WS2812-5050-4PIN kml-custom:DGN8_1P89X1P57 -> KMLib_IC_SMD:DGN8_1P89X1P57 kml-custom:TPS7A4901DGNR -> KMLib_IC_Power:TPS7A4901DGNR_LDO_Regulator kml-custom:Thermal Pad -> KMLib_Mounting:Thermal_Pad Only references that failed to resolve were touched. Generic parts (<=4 pins) and KiCad *-rescue libraries are deliberately excluded: fingerprint matching cannot distinguish a 2-pin resistor from a 2-pin capacitor, so those are being done by hand.
KiCad rewrites .kicad_prl on every project open -- open sheet, zoom level, selection filter. It is per-developer local state, not design intent, so tracking it means the working tree goes dirty every time anyone opens the board.
- add the validate-board job: KiCad 10 format, a real (error-severity) DRC parity gate, every library reference resolving, un-swapped Makefile targets, and .history/.kicad_prl gitignored. Green means the board is done. - run on pull_request, not just push to main. Hardware checks previously ran only AFTER a change had merged: they could report that main was broken, but never stop it from breaking. A gate that only fires post-merge is a notification, not a gate. - pin bread-infra to v1.0.0 rather than @main, so a bread-infra commit cannot silently change what this PR is gated on.
KiCad 10 adds design-block libraries and generates a design-block-lib-table alongside fp-lib-table and sym-lib-table. Like those, it holds absolute paths, so it is machine-local and generated -- never committed. Also ignores KiCad's project lock file (~<project>.kicad_pro.lck), written whenever a project is open. The existing .gitignore predates KiCad 10 and covered neither, so simply opening a board left the working tree dirty.
The library re-point renamed symbols in lib_symbols from LIB:OLD to LIB:NEW,
but a symbol's sub-units carry the bare item name:
(symbol "KMLib_IC_Power:AP63205WU-7_Buck_Regulator"
(symbol "AP63205_0_1" ...) <- still the old prefix
KiCad requires every sub-unit to be named "<parent item>_<unit>_<style>", so any
symbol whose ITEM name changed (not merely its library) failed to load:
Invalid symbol unit name prefix AP63205_0_1
Rename each sub-unit to match its parent. Nickname-only re-points were never
affected -- their item name is unchanged.
Note kicad-cli reports "Failed to load schematic" and still EXITS 0, so this was
invisible to CI and to a scripted ERC sweep. Only the GUI surfaced it.
v1.1.0 adds the schematic-load check. kicad-cli prints 'Failed to load schematic' and still exits 0, so an unloadable schematic scored as zero ERC violations -- 34 boards were unopenable while every automated check said they were fine. validate-board now runs in the KiCad container and actually loads every sheet.
config.kibot.yaml had drifted into five variants across the fleet. Three differed only in trailing comments; the two real variants are 2-layer and 4-layer. Adopts bread-infra templates/config.kibot.2-layer.yaml, chosen from the board's actual copper layer count (2). Also pins bread-infra to v1.2.0, which adds a validate-board check that a board must plot every copper layer it has.
5 of 46 tasks
The eight DF2S6.8MFS ESD diodes used kml-custom:DF2S6.8MFS_L3M, a library no project table provides. They now point at KMLib_Discrete_Semiconductors:DF2S6.8MFS_L3M_ESD-TVS_Diode, which has the same pins 1 and 2 at the same positions; the drawing is kept. The netlist is unchanged: 86 nets, 163 parts, same values and footprints. ERC stays at 0 errors.
KiCad 10 renamed Connector:Conn_01x10_Female to Connector:Conn_01x10_Socket, so the bus connector's symbol no longer resolved. It now points at Conn_01x10_Socket: the same 10 pins, and the drawing is kept. The netlist is identical. ERC trades the "not found in symbol library" warning for a lib_symbol_mismatch on the kept drawing; the error count is unchanged.
The saved GNDA fill on B.Cu sat 0.4755 and 0.4875 mm from J4 pads 1 and 2, inside the zone's 0.5 mm clearance, which KiBot's DRC reports as two errors. A refill and save with kicad-cli 10 (twice) clears them. Copper is unchanged: 333 pads, 659 segments and 93 vias, the same as sets before and after. DRC errors 2 -> 0, no new finding.
TP1-TP40 were on_board yes and in_bom yes (Keystone 5000) but none was placed, so DRC listed 40 missing footprints. Each net they mark already has an 0603, 1210 or SOIC pad to probe, and TP38/TP40 sat on the 1.5 M TIA summing nodes. The symbols stay as probe documentation, now on_board no and in_bom no. Netlist: TP1-TP40 leave the netlist with their 40 pins; no other pin changes net. ERC 0 errors (58 warnings, unchanged). DRC 0 errors; parity warnings 45 -> 5 (missing_footprint 40 -> 0).
U2, U4 and U5 (MCP6242T-E/SN, SOIC-8 on the board) used KiCad's MCP6002-xMC symbol, the DFN-8 variant with a pin 9 exposed pad on GNDA. MCP6242 datasheet DS21882D Table 3-2: the dual has pins 1-8 only in MSOP, PDIP and SOIC; the EP exists only on the single's DFN. The three now use Amplifier_Operational:MCP6002-xSN (same pins 1-8 at the same positions, so no wire moves); the embedded copy matches the KiCad library, so no lib_symbol_mismatch is added. Netlist: U2.9, U4.9 and U5.9 leave GNDA; nothing else changes net. ERC 0 errors, 58 warnings (unchanged). DRC 0 errors; parity warnings 5 -> 2 (net_conflict on U2, U4, U5 gone).
U7 (TPS7A4901) sets +5VA with R49 300k + R50 over R51 100k. With R50 = 71.5k the output was 1.185 V x (1 + 371.5k/100k) = 5.59 V, above the MCP6242's 5.5 V supply maximum (DS21882D) and above the Nano's 5 V ADC rail. With R50 = 22k 1 %: 1.185 V x (1 + 322k/100k) = 5.001 V. R51 stays 100k (<= 237k per SBVS121E). Netlist: R50 value 71.5k 1% -> 22k 1%; no pin changes net. The board footprint's value follows. ERC 0 errors (58 warnings, unchanged); DRC 0 errors, findings unchanged.
Each channel sets I_LED = DAC / RS (10 ohm), DAC from the Nano's 5 V PWM through R1/R2/R17/R18 3.3k over R3/R4/R19/R20. With 1.6k the full scale was 5 V x 1.6k/4.9k = 1.633 V, 163 mA per channel, an artefact of the 3.3 V design this came from. With 825 ohm 1 %: 5 V x 825/4125 = 1.000 V, 100 mA (divider Thevenin 660 ohm). R9-type hysteresis (200k) adds 5 V x 660/200.66k = 16 mV while the comparator is high, a fixed +1.6 mA to calibrate out. To re-check against the INL-5AMIR15 DC rating once its datasheet is on hand. Netlist: R3, R4, R19, R20 value 1.6k 1% -> 825 1%; no pin changes net. Board values follow. ERC 0 errors (58 warnings, unchanged); DRC 0 errors, findings unchanged.
Each channel's DAC node (C5/C6/C11/C12 || C7/C8/C13/C14 0.22u, fed from the 660 ohm divider) filtered the Nano's PWM with tau 0.81 ms: at 50 % duty the LED current rippled 56 mApp at 490 Hz and 31 mApp at 976 Hz. C5, C6, C11 and C12 become 10 uF X5R 10 V in the same 0603 footprint (Murata GRM188R61A106KE69D): tau 6.7 ms, 7.5 mApp at 490 Hz and 3.8 mApp at 976 Hz, settling (5 tau) in 34 ms. The node sits at <= 1.02 V (1.000 V full scale + 16 mV hysteresis term), a tenth of the rating, so DC-bias loss is small. The 0.22u parts stay. Netlist: C5, C6, C11, C12 value 1u -> 10u X5R, MPN and Datasheet fields added; no pin changes net. Board values and fields follow. ERC 0 errors (58 warnings, unchanged); DRC 0 errors, findings unchanged.
C25 (U7 input cap, 10u) and C26 (NR/SS reference filter, 10n) returned to GNDPWR, the connector return, while U7's GND pins and EPAD are GNDA. TPS7A49 (SBVS121E) wants every cap grounded directly at U7. NT2 moves to the sheet's GND label side of both caps, so C25.1 and C26.1 join U7's ground. Board: - C25.1, C26.1 and their two vias GNDPWR -> GNDA; a B.Cu GNDA zone (priority 1, x 132.9-145.9, y 78.0-92.2, notched round NT2.1) joins them to U7's six EPAD vias instead of the GNDPWR pour. - NR/SS ran C26.2 -> B.Cu hop through the GNDPWR pour (0.200 mm from +12V for 2.4 mm) -> U7.6. It is now one 4.755 mm F.Cu run on U7.6's axis; C26 moved +0.025 mm in y to line its pad up. To open the F.Cu loop that +12V made round pins 6/7, U7.8 is fed by a 2.5 mm B.Cu hop (vias at 137.3, 83.6 on the C25.2 -> U7.5 run and 137.3, 86.125). Netlist: C25.1, C26.1 GNDPWR -> GNDA; nothing else changes net. ERC 0 errors (58 warnings; one pin_to_pin pair renamed). Refilled and saved twice; DRC 0 errors, findings unchanged (166). Copper: 3 pads renetted or moved, segments 659 -> 655, vias 93 (4 changed). No pour piece without a pad or via.
GNDA reached GND only through NT2 (GNDA-GNDPWR) -> the GNDPWR pour -> J1 -> the GNDPWR trunk -> NT1, a path shared with the buck input return, and the ADC filter caps C23/C24 sat at the TIA on GNDA while the Nano's ADC reads against GND. Schematic: - The TPS7A4901 sheet's GND pin (NT2.1 only, since C25/C26 moved to GNDA) now goes to GND, so NT2 is the one GNDA-GND tie. - C23.2/C24.2 leave the sheet's analog ground for a new NANO_GND sheet pin wired to GND: the ADC sees R47/R48 10k + 0.1u to its own ground (159 Hz). Board: - NT2 moves from (139.9, 90.075) to the TIA block's west edge, (164.1, 96.0), straddling the GND/GNDA pour boundary (x 162.55 / 162.95), 7.4 mm from A1.29; vias in its pads (GND 162.1, GNDA 165.4) replace the two 1.5 mm ones. - C23 and C24 sit beside A1.19/A1.20 (x 160.2, just outside A1's courtyard at 159.36) with GND vias 1.25 mm from their ground pads. - PD2 runs west along y 94.35 across the split 0.525 mm north of NT2, a 45 (0.264 mm past NT2's corner), down x 160.2 onto C24.1 and a 45 into A1.20 (45.3 mm; was 41.6 mm, 0.206 mm from R42.1). PD1 keeps its 45 and horizontal, now through C23.1's centre into A1.19. PD1 still crosses the GNDA pour's edge near R47, not at NT2. Netlist: NT2.1 GNDPWR -> GND; C23.2, C24.2 GNDA -> GND; nothing else. ERC 0 errors, 58 warnings (one same_local_global_label now names #PWR021). Refilled and saved twice; DRC 0 errors, 166 findings, none new. Copper: segments 655 -> 650, vias 93 (4 moved/renetted). No pour piece without a pad or via.
All four LED channels drew from +5VA, U7 (TPS7A4901, 150 mA rated, ILIM 220-500 mA): 4 x 100 mA plus the op-amps, and their return crossed GNDA. The driver sheet's +5V and GND pins now go to the buck's +5V and GND (option A); U7 feeds only U5, U6 and the bias networks (about 7 mA). Netlist: +5VA -> +5V: J2-J5.2, Q1/Q3/Q5/Q7.3, R5/R7/R21/R23.2, R11/R12/R27/R28.1, U2.8, U3.3, U4.8. GNDA -> GND: C5-C16.2, D8-D11.2, R3/R4/R19/R20.2, R6/R8/R22/R24.2, RS1-RS4.2, U2.4, U3.12, U4.4. Nothing else changes net. Board: - Pours (B.Cu): one GND zone over the driver block and the south half (the old driver GNDA zone and south GND zone merged), GNDA only at the TIA (x 162.95-192.5, y 92.6-116.3) and U7's island, both priority 1. 50 pads, 110 track pieces and 20 vias renetted; 14 pieces and 3 vias removed, 29 and 5 added. - LED feed: its own 0.8 mm track from C4.2: B.Cu north 23.1 mm, F.Cu along y 93.3 / 91.5 over PWM1-4 and the +5VA/GNDA pair (34.0 mm), B.Cu 45 into the J5 trunk at (173.0, 87.1); 63.3 mm, then 18.9 mm of the existing 0.5 mm trunk to J5.2. IPC-2221 needs 0.085 mm for 0.4 A at 10 C rise on 1 oz; drop about 23 mV at 0.4 A. The Nano's 1.5 mm +5V trunk to A1.27 carries no LED current. - The driver's other +5V nodes: U3.3's via joins R27.1's via over a 0.25 mm B.Cu link, so R5/R7/R21/R23, U2-U4 and R11/R12/R27/R28 reach the trunk through the old fork via. - +5VA keeps U7 -> (150.275, 85.525) -> B.Cu y 83.975, now turning down at x 164.5 and 166.745 to R35.1; the U7 -> R23 F.Cu link is gone. Its GNDA partner (0.4 mm, 0.25 mm gap) runs from C28.1 via (151.0, 87.15) beside it into NT2's GNDA via. - U7-side GNDA on F.Cu: R51.1 to U7.4's via along y 81.1, C28.1 to a via in U7's island along y 91.0 (replacing vias in the old pour). - C11/C13/R19 ground via moved from (153.8, 85.475) to (153.6, 82.9) to clear the pair. R51 and C28 references moved off the new runs. ERC 0 errors (58 warnings, two renamed). Refilled and saved twice; DRC 0 errors, 166 findings (one renamed to GND). No pour piece without a pad or via; route bends: no 90 or acute corners.
No op-amp or comparator supply pin had a capacitor: +5VA carried only C27 (feed-forward) and C28 (LDO output), 18-33 mm away. MCP6242 DS21882D 4.4 asks 0.01-0.1 uF within 2 mm of VDD; TLV914x and LM339B want the same. Schematic: 100 nF X7R 0603 (Murata GRM188R71C104KA01D) C29 at U2, C30 at U3, C31 at U4 (+5V/GND, driver sheet), C32 at U5 and C33 at U6 (+5VA/GNDA, TIA sheet); C34 10 uF X7R 0805 (GRM21BR71A106KA73L) at the LED driver's +5V entry. Board: all six on B.Cu, where the top has no room beside the pins. - C29 1.4 mm from U2.8's via, C30 1.7 mm from U3.3's via (B.Cu stubs with a 45), ground pads in the GND pour; C29.2 connects solid (its pocket of pour left one thermal spoke). - C31 under U4's pin-8 row, fed from the U4.8 fork via (2.0 mm). - C32/C33 straight under U5.8/U6.8's vias (1.125 mm), grounds in the TIA's GNDA pour. - C34 on the LED trunk 1.5 mm after the feed joins it. Netlist: C29-C34 added (C29-C31, C34 +5V/GND; C32, C33 +5VA/GNDA); nothing else changes. ERC 0 errors (58 warnings, one renamed). Refilled and saved twice (third save identical); DRC 0 errors, 166 findings, none new. No pour piece without a pad or via.
The template's buck copper, as on AQPH (replays Slice_AQPH ddf0bb1; all 32 removed items matched exactly once here): - SW ends on U1.5's centre (1.0 mm from L1.1 to the pad's outer end, 0.6 mm into the pad); it reached the pad by its round end 0.919 mm short of the centre, 0.248 mm from U1.4 and U1.6. - +12V's lead into U1.2 is 0.6 mm and ends on the pad centre (was 0.9 mm, 0.050 mm short). - GND at U1.4: the loop, stacked verticals at x 131.15, the 0.053/0.064 mm pieces and the 0.5 mm run down x 128.75 between U1's pad rows (0.225 mm from both) are gone; U1.4 runs one 45 to the HS1 via (131.15, 121.0). Via (128.475, 124.9) held only a sliver and is removed; the via clipping C1.1 moves (131.175, 118.675) -> (131.15, 118.2); HS1 via (133.9, 126.65) -> (133.85, 126.65). - +5V C4.2 -> C3.2 -> L1.2 runs pad centre to pad centre at 1.5 mm; U1.1's 0.5 mm feed passes C2 at y 127.85 (was 127.65, 0.245 mm from C2.1). Refilled and saved twice. DRC 0 errors, 166 findings, none new. Segments 676 -> 661, vias 95 -> 94. boardwright: margin pairs 46 -> 39, micro 44 -> 42, overlaps 7 -> 5, near-miss 3 -> 1, short-of-pad 2 -> 1, via-in-pad 19 -> 18. B.Cu GND slivers 3 -> 2, each on a via.
C3 and C4 at x 133.85 put their +5V pads at x 135.325 while L1.2 is at x 135.25, so C4.2 -> C3.2 -> L1.2 needed a 0.106 mm 45 (boardwright jog); C3 sat 0.045 mm above C1, so the 1.5 mm GND bar C1.1 -> C3.1 began with a 0.064 mm 45 inside C1.1. Nudges (same rotation, no circuit change): C3 (133.85, 119.455) -> (133.775, 119.5), C4 (133.85, 116.4) -> (133.775, 116.4). +5V is one vertical on x 135.25 through every pad centre and the GND bar one horizontal from C1.1's centre to C3.1's (replays Slice_AQPH 3e6233d). The LED feed that leaves C4.2 north moves with it to x 135.25. Refilled and saved twice. DRC 0 errors, 166 findings, none new. boardwright jogs 77 -> 75; nothing new.
- GNDPWR: the trunk at x 128.65 dived into J1.5 and back out (two 45s and two overlapping 1.5 mm horizontals, 1.035 mm overlap), and J1.10 was fed by two parallel horizontals 0.085 mm apart plus a 0.12 mm piece. It is one straight trunk at x 128.7 from J1.1's 45 to NT1.2, with one horizontal tap into J1.5 and one into J1.10. - +12V: two verticals 0.075 mm apart (x 123.875 / 123.950) joined only through a hairpin at J1.9 (1.195 mm overlap) become one vertical at x 123.875 with a horizontal tap into J1.9. Replays Slice_AQPH e89a23e; all 21 removed segments matched exactly once. Refilled and saved twice. DRC 0 errors, 166 findings, none new. Segments 659 -> 649; boardwright overlaps 5 -> 3, nothing new.
A1's footprint had no pad 3 (parity: "No pad found for pin 3"), and
the F.Cu I2C runs crossed its hole site: CLK at y 102.0 and DAT at
y 102.7, both within the 1.6 mm pad at (142.61, 102.52). A standard
Nano could not be fitted, and a pin there would have touched both.
- Pad 3 is back, the shape of pad 4 one pitch up, on the schematic's
net unconnected-(A1-~{RESET}-Pad3) (pin 3 is RESET, not GND).
- CLK and DAT keep their 45s and move their passes to the centres of
the gaps: CLK y 101.25 (A1.2/A1.3), DAT y 103.79 (A1.3/A1.4).
Replays Slice_LOAD 56cfc56 (all 6 removed segments matched). Each pass
is 0.220 mm from the pads either side; the next commit narrows them.
Refilled and saved twice. DRC 0 errors; 166 -> 164 findings (A1's
net_conflict and lib_footprint_mismatch gone), nothing new.
CLK and DAT left J1 as a pair 0.200 mm apart for 20 mm (after the pad-3 fix; 26.97 mm before), with DAT's 0.97 mm exit stub, verticals at x 128.95/129.65 and passes 0.220 mm from the pads either side. Each line is now one 45 from its J1 pad centre to a centred pass across the A1 pin column, 0.25 mm wide for its 2.4 mm (CLK y 98.71 between A1.1/A1.2, DAT y 101.25 between A1.2/A1.3), and one 45 onto A1.24/A1.23; the rest stays 0.5 mm. Segments 12 -> 6. Replays Slice_LOAD 841dacd (all 12 removed segments matched). The new CLK 45 crosses where the LED feed came up to F.Cu, so the feed's via moves from (135.25, 93.3) to (137.4, 93.3) with a B.Cu 45 before it: 0.29 mm from the via to CLK; the F.Cu feed starts east of both I2C lines. Refilled and saved twice. DRC 0 errors, 164 findings, none new. boardwright margin 43 -> 38 pairs (the 0.200 mm pair and the four 0.220 mm passes gone), nothing new.
The ground vias of D9, D10 and D11 sat 0.200 mm (channels 3 and 4) and 0.288 mm (channel 2) from the PNPBJT_BASE 45s, each reached by a 0.16-0.21 mm end step. All four channels now share channel 1's layout: from D.2 a 0.4075 mm run west and a 0.566 mm 45 to a via 0.8075 mm west and 0.4 mm south of the pad. Base-to-via clearance 0.340 / 0.431 / 0.414 mm (channels 2-4; channel 1 unchanged at 0.387). DRC 0 errors, 155 findings before and after, 0 unconnected, 0 parity; zones refilled and saved twice; review: margin pairs 27 -> 25, jogs 46 -> 43.
- R44 nudged 0.1 mm north (same rotation): R44.1 is on C22.1/C20.1's y 99.55, so R44-C22-C20 is one straight run. R42.2 (y 99.25) joins it with one 0.424 mm end 45 into R44.1 (was a 0.566 45 and a 0.141 step). 3V3_2 now 0.625 mm away (was 0.238). - GNDA row: R44.2 (0603 resistor), C22.2 (0603 cap) and C20.2 (0805) can't share a y with their bias pads aligned, so each takes its own via: R44.2 straight west to its via (moved 0.2 mm onto the row), C22.2 straight north to a new via (171.8125, 96.6), C20.2 straight east to its via. The 0.495 mm GNDA jog is gone. - DAC_2 into R10.1: the 45 now ends on the pad centre; the 0.223 mm vertical stub is gone. DRC 0 errors, 155 findings before and after, 0 unconnected, 0 parity; zones refilled and saved twice; route lint 38 -> 36; review: margin pairs 25 -> 24, jogs 43 -> 40.
Two B.Cu GNDA segments, (174.005, 105.275) -> (174.005, 108.28) -> (175.225, 109.5), joined two GNDA vias that both sit inside the TIA block's B.Cu GNDA pour. The pour already joins them: after the refill each via is fully surrounded by GNDA fill (2.54 of 2.54 mm2 within 0.9 mm), and the zone is still one piece (644 mm2). DRC 0 errors, 155 findings before and after, 0 unconnected, 0 parity; zones refilled and saved twice.
The 0.8 mm F.Cu feed ran 18 mm along y 93.3, under A1's outline line at y 93.5 (copper 92.9-93.7). It now runs at y 94.25, inside the outline (copper 93.85-94.65, 0.29 mm clear of the line); it crosses the outline's two sides once each instead. - Via (137.4, 93.3) -> (138.6, 94.25): F.Cu starts east of I2C_CLK (0.467 mm); the B.Cu leg from C4.2 turns its 45 at y 97.6. - The F.Cu east end is the same 45, started 0.95 mm earlier. - A1's reference (0.8 mm) moves into the 1.46 mm gap between the feed and the pin-1 box. Side effect on the ground: the B.Cu leg's 45 now leaves a 2.9-4.4 mm strip of GND between the buck's pocket (C3/C4/NT1) and the A1.4/driver piece, so those two join directly on B.Cu (GND pieces 5 -> 4). DC solve as in the LED return change: A1.29, NT2 and C23/C24 0.13 -> 0.09 mV, A1.4 0.59 -> 0.39 mV, RS4 2.59 -> 2.36 mV. DRC 0 errors, 155 findings before and after, 0 unconnected, 0 parity; zones refilled and saved twice; route lint unchanged.
The board's "ARDUINO NANO" text (2 mm, centred at 150.22, 116.49) was crossed by the I2C_CLK and I2C_DAT 45s between the Nano rows. It is now 1.6 mm and centred at (150.22, 119.7), so it fits the clear stretch between the I2C 45s and the USB outline: on the F.Silk plot it touches no track and no other silk. Copper unchanged. DRC 0 errors, 155 findings before and after.
The sheet notes still calculated with the values the board had before R3/R4/R19/R20 went 1.6k -> 825 ohm, C5/C6/C11/C12 1 uF -> 10 uF and R50 71.5k -> 22k. Text only. LED driver sheet: - DAC output: 5 V * 1.6k / (3.3k + 1.6k) = 1.63 V -> 5 V * 825 / (3.3k + 825) = 1.000 V (+13 mV via R9 200k while the comparator output is high: 1.013 V). - Filter calc: Reff 3300 || 1600 "= 1077.55 = 1.78 Kohms" (the old 1.78k was also a slip for 1.08k), Ctot 1.22 uF, tau 2.17 ms, fc 73.3 Hz -> Reff 3300 || 825 = 660 ohm (658 ohm with R9), Ctot 10 uF + 0.22 uF = 10.22 uF, tau 6.75 ms, fc 23.6 Hz. Network from the netlist: DAC_1 = R1 3.3k to PWM1, R3 825 / C5 10u / C7 0.22u to GND, R9 200k to COMP_OUT_1, U2/U3 inputs. - I_LED: PWM_max = 1 V / 1.63 V = 61.34 % -> 1 V / 1.000 V = 100 %. LDO sheet (U7): the note still showed a 3.3 V design (R1 178.5k, 3.300225 V) -> R1 = R49 + R50 = 300k + 22k = 322k, R2 = R51 = 100k, VOUT = 1.185 * (1 + 322/100) = 5.0007 V. The "see notebook in documentation" pointer -> "VOUT calculation below": the only notebook there covers the TIA, not the LDO. TIA sheet: "reverse biasing of photodiode" -> "PD at 0 V bias (TIA_BIAS 49 mV)". The photodiode sits between TIA_BIAS_x (op-amp +) and the summing node (op-amp -), so it sees 0 V; TIA_BIAS_x is 3.33 V * R43 15 / (R41 1k + R43) = 49 mV. Netlist (kicad-cli 10) identical before and after. ERC 0 errors, 59 warnings before and after (same types and counts). DRC 0 errors, 155 warnings before and after, parity 0, unconnected 0.
The board stackup gave 0.07 mm (2 oz) copper on F.Cu and B.Cu and a 1.67 mm board; slice.yaml gives 1oz and 1.6 mm. Both copper layers are now 0.035 mm, which makes the stackup total 1.6 mm (dielectric 1.51, mask 2 x 0.01 unchanged). No copper, footprint or rule changes: DRC 155 findings before and after (0 errors, 0 unconnected, 0 parity). Refilled and saved twice; the second save changes 0 lines. GND solve at 1 oz (0.1 A into each RS1-RS4 pad 2, C3.1/C4.1 at 0 V, 0.1 mm grid): A1.29, NT2.1 and the C23/C24 ground vias 0.16 mV (2 oz: 0.09), A1.4 0.73 mV (0.39), RS4.2 4.56 mV (2.35), RS1.2 4.33 mV, U2.4 3.87 mV. The 0.8 mm LED feed needs 0.085 mm for 0.4 A at a 10 C rise on 1 oz (IPC-2221).
The slice interface's mechanical rule MEC-2 (bread-infra RFC 0001) gives each 5.0 mm mounting hole a 5 mm keep-out radius. Nothing on the board enforced it: the B.Cu pours ran to 2.75 mm from each hole centre (0.25 mm from the hole edge). Each of H1-H4 now has a rule area on F.Cu and B.Cu that disallows tracks, vias, pads and copper pour (footprints allowed): a 64-sided polygon around the 5.0 mm radius (vertices at 5.006 mm, so the whole circle is inside), with a 2.55 mm cut-out over the hole itself so the hole's own NPTH pad does not trip the pads rule. The board has no Margin-layer graphics. - No track, via or pad lay within 6 mm of any hole centre, so nothing moves. No thermal pad is within 6 mm of a hole. - Refilled: pour edges now 5.000 mm from each hole centre (were 2.750). GNDPWR at H1 680.5 -> 628.8 mm2; the GND driver piece at H3 2546.0 -> 2494.2 mm2; the GND TIA-side piece at H2 and H4 1326.3 -> 1222.7 mm2. GND still 4 pieces, GNDPWR and both GNDA zones 1 each. DRC: 0 errors, 0 unconnected, parity 0, the same 155 findings; the rule areas raise no finding. Tracks, vias and pads unchanged. boardwright review unchanged but for GND cover 56 -> 53 %. Refilled and saved twice; the second save changes 0 lines.
Six vias stood in SMD pads between U2 and U3, where the pad rows were 1.0 mm apart: DAC_2 in U2.5 and U3.7, +5V in U2.8 and U3.3, COMP_REF_1 in U3.4 and DAC_1 in R9.1. Unfilled and inside the pad's mask opening, they let solder wick down the hole. U2 moves 2.3125 mm north (and 0.0325 mm west, onto U3's pin columns), which opens the U2-U3 gap from 1.0 to 3.31 mm; the space north of U2 was empty. Nets re-run around it: - DAC_2: U2.5 to U3.7 is one straight F.Cu run, no vias (was two vias and a B.Cu link). R4 moves 0.0625 mm north so C8.1, C6.1, R4.1 and U2.5 share one line; R4.2 gets its own GND via (0.175 mm off the pad). - COMP_REF_2 crosses DAC_2 on B.Cu: vias at (157.95, 70.475), beside C10.1, and (160.2325, 69.325), 0.35 mm above U3.6. - +5V: U2.8's via sits 0.388 mm below the pad (162.7725, 67.55); the west B.Cu run to R7.2's via is one straight line at y 67.55; C29 moves 1.05 mm north beside that via (0.327 mm). U3.3's via sits 0.225 mm above its pad. R11.1/R12.1 are fed on F.Cu from U2.8 over the north. - COMP_REF_1: via 0.225 mm above U3.4. - DAC_1: R3.1 -> U2.3 on F.Cu, a via under U2's body, B.Cu to a via 0.238 mm north of R9.1, then F.Cu R9.1 -> U3.5. R9 moves 0.15 mm east to give U3.3's via 0.237 mm to R9.2. - U2.4 GND: stitch via 0.262 mm north of the pad (the F.Cu link to R4.2's row is gone). - OPAMP_OUT_1 and FEEDBACK_1 leave the top row north and run east at y 59.45 / 58.85 to R15; FEEDBACK_2, OPAMP_OUT_2 and the R11/R12 +5V leave the bottom row north as before, 2.3 mm higher; OPAMP_OUT_2 joins R16.1 with one 45. - U2's reference sits above the part, off the new runs. Whole-route clearance of every new segment and via (rectangular pads, so conservative): minimum 0.237 mm (U3.3's via to R9.2); the +5V/DAC_1 0.201 mm pair at R9 is gone. DRC: 0 errors, 0 unconnected, parity 0, the same 155 findings. boardwright: vias in SMD pads 11 -> 5, micro-segments 14 -> 13, jogs 40 -> 39, margin pairs 24 -> 23; GND still 4 pieces. Route lint 36 -> 33. Refilled and saved twice; the second save changes 0 lines.
Three vias stood in SMD pads: COMP_REF_3 in U3.10, COMP_OUT_3 in R27.2 and +5V in R27.1. R27's pads have 0.7 mm to R25 and R28 and 0.46 mm to the run below; U3's bottom row had 1.0 mm to U4. - U3.10 (COMP_REF_3), U3.12 (GND stitch), U3.13 (COMP_OUT_3) and U3.14 (COMP_OUT_4) each get a via 0.325 mm above the pad, in one row at y 74.3 under U3's body. DAC_4's run under the body moves 0.575 mm north (73.45) and DAC_2's 0.3 mm (72.6) to make room: run to pad tips 0.45 mm, DAC_2 to DAC_4 0.6 mm, DAC_4 to the vias 0.325 mm. - COMP_OUT_3 leaves on B.Cu north-east and joins its old end at (177.0, 79.175) as one 45; R27.2 keeps its F.Cu links to R25.2 and U3.13. COMP_OUT_4 leaves its via south-east and down x 170.2 to its old run; R28.2's F.Cu stub to the old via (169.225, 79.4) is gone. - +5V: R27.1/R28.1 are fed by a via at (169.2225, 79.4), 0.298 mm north-east of R28.1 (0.218 mm to R28.2), with a B.Cu drop to the +5V run at y 87.1. The U3.3 -> U4.8 B.Cu link now runs down x 162.7725, between the via row's COMP_REF_3 and GND vias (0.745 mm each side), so it no longer meets the new vias. Whole-route clearance of every new segment and via (rectangular pads, conservative): minimum 0.218 mm (the +5V via to R28.2). GND B.Cu fill 2503.3 -> 2498.9 mm2 on the driver piece, still 4 GND pieces. DRC: 0 errors, 0 unconnected, parity 0, the same 155 findings. boardwright: vias in SMD pads 5 -> 2, margin pairs 23 -> 22 (DAC_2 / COMP_REF_2 0.204 mm gone); route lint 33 -> 33. Refilled and saved twice; the second save changes 0 lines.
The last two vias in SMD pads fed U5.8 and U6.8 (+5VA) down to C32/C33 on B.Cu. North of each pad is C19 / TIA_BIAS_2 and the bias network; under each body ran one F.Cu track at 103.3-103.5. - Each via now sits under its op-amp's body, in line with the pin: (170.195, 103.45), 0.2 mm below U5.8's pad tip, and (175.965, 103.5), 0.25 mm below U6.8's. Net-(U5B-+) (R36.1 -> U5.5) drops to y 104.2 and TIA_BIAS_2 (C20.1 -> U6.5) to y 104.25 under the bodies, 0.225 mm from the vias and 0.25 mm or more from +3V3_1 and TIA_BIAS_1; both keep their ends. - C32 and C33 move beside their vias (1.185 mm east; C32 0.45 mm, C33 0.5 mm south), 0.248 / 0.247 mm from them. C32 now sits in the B.Cu +5VA line between the run and U5.8's via; the run enters U6.8's via with one 45 (no square bend). Whole-route clearance of every new segment and via (rectangular pads, conservative): minimum 0.225 mm. GNDA fill 644.0 -> 639.7 mm2, one piece; thermal spokes unchanged on every pad (C32.2 2, C33.2 3). DRC: 0 errors, 0 unconnected, parity 0, the same 155 findings. boardwright: vias in SMD pads 2 -> 0; margin pairs 22 -> 24 (the two 0.225 mm via/track pairs above); bends, tidy and jogs unchanged. Route lint unchanged. Refilled and saved twice; the second save changes 0 lines.
24 references were 0.5 mm text on F.Silkscreen, under the 0.8 mm
minimum (DRC text_height 24): Q1-Q8, D8-D15, R13/R14/R29/R30 and
R37-R40 in the LED/PD column at x 178-184. There is no room for
0.8 mm text there without overlaps, and fabs print sub-0.8 mm text
poorly. Each is now hidden on silk; every one keeps its F.Fab
${REFERENCE} text for assembly drawings. The via work around U2/U3
freed no room in that column, so none goes back on silk.
References beside the moved copper:
- R15 moves 2.3 mm east, above R15.2, off the OPAMP_OUT_1 and
FEEDBACK_1 runs that now come down from the north.
- C29 (B.Silkscreen) moves under its part, off the COMP_OUT_1 via it
covered after C29 moved.
DRC: 0 errors, 0 unconnected, parity 0; findings 155 -> 131
(text_height 24 -> 0; lib_footprint_mismatch 99 and
silk_edge_clearance 32 unchanged); no silk_overlap or
silk_over_copper. Copper unchanged. Refilled and saved twice; the
second save changes 0 lines.
The INL-5AMIR15 datasheet (Inolux V1.0, 2019-01-19) gives 100 mA as the absolute maximum DC forward current at 25 C (Pd 160 mW), derated linearly above about 30 C ambient. With RS1-RS4 at 10 ohm the driver's full scale was 1.000 V / 10 = 100 mA, 101.3 mA with R9's 13 mV of comparator hysteresis: at or over the absolute maximum. RS1-RS4 10 -> 12.4 ohm (E96, 1 %, 0.5 W 1210, same footprint; for example Stackpole RMCF1210FT12R4, the series the documentation already named). Full scale is now 1.000 V / 12.4 = 80.6 mA, 81.7 mA with the hysteresis term; the resistor dissipates 0.0817^2 x 12.4 = 83 mW. - Netlist: only the four RS values change (86 nets before and after); the board's footprint values follow (DRC parity 0). - The LED sheet's I_LED note now carries RS 12.4 ohm, 80.6 / 81.7 mA and PRS_max 0.083 W (was 100 mA, 10 ohm, 0.1 W). - documentation/README.md: the sense resistor part and every 10 ohm reference; README.md gains the LED output rating and derating. - SPICE bench: RS1, RS201-RS601 mirror 12.4 ohm; expect.toml's LED currents, Q2 drain/power at full scale, the 3.0 V LED headroom and the LED ripple figures are rescaled (DAC figures unchanged). Re-run with kicad-cli 10.0.8 and ngspice 44.2: 43 of 43 checked measures and 104 mirrors pass (e.g. 41.51 / 81.70 mA at 50 / 100 % duty, Q2 2.816 V and 0.230 W at full scale with the 1.2 V LED stand-in). ERC 0 errors, the same 59 warnings; DRC 0 errors, 0 unconnected, parity 0, the same 131 findings. Refilled and saved; no copper change.
Resolved thermal spokes (counted from the saved fills: a spoke must reach the pour past the knockout) were under 4 on 14 pads. Turning the spokes to 45 degrees where that frees them: - A1.29 (GND, the Nano's analog-side ground) 2 -> 4 - A1.4 (GND) 2 -> 4 - C30.2 (GND, U3's decoupler) 3 -> 4 - C33.2 (GNDA, U6's decoupler) 3 -> 4 - U1.4 (GND, the buck's ground pin) 0 -> 1; its spoke also joins the 0.61 mm2 GND sliver beside U1 to the pour (GND B.Cu 4 -> 3 pieces) Tried and left at the default angle: C1.1 (1 -> 0) and C3.1 (no gain); J1.1 (3 -> 4) and J1.5 (1 -> 2) each left two 0.6 mm2 GNDPWR fragments hanging on spokes. Still under 4, all blocked by tracks or pads of other nets or by own-net bars: C1.1 1, C3.1 2, C31.2 2, C32.2 2, C34.2 2, J1.1 3, J1.5 1, NT1.1 1, U1.4 1. None is under the project's 2-spoke minimum by DRC (starved_thermal 0); of those under 2, J1.5, C1.1 and U1.4 also have tracks and NT1.1 a via in its pad. DRC: 0 errors, 0 unconnected, parity 0, the same 131 findings. boardwright review unchanged but for GND 4 -> 3 pieces. Refilled and saved twice; the second save changes 0 lines.
The bench note said the DF2S6.8MFS TVS diodes were left out for want of a model and a datasheet. Both are now to hand (Toshiba datasheet Rev.6.0.B: Ct 0.45 pF typ / 0.9 pF max at 0 V, IR 0.5 uA max at 5 V only; PSpice model rev 1). Run on the bench's DC and AC decks with the model on D12-D15 (D12/D14 from PD_CATHODE1/2 to GNDA, D13/D15 from PD_ANODE1/2), gmin 1e-12, ngspice 44.2 in ltpsa mode, against the same decks without them: - leakage out of the summing node at its 49.3 mV bias: 4.36 pA at 27 C, 0.172 nA at 85 C; TIA_OUT moves +6.5 uV and +0.26 mV (1.5 MOhm x I), 0.001 and 0.05 LSB of the 0-5 V 10-bit ADC; - the TIA pole (10.61 Hz), PD2's (10.57 Hz) and the 1 kHz response do not change in the fourth digit: 0.37 pF beside 11 pF of photodiode and C17/C19 10 nF of feedback. The model is not committed: its header grants use for simulations only. Text change only; the bench netlist is unchanged.
At 12.4 ohm the full scale was 80.6 mA (81.7 mA with R9's 13 mV of hysteresis). The INL-5AMIR15's typical VF curve (datasheet V1.0: 1.26 V at 10 mA, 1.47 V at 20 mA, about 2.15 V at 80 mA, 2.29 V at 100 mA) puts about 175 mW in the LED there, over its 160 mW Pd. RS1-RS4 12.4 -> 15.0 ohm (1 %, 0.5 W 1210, same footprint; for example Stackpole RMCF1210FT15R0). Full scale is 1.000 V / 15.0 = 66.7 mA, 67.5 mA with the hysteresis term (DAC 1.0131 V). A diode fit to the four VF points (IS 7.3e-5, N 9.45, RS 5.34 ohm, 12.5 mV worst residual) gives 2.03 V at 67.5 mA: 137 mW in the LED. The IF derating curve (100 mA to 30 C, about 10 mA at 85 C) allows 67.5 mA up to about 50 C ambient. RS dissipates 0.0675^2 x 15.0 = 68 mW. - Netlist: only the four RS values change (86 nets before and after); the board's footprint values follow (DRC parity 0). - LED sheet I_LED note: RS 15.0 ohm, 66.7 / 67.5 mA, LED 137 mW at 2.03 V, PRS_max 0.068 W (was 12.4 ohm, 80.6 / 81.7 mA, 0.083 W). - README.md and documentation/README.md: the rating, derating, part and every 12.4 ohm reference. - SPICE bench: RS1, RS201-RS601 mirror 15.0 ohm; expect.toml's LED currents, Q2 drain/power, the 3.0 V LED headroom and the ripple figures rescaled; standins.lib no longer says the LED datasheet is missing. Re-run with kicad-cli 10.0.8 and ngspice 44.2: 43 of 43 checked measures and 104 mirrors pass (34.32 / 67.54 mA at 50 / 100 % duty, Q2 0.192 W at full scale with the 1.2 V stand-in LED). ERC 0 errors, the same 59 warnings; DRC 0 errors, 0 unconnected, parity 0, the same 131 findings. Refilled and saved: no copper change.
The fleet's title form is now "BREAD Slice / <name> / SLC_<CODE> / G3 r1 11-2026". The last line was "R1 11-2026"; it is two characters longer now, so the block moves 0.25 mm up (y 103.325 -> 103.075) to keep about 0.4 mm above HS1's mask opening and 0.3 mm from J1's GND label. The schematic title blocks carry no revision; text only. DRC 0 errors, 0 unconnected, parity 0, the same 131 findings.
With R15/R16/R31/R32 10k alone, the vendor models (MCP6241 rev D, Infineon BSS806N) give the op-amp/FET loop 13-20 deg of phase margin and 56-75 % overshoot: the model's 1650 ohm op-amp output resistance and the FET gate capacitance put a pole near crossover. Each channel gains Rf 10k 1 % from FEEDBACK to the op-amp's IN- and Cf 1 nF C0G (KEMET C0603C102J5GACTU) from OUT to IN-: R52/C36 (U2A), R53/C37 (U2B), R54/C38 (U4A), R55/C39 (U4B), 0603. The op-amp closes its fast loop through Cf; the FET sits in the slow outer loop. Re-run at RS 15.0 ohm with the LED refitted to the INL-5AMIR15 VF curve, 0/25/50/85 C, Vth -0.2/0/+0.2 V and FET C +33-50 %: - outer loop (break at FEEDBACK/Rf): PM 77.8-83.4 deg, GM 24.4-32.2 dB, crossover 8.4-14.5 kHz, no closed-loop peaking; - every loop (Tian break at the op-amp output): PM 67.9-74.5 deg, GM 26.0-27.8 dB at 390-475 kHz; - steps: 60 -> 66 mA overshoot 1.6-3.1 % (5.2-5.4 % at C+), 4.3 -> 5.2 mA under 0.1 %, 1.1 -> 66 mA 0 % (2.2-2.4 % at C+). Layout (no part moved): C36/R52 sit 2 mm north of U2 pins 1-2, C37/R53 and C38/R54 just east of U2 and U4, C39/R55 south of U4 pins 6-7; each Cf pad is on its OUT run and 2-5 mm of copper from the pins. To make room, OUT1/FEEDBACK_1 run north of the parts, IN-2 rises to y 61.4 beside OUT2, OUT3/IN-3 spread to 82.0/83.725 east of U4, OUT4 leaves U4 south (85.95) instead of under its body, and FEEDBACK_4 runs at 87.8. U4.8's +5V reaches the 165.375 junction on B.Cu from the 163.65 via; the 165.375 via is gone. New copper is 0.275 mm or more from other nets. One 0.3 mm 45-degree step into C39.1 is left (R20's courtyard). References: C36 above-left of C36, R9/R55 beside their parts, U4 on its body; C37-C39, R54, R20, R25, R27, R28 and C12 hidden on silk (no free spot clear of pads and tracks), kept on F.Fab. The driver sheet note gives the margins above; the SPICE bench note says it does not model Rf/Cf. Netlist: R52-R55 and C36-C39 added, four IN- nets split from FEEDBACK (86 -> 90 nets). ERC 0 errors, 59 warnings (one multiple_net_names reports LED_ANODE_2 for LED_ANODE_3). DRC 0 errors, 0 unconnected, parity 0, the same 131 findings. Refilled and saved twice; a third save changes 0 lines.
The bench note gave the TVS leakage but not how to repeat it, and the model stays out of the repo (its header grants use for simulation only). The note now names the vendor (Toshiba Electronic Devices & Storage), the part, the product page URL (it refused an automated fetch, HTTP 403, 2026-11-27), the files as dropped (DF2S6.8MFS_PSpice_20250213.zip with DF2S6.8MFS_PSpice_rev1.lib; DF2S6.8MFS_LTspice_20250828.zip, encrypted), the subckt (DF2S6_8MFS, node 1 = device pin 2), the four nodes it goes on (TIA_FEEDBACK_1/2, TIA_BIAS_1/2 to GND through 0 V ammeters), the options (gmin 1e-12, rshunt 1e12) and the result: 4.36 pA at 27 C (+6.5 uV at TIA_OUT), 0.17 nA at 85 C (+0.26 mV). Text only: the bench's SPICE netlist is byte-identical.
The Rf/Cf commit hid nine references on silk for want of room at 1 mm. At 0.8 mm (the board's minimum text height; 0.12 mm stroke) seven fit beside their parts, clear of pads, vias and other silk, some over tracks as accepted before: - C37 above C37 (R53's reference moves 0.47 mm right to make room); - C38 vertical left of C38, C39 vertical right of C39.2; - R54 below R54; R27 below R27; R28 vertical right of R28; - C12 vertical right of C12.1, between it and R55. R20 and R25 stay hidden on silk (kept on F.Fab): R20 is boxed in by C13's pads (left), U4.5 (above), C39 (right) and C12 (below); R25 by U4's outline and pin-1 mark (left), its own pads and R27 (right). Both placements were tried: DRC reported silk_over_copper on C13.1 and silk_overlap with U4. DRC 0 errors, 0 unconnected, parity 0, the same 131 findings (no silk_overlap, silk_over_copper or text_height). Copper unchanged; refilled and saved twice, the second save changes 0 bytes.
With Cf C36-C39 at 1 nF the vendor-model loop (MCP6241 rev D, Infineon BSS806N, RS 15.0 ohm, refitted INL-5AMIR15) reached 77.8 deg outer-loop phase margin at 5 mA and 5.4 % overshoot on a 60 -> 66 mA step with the FET capacitance +33-50 %. Sweep, same bench and corners (0/25/50/85 C, Vth -0.2/0/+0.2 V, C +33-50 % at 0/25 C), worst case per column: Rf:Cf outer PM fs/5mA all-loop PM/GM FS osh 5 mA osh 10k:0.68n 76.3 / 72.8 68.7 / 26.0 9.0 % 1.9 % 10k:1n 80.5 / 77.8 67.9 / 26.0 5.4 % 0.1 % 10k:1.5n 83.6 / 81.7 67.3 / 25.1 2.3 % 0.4 % 10k:2.2n 85.6 / 84.3 67.0 / 25.1 0.2 % 0.8 % 10k:3.3n 87.0 / 86.2 66.7 / 25.1 0.1 % 1.2 % 4.7k:2.2n 80.5 / 78.1 67.7 / 27.1 5.0 % 0.1 % 15k:1n 83.6 / 81.7 67.3 / 24.7 2.4 % 0.2 % 22k:0.68n 83.6 / 81.7 67.3 / 24.5 2.6 % 0.2 % Cf 2.2 nF (KEMET C0603C222J5GACTU, C0G 50 V 5 %, same 0603 footprint, Rf stays 10k) is the smallest value with FS overshoot under 1.3 % at every corner. Outer PM >= 84.3 deg, GM >= 26.7 dB; the all-loop margin at the op-amp output drops 0.9 deg / 0.9 dB to 67.0 deg / 25.1 dB; 5 mA overshoot rises to 0.83 %; outer crossover falls to 3.9-6.7 kHz (still 165 times the 23.7 Hz DAC pole); 1 % settling 7-30 us at full scale, 67-70 us at 5 mA, 47-56 us for a 1 -> 66 mA step. - Netlist: only the four Cf values change (90 nets). - Board: values, MPN and datasheet fields follow; no copper change. - The driver sheet's Rf/Cf note carries the new margins; the bench note and expect.toml name 2.2n. ERC 0 errors, 59 warnings; DRC 0 errors, 0 unconnected, parity 0, the same 131 findings. Refilled and saved twice: 0 bytes changed.
The bench's sink copies had no Rf/Cf, so its loop step still showed the uncompensated loop (0.595 V peak on a 0.55 V step, 45 %). Each sink now has Rf 10k from FEEDBACK to the op-amp's IN- (new label INN_n) and Cf 2.2n from OUT to IN-, as on the board: R52/C36 on channel 1 and R252/C236 .. R652/C636 on the PWM, step and 3.0 V-LED copies, all mirrored against R52/C36 in expect.toml. The bench note and the header say so. Re-run with kicad-cli 10.0.8 and ngspice 44.2 (stand-in op-amp): 44 checked measures and 116 mirrors pass, 8 informational. - step_peak 0.5500 V on the 0.45 -> 0.55 V step (now a checked limit, 0.5505 V); settling 49.6 us after the step (was 11.6 us with 45 % overshoot); - ac_loop_peak 1.000, -3 dB at 159 kHz (was 2.44 at 288 kHz); - the loop passes 0.914 of the 31.37 kHz PWM ripple (ac_loop_31khz, new): ripple_iled_31khz 0.0679 mApp, expect rebased 0.0788 -> 0.0720 mApp, rtol 7 % (the triangle's harmonics are cut more); 490 / 976 Hz ripple 5.010 / 2.507 mApp, inside 1 %. All DC figures are unchanged.
The bench note's model paragraph said how a download attempt went. It now keeps what a reader needs: vendor, part, product page, the file names and dates, how to wire the model in and the result. Text only: the bench netlist is unchanged.
With R52/C36 and their copies in the bench, the 100 ms transient
stopped at 0.43 ms ("timestep too small" at Q402's drain) when the
netlist kicad-cli exports from the committed schematic was used; the
same elements in another order ran through. method=trap, reltol
1e-4, cshunt 1e-15, itl4 100 and chgtol/trtol all stopped the same
way.
The workbook's TRAN options now add abstol=1e-10 (ngspice's default
is 1e-12 A); the smallest current the transient measures is the
31 kHz ripple, 68 uA. expect.toml says why.
- check.py from a clean archive of this tree, with the netlists
exported from it (the order that failed): 44 checked measures and
116 mirrors pass, 8 informational.
- The other element order with abstol=1e-10: every transient measure
matches the earlier run to 6 digits (ripple_dac_31khz 1.181744 ->
1.181777 mV, +0.003 %; step_peak 0.5500 V; settling 49.6 us).
boardwright's segments review counted DAC_1, DAC_4, COMP_OUT_4 and FEEDBACK_2 among the nets with three or more segments over their minimum. The ones that were real dog-legs are straightened: - DAC_1: C7, C5 and R3 move 0.10 / 0.09 / 0.04 mm onto R1's line (y 62.375), so R1.2 -> C7.1 -> C5.1 -> R3.1 is one straight run (was three 0.01-0.1 mm steps and an off-45 piece) and R3.1 runs east, then one 45 into the via. The GND row under them (C7.2, C5.2) is straight too; its via moves 0.1 mm to stay on it. - DAC_4: R20, C12, C14 and R18 move 0.02-0.03 mm onto U4.5's column (x 158.97): one straight run U4.5 -> R18.2 with a vertex on each pad centre (was three micro-steps, and R18.2's track ended 0.015 mm off its centre). - COMP_OUT_4: U3.14 -> R26.2 is a 45 then a straight entry (was three pieces); R28 moves 0.0025 mm so R26.2 -> R28.2 is one line. - FEEDBACK_2: R53.2 drops straight south and joins the corridor diagonal (was east, 45, south). Segments 17 -> 14 (DAC_4), 16 -> 14 (DAC_1), 12 -> 10, 10 -> 8; boardwright's minimum for DAC_1 and DAC_4 falls with the aligned pads (13 -> 9, 11 -> 7). Board total 506 -> 497 segments; micro- segments 12 -> 10, jogs under 1 mm 38 -> 33, route-lint jogs 29 -> 23. Two off-45 pieces gone (DAC_1, GND). Every pad keeps its net; no via in a pad; the moved copper is 0.438 mm or more from other nets, and each net's closest approach is unchanged or better (the +5V track at R28.1 0.485 -> 0.483 mm). DRC 0 errors, 0 unconnected, parity 0, the same 131 findings. Refilled and saved twice; the second save changes 0 bytes.
expect.toml's model list and the header of mcp6242_datasheet.lib said how a download attempt went. They now say what a reader needs: the stand-in is built from the DS21882D typicals, and Microchip's MCP6241 macro model (rev D) also covers the MCP6242 (product page named in the .lib). Comment-only edits (TOML "#" and SPICE "*" lines): the bench netlist, decks and results are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings Slice_LEPD to KiCad 10 and the fleet CI gate, then fixes the photometer's supply, ground and photodiode wiring: the four LED channels drew up to 0.65 A from U7, a 150 mA LDO set to 5.59 V; the LED return crossed the analog ground; no op-amp or comparator had a supply capacitor; and the photodiode connectors were wired so that light drove the TIA output to the bottom rail. The board copper, silk and template leftovers are tidied, and a SPICE bench checks the LED driver and TIA. 88 commits. Against main the netlist gains C29-C35, and R52-R55 / C36-C39 (loop compensation); R50 71.5k → 22k, RS1-RS4 10 → 15.0 Ω, R3/R4/R19/R20 1.6k → 825, C5/C6/C11/C12 1 µF → 10 µF; U2/U4/U5 lose their pin 9 (GNDA); TP1-TP40 leave the board and the BOM; 27 pins move +5VA → +5V and 31 GNDA → GND (the LED-driver sheet), C23.2/C24.2 GNDA → GND (the ADC filter caps), NT2.1 GNDPWR → GND and C25.1/C26.1 GNDPWR → GNDA; the four PD_ANODE/PD_CATHODE net names swap; four op-amp IN− nets split from FEEDBACK_1-4. 86 nets → 90.
Fleet remediation
sch upgradedoes not cascade into sub-sheets). Netlist, footprint positions and copper are identical before and after.footprint_symbol_mismatchraised from warning to error, soschematic_paritycan fail CI; KiBot's DRC preflight fails only on errors.ercanddrctargets were swapped (KiBot-sskips the named preflight); each now runs its own check..kicad_prluntracked;.history/,*.kicad_prl,design-block-lib-table,*.lckandbuild/ignored.@main.hardware/config.kibot.yamlalready matched bread-infra's 2-layer template and is unchanged.LED driver supply
The four channels (MCP6242 servo, BSS806N sink, 10 Ω sense, LM339B/BC858 bypass below 33 mV) ran from +5VA, U7's output, with RS1-RS4 returning into GNDA. At the old full scale (163 mA per channel) that is 0.65 A from a TPS7A4901 rated for 150 mA, whose current limit is 220-500 mA (SBVS121E).
U7 (+5VA)
Photodiode polarity
J6/J7 pin 2 runs through R37/R39 (0R) to the TIA summing node, pin 1 through R38/R40 (0R) to the 49 mV bias. The nets named pin 2 PD_ANODE, so a photodiode fitted by the names had its anode on the summing node: the output fell from 49 mV and sat at the bottom rail (12 mV in the bench) from 33 nA up, with the photodiode forward-biased. The four net names are swapped (PD_ANODE1/2 ↔ PD_CATHODE1/2); no wire, pad or copper moves. With the cathode on the summing node the output rises 1.5 V per µA and reaches 5 V at 3.30 µA. The README gains the J6/J7 pinout (pin 1 anode, pin 2 cathode).
Ground
GNDA is the TIA block (B.Cu zone x 162.95-192.3, y 92.6-116.3, 644 mm²) and U7's island (173 mm²). It meets GND at one point, NT2 (GND pad 162.1, 96.0; GNDA pad 166.1, 96.0), at the TIA block's west edge, 7.4 mm from A1.29; before, NT2 tied GNDA to GNDPWR beside U7, so the analog ground reached GND only through J1 and the GNDPWR trunk. GNDPWR meets GND only at NT1. PD2 crosses the split 1.65 mm north of NT2; PD1 leaves the GNDA zone across its south edge, 22.9 mm from NT2, and runs over GND to A1.19. C23/C24 (0.1 µF) moved from the TIA to A1.19/A1.20, grounded to GND by vias 1.25 mm from their pads, so the ADC sees R47/R48 10k + 0.1 µF (159 Hz) against its own ground.
PD1's crossing is accepted. The net that crosses the split far from NT2 is /PD1, the TIA output after R47 10k, filtered by R47/C23 at 159 Hz, not the photodiode. Its return loop is 151 mm² against PD2's 2.6 mm²; the worst-case pickup bound is 0.29 µV at the ADC, under the 1.5 MΩ resistor's own 0.64 µV rms and far under the 4.88 mV LSB. The ground offset between the TIA and the ADC does not depend on this route, and the bench check (TIA_OUT − PD1 at the Nano pins, LEDs off and on) covers it.
The LED return no longer runs under the Nano: PWM1/PWM2 moved east to open a ground channel from the driver block straight to the buck, and the feed's B.Cu leg leaves a strip that joins the buck pocket to the driver piece (B.Cu GND pieces 5 → 3 at head: driver and buck 2502 mm², the TIA-side piece 1224 mm² after the 5 mm hole keep-outs, and a 2.7 mm² sliver on its own via beside U1).
DC solve of the GND copper, 0.1 A into each RS1-RS4 ground pad (full scale is now 67.5 mA, so the figures overstate by 48 %), C3.1/C4.1 held at 0 V, 1 oz (0.035 mm) as the stackup and slice.yaml now give, 0.1 mm grid:
A1.29, NT2 and the C23/C24 grounds sit on the TIA-side piece, which carries no LED current and joins the rest only through HS1 at the south edge, so they read alike. That is 0.16 mV of LED-correlated shift between the TIA's reference and the ADC's, about 0.03 LSB of a 0-5 V 10-bit ADC; A1.4, on the driver piece, sees 0.54 mV more. The Nano joins A1.4 and A1.29 on its own board, which the solve leaves out: with 10 mΩ between them NT2 reads 0.42 mV, 21 µV under A1.29 and 0.24 mV under A1.4. At 2 oz (the old stackup) the same nodes read 0.09, 0.39 and 2.35 mV: the HS1 vias, not the copper, carry much of the drop. Channel 4's DAC ground sits on the TIA-side piece (accepted): its setpoint is referenced about 4.5 mV below RS4.2 here, 0.36 mA at 0.1 A per channel, which per-channel calibration at the operating point removes. The bench check (TIA_OUT − PD1 at the Nano pins, LEDs off and on) settles A1.4 against A1.29.
SPICE bench
hardware/sim/lepd_frontend.kicad_schis a bench of LED channel 1, both TIA channels and U7's divider with the real refs and values.check.pyexports it with kicad-cli, runs DC, AC and transient analyses in ngspice, and fails when a measure leaves its tolerance or a mirrored part's value differs from the real schematic. Run from the repo root with kicad-cli and ngspice on PATH:python3 hardware/sim/check.py(the 100 ms transient takes about 10 minutes).Re-run at 4bc819d (RS 15.0 Ω, Rf 10k / Cf 2.2 nF in every sink copy, transient abstol 1e-10 A) with kicad-cli 10.0.8 and ngspice 44.2 (
ngbehavior=ltpsa), from a cleangit archiveof the commit with the netlists exported from it: all 44 checked measures and 116 mirrors pass; 8 more are informational. At 24a819e the transient stopped at 0.43 ms ("timestep too small" at Q402) for kicad-cli's export order; abstol 1e-10 runs both orders, with the transient measures equal to 6 digits.Informational: below the comparator threshold the BC858 bypass passes only about 1.2 mA, so the LED still carries 0.87 mA at 3 % duty and 1 mA from 3.15 % (this rests on the BC858 stand-in's assumed reverse beta of 3); with Rf/Cf the bench's op-amp/FET loop has no closed-loop peaking (ac_loop_peak 1.000, −3 dB at 159 kHz, the inner follower's bandwidth; it was 2.44 at 288 kHz without them) and passes 0.914 of the 31.37 kHz PWM ripple (ac_loop_31khz), so ripple_iled_31khz's expectation is rebased from 0.0788 to 0.0720 mApp (rtol 7 %: the triangle's harmonics are cut more). Q2 at full scale with the 1.2 V stand-in LED: 2.840 V, 0.192 W, +48 K on the BSS806N's 250 K/W (minimal footprint); with the INL-5AMIR15's typical 2.03 V, about 1.96 V and 0.132 W. A 3.0 V LED leaves Q2 1.10 V.
Models: TI's TLV914x (U6) and LM2901/LM339 (U3, not the B version's input range), Infineon's BSS806N_L1 (level 1, no self-heating). Stand-ins: the MCP6242 (U2/U5) from the DS21882D typicals, the BC858, the LEDs (diodes, Vf 1.2 V and 3.0 V at 100 mA), the photodiode (current source + 11 pF), U7 (ideal error amplifier at 1.185 V). R37-R40 0R and ground drops are left out, and so are the DF2S6.8MFS TVS diodes: Toshiba's PSpice model (rev 1) is licensed for simulation use and not committed. Run on the bench's decks from scratch (D12-D15 added, gmin 1e-12; the bench note says how to get the model and wire it in), it leaks 4.36 pA out of the summing node at 27 °C (+6.5 µV at TIA_OUT) and 0.17 nA at 85 °C (+0.26 mV, 0.05 LSB); the TIA pole (10.61 Hz) does not move in the fourth digit (about 0.37 pF beside the photodiode's 11 pF and 10 nF of feedback). The datasheet guarantees IR only at 5 V (0.5 µA max); its typical curve gives about 10 pA at 0.5 V and 25 °C.
LED loop compensation
With R15/R16/R31/R32 10k alone the vendor models (Microchip MCP6241 rev D, which covers the MCP6242; Infineon BSS806N from the OptiMOS2 20 V library, with its Zth ladder) give the op-amp/FET loop 13-20° of phase margin and 56-75 % overshoot: the model's 1650 Ω op-amp output resistance and Q2's gate capacitance put a pole near crossover, and a smaller gate R cannot pass about 47°. Each channel now has Rf 10k 1 % from FEEDBACK to the op-amp's IN− and Cf 2.2 nF C0G (KEMET C0603C222J5GACTU, 50 V 5 %) from OUT to IN− (R52/C36 U2A, R53/C37 U2B, R54/C38 U4A, R55/C39 U4B, 0603); the gate resistors stay 10k.
Vendor-model run at RS 15.0 Ω, LED refitted to the INL-5AMIR15 typical VF curve, 0/25/50/85 °C, Vth −0.2/0/+0.2 V, and FET capacitance +33-50 % at 0/25 °C; ngspice 44.2 in PSpice mode:
A 1.1 → 66 mA step overshoots 0.08-0.16 % and settles in 47-56 µs.
Cf sweep, same bench and corners, worst case per column:
2.2 nF is the smallest Cf that keeps full-scale overshoot under 1.3 % at every corner, a value change only (same 0603 footprint, no copper). Its cost against 1 nF: the every-loop margin at the op-amp output is 0.9° / 0.9 dB lower (67.0° / 25.1 dB), 5 mA overshoot rises from 0.1 % to 0.8 %, 5 mA settling from 36-53 µs to 67-70 µs, and the outer crossover falls to 3.9-6.7 kHz, still 165 times the 23.7 Hz DAC filter pole, which sets the LED current's response. The study at 12.4 Ω gave 0.2-1.3 % overshoot at 1 nF; this bench reproduces its 0.98 % with its LED fit, and the refitted LED (higher dynamic resistance in Q2's drain) is what raised 1 nF's overshoot to 1.6-5.4 %. The falling DAC edge at 90 µs stops some transient decks on a timestep limit; the measures use only the rising step.
Layout, no part moved: C36/R52 sit 2 mm north of U2 pins 1-2 (C36 pads straight above pins 2 and 1, a 0.455 mm 45 into C36.2); C37/R53 just east of U2 with Cf across the OUT2 run and IN−2 lifted to y 61.4; C38/R54 just east of U4 with OUT3/IN−3 spread to y 82.0 / 83.725; C39/R55 south of U4 pins 6-7. Each Cf pad sits on its OUT run, 2-5 mm of copper from the pins. To make room OUT1 and FEEDBACK_1 run north of the parts, OUT4 leaves U4 to the south (y 85.95) instead of under its body, FEEDBACK_4 runs at y 87.8, and U4.8's +5V reaches the 165.375 junction on B.Cu from the 163.65 via (the 165.375 via is gone). New copper is 0.275 mm or more from other nets (whole route against rectangular pads). Left: a 0.3 mm 45° step into C39.1 (C39 cannot sit under pin 6: R20's courtyard). References: C36 above-left of C36, R9 and R55 beside their parts, U4 on its body (1 mm); C37, C38, C39, R54, R27, R28 and C12 at 0.8 mm (the board's minimum text height) beside their parts, some over tracks, R53's moved 0.47 mm right; R20 and R25 hidden on silk and kept on F.Fab: R20 is boxed in by C13's pads, U4.5, C39 and C12, R25 by U4's outline and pin-1 mark, its own pads and R27 (both tried: DRC reported silk_over_copper on C13.1 and silk_overlap with U4).
Routing tidy
boardwright 0.17.0's
segmentsreview (segments a net takes against the fewest it needs) at 24a819e and at 6d68d84, for every net 3 or more over:Nets 1-2 over (COMP_OUT_1-3, COMP_REF_1/3/4, TIA_FEEDBACK/OUT, OPAMP_OUT_1/2/4, the IN− nets, Net-(U5A-+), LED_CATHODE_1, NFET_GATE_1/4, I2C, PD2, PWM3/4, LED, U7-FB) are accepted bends: none shows a dog-leg on its plot. Straightening the four nets moved R3, C5, C7 (0.04-0.10 mm), R18, R20, C12, C14 (0.02-0.03 mm) and R28 (0.0025 mm). boardwright's segment total over the 70 routed signal and power nets 506 -> 497 (all tracks 610 -> 601); micro-segments 12 -> 10; jogs under 1 mm 38 -> 33; the GND via on C7.2/C5.2's row moves 0.1 mm to stay on it.
Ratings
Board
Measured with kicad-cli 10.0.8 against KiCad-Master-Lib 5cba445 (
pcb drc --schematic-parity --severity-all,sch erc --severity-all):main (dc98197) reads the same as the migration commit. The 45 parity issues were the 40 unplaced test points, four net_conflicts (U2.9, U4.9, U5.9 on GNDA and A1's missing pad 3) and Logo1's extra footprint. The 131 left are 99 lib_footprint_mismatch (stock-library drift) and 32 silk_edge_clearance (J1's right-angle socket outline past the board edge). The 59 ERC warnings are 33 lib_symbol_mismatch (embedded copies), 20 pin_to_pin (unspecified TVS and U7 pins on passive nets, as before), 3 multiple_net_names and 3 same_local_global_label.
boardwright 0.17.0 at head: no acute or 90° bend, 10 micro-segments, 33 jogs under 1 mm, 24 net pairs within rule + 0.05 mm, no via in an SMD pad. Whole-route clearance with KiCad's rounded pad shapes at 686406f: minimum 0.200 mm, 38 pairs under 0.25 mm; the copper added since measures 0.218 mm or more against rectangular pads. The 1.5 MΩ summing nodes are 0.2 mm wide (11.5 and 7.8 mm long); TIA_FEEDBACK_1 passes between R38's pads at 0.325 / 0.326 mm, both at the bias potential.
Fixes
Not done here, open for a decision or the bench:
Loop compensation bench check: scope the sense resistor on a fast DAC step at about 60-67 mA and about 5 mA (the margins below rest on the vendor models).
The INL-5AMIR15 at full scale: 137 mW typical against its 160 mW Pd; above about 50 °C ambient (IF curve), or about 39 °C if Pd derates like IF, cap the duty in firmware.
The LED's partial bypass below the comparator threshold (about 1.2 mA through the BC858 against the stand-in's assumed reverse beta of 3): bench reading of LED current at 2-3 % duty; firmware can treat duty under 3.2 % as off.
Small layout items left as they are: R7.2's +5V via stays west of the pad (east, C8.1 is 0.164 mm away; its B.Cu run is now one straight line to U2.8's via); TIA_BIAS_2's 0.424 mm end-45 into R44.1 (straight needs R42 0.3 mm south, which closes the 3V3_2 run between R42 and R35); ESTOP, INT and SYNC's 0.140 mm steps into A1.5-A1.7 (J1 → A1 is 16.41 × 16.55 mm, not a true 45).
The 31 kHz PWM, which needs firmware (
firmware/holds only a placeholder).Schematic notes brought to the current values: DAC_max = 5 V × 825 / (3.3k + 825) = 1.000 V; the DAC filter 660 Ω (3.3k ∥ 825) with 10 µF + 0.22 µF, τ 6.75 ms, fc 23.6 Hz (the old note also had 1.78k for 1.08k); PWM_max 100 %; U7 VOUT = 1.185 × (1 + 322/100) = 5.0007 V from R49 + R50 over R51; the photodiode runs at 0 V bias (TIA_BIAS 49 mV), not reverse biased. Text only: netlist identical, ERC and DRC unchanged.
Sheet notes changed with the 15.0 Ω and Rf/Cf commits: the LED sheet's I_LED note (RS 12.4 Ω, 80.6 / 81.7 mA, PRS 0.083 W → RS 15.0 Ω, 66.7 / 67.5 mA, LED 137 mW at 2.03 V, PRS 0.068 W); the Rf/Cf note (study figures at 80 mA → the 15.0 Ω re-run with Cf 2.2 nF: outer PM ≥ 84°, GM ≥ 26 dB, 4-7 kHz, PM ≥ 67° / GM ≥ 25 dB at the output, overshoot ≤ 0.2 % at 67 mA and ≤ 0.9 % at 5 mA); the SPICE bench note (now says the bench carries R52/C36 and their copies, and how to get and wire in the DF2S6.8MFS model); standins.lib no longer says the LED datasheet is missing. slice.yaml carries no LED current or sense figure, so it is unchanged.
Corrections to commit messages
The commits are published, so these stand here:
hardware/config.kibot.yamlwas already identical to bread-infra'stemplates/config.kibot.2layer.yamland is not changed; the commit only moves the workflow pins from v1.1.0 to v1.2.0.