Skip to content

Commit 0bfe0fd

Browse files
dioderobothexdae
andauthored
add pcb docs for readmes (#569)
* add docs pages * add ch * use links instead of docs * explain how to access the docs * less verbose docs * refresh * refresh --------- Co-authored-by: d-asnaghi <30296575+hexdae@users.noreply.github.com>
1 parent 22b2e56 commit 0bfe0fd

File tree

6 files changed

+412
-0
lines changed

6 files changed

+412
-0
lines changed

.agents/skills/pcb/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ pcb doc spec # Full language specification
106106
pcb doc spec --list # List all spec sections
107107
pcb doc spec/<section> # Read specific section (e.g., spec/io, spec/module)
108108
pcb doc packages # Dependency management docs
109+
pcb doc docs_bringup # Guide on writing bringup docs in markdown
110+
pcb doc docs_changelog # Guide on writing a changelog after every change
109111
```
110112

111113
Package docs (stdlib, registry packages):

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to Semantic Versioning (https://semver.org/spec/v2.0.0.
1616

1717
### Added
1818

19+
- Added `pcb doc` guides for bringup, changelog, and readme conventions.
1920
- Added MCP tool `resolve_datasheet` to produce cached `datasheet.md` + `images/` from `datasheet_url`, `pdf_path`, or `kicad_sym_path`.
2021
- Added LSP request `pcb/resolveDatasheet`, sharing the same resolve flow as the MCP tool.
2122

docs/docs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
{
4141
"group": "Documentation",
4242
"pages": ["pages/spec", "pages/packages", "pages/testing"]
43+
},
44+
{
45+
"group": "Guides",
46+
"pages": ["pages/docs_bringup", "pages/docs_changelog", "pages/docs_readme"]
4347
}
4448
]
4549
},

docs/pages/docs_bringup.mdx

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
title: Bringup
3+
description: Conventions for writing board bringup and rework documentation that renders in the Diode Glass bringup tab.
4+
---
5+
6+
# Bringup Documentation
7+
8+
Write a `README.md` per board version documenting reworks, firmware flashing, and test procedures. Diode Glass parses these and renders them in the **bringup** tab.
9+
10+
## File Location
11+
12+
```
13+
src/boards/<BOARD_NAME>/
14+
bringup/
15+
v1.0/
16+
README.md
17+
images/
18+
estop-rework.png
19+
v2.0/
20+
README.md
21+
```
22+
23+
One `README.md` per version folder. Images go in `images/` alongside the README.
24+
25+
### Version Matching
26+
27+
- **Exact**: release `v2.0` → folder `v2.0/`
28+
- **Prefix**: release `v2.0.4` → folder `v2.0/` (covers all v2.0.x)
29+
- **No cross-minor**: release `v2.1.0` does NOT match `v2.0/`
30+
31+
New folder per minor version. Patch versions share a folder unless they have unique rework. Docs are fetched from `main`, not the release artifact.
32+
33+
## Document Structure
34+
35+
```markdown
36+
# <Board> <Version> Bringup
37+
38+
Overview text.
39+
40+
## Reworks
41+
42+
### 1. Title of first rework
43+
44+
...
45+
46+
### 2. Title of second rework
47+
48+
...
49+
50+
## Firmware
51+
52+
Free-form markdown.
53+
54+
## Testing
55+
56+
Free-form markdown.
57+
```
58+
59+
`## Reworks` is parsed into structured data. All other `##` sections render as collapsible markdown.
60+
61+
## Rework Items
62+
63+
Each rework is a `### N. Title` heading followed by free-form prose. Describe the problem, fix, and board location naturally. Mention status in the text or heading (e.g., "fixed in v1.1") rather than a structured field.
64+
65+
### Linking to Components
66+
67+
Use markdown links with the `pcb://` scheme: `[R1](pcb://R1)`, `[C5](pcb://C5)`, `[U3](pcb://U3)`. The parser links these to the PCB viewer for click-to-highlight.
68+
69+
### Images
70+
71+
Place in `./images/`, reference with `![description](./images/photo.png)`.
72+
73+
## Complete Example
74+
75+
```markdown
76+
# DM0001 v1.0 Bringup
77+
78+
Board version v1.0 requires 3 reworks before bringup.
79+
Items 1–2 are fixed in v1.1. Item 3 requires a physical fix on each board.
80+
81+
## Reworks
82+
83+
### 1. Short ESTOP debounce resistor (fixed in v1.1)
84+
85+
The 47k ESTOP debounce resistor [R_ESTOP_DEBOUNCE](pcb://R_ESTOP_DEBOUNCE) creates a voltage
86+
divider with the ESTOP LED, pulling the signal to ~1.5V (below the AND gate
87+
VIH threshold of 2.0V). Short across [R_ESTOP_DEBOUNCE](pcb://R_ESTOP_DEBOUNCE) (47k 0402) with
88+
a solder blob or wire. Located near the ESTOP connector between ESTOP_RAW
89+
and ESTOP nets.
90+
91+
![ESTOP Rework](./images/estop-rework.png)
92+
93+
### 2. Replace decoupling capacitors (fixed in v1.1)
94+
95+
[C5](pcb://C5) and [C6](pcb://C6) have insufficient 10uF decoupling for [U1](pcb://U1) LDO.
96+
Replace both with 22uF/16V X5R (GRM188R61C226ME15). Bottom side, adjacent
97+
to [U1](pcb://U1).
98+
99+
### 3. CAN termination resistor
100+
101+
[R12](pcb://R12) footprint is unpopulated. Add 120 ohm 0402 resistor for CAN bus
102+
termination.
103+
104+
## Firmware
105+
106+
### Prerequisites
107+
108+
- J-Link programmer
109+
- Firmware v1.0.2: `dm0001-v1.0.2.bin`
110+
111+
### Flash Procedure
112+
113+
1. Connect J-Link to SWD header [J5](pcb://J5)
114+
2. Power board via 12V supply
115+
3. Run: `JFlash -openprj dm0001.jflash -open dm0001-v1.0.2.bin -auto -exit`
116+
4. Verify: LED [D1](pcb://D1) should blink at 1Hz after flash
117+
118+
## Testing
119+
120+
### Power Rail Verification
121+
122+
| Rail | Test Point | Expected | Tolerance |
123+
|------|-----------|----------|-----------|
124+
| 3.3V | [TP1](pcb://TP1) | 3.30V | ±50mV |
125+
| 1.8V | [TP2](pcb://TP2) | 1.80V | ±30mV |
126+
| 5.0V | [TP3](pcb://TP3) | 5.00V | ±100mV |
127+
128+
### CAN Bus Test
129+
130+
1. Connect CAN analyzer to [J2](pcb://J2)
131+
2. Send test frame: ID=0x100, DLC=8, data=0xFF
132+
3. Board should echo back on ID=0x101 within 10ms
133+
134+
### ESTOP Functional Test
135+
136+
1. Short ESTOP connector pins 1-2
137+
2. Verify ESTOP_OUT test point reads 3.3V (after rework #1)
138+
3. Open ESTOP connector
139+
4. Verify ESTOP_OUT reads 0V
140+
```

docs/pages/docs_changelog.mdx

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: Changelog
3+
description: Conventions for writing package changelogs that are parsed by tooling and shown to users on upgrade.
4+
---
5+
6+
# Changelog
7+
8+
Every board/package gets a `CHANGELOG.md` at its root (`pcb new` creates one). Parsed by `pcb publish` for release notes and by the build system for CLI display, so format matters.
9+
10+
## Format
11+
12+
Follow [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/):
13+
14+
```markdown
15+
# Changelog
16+
17+
All notable changes to this package will be documented in this file.
18+
19+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
20+
21+
## [Unreleased]
22+
23+
## [X.Y.Z] - YYYY-MM-DD
24+
25+
### Added
26+
27+
- New features.
28+
29+
### Changed
30+
31+
- Changes to existing behavior.
32+
33+
### Fixed
34+
35+
- Bug fixes.
36+
37+
### Removed
38+
39+
- Removed features.
40+
```
41+
42+
## Rules
43+
44+
- **`[Unreleased]` first.** Add entries here as you work. `pcb publish` moves them into a versioned section with today's date.
45+
- **One entry per user-visible change.** Internal refactors with no behavior change don't need entries.
46+
- **Four categories only.** `Added`, `Changed`, `Fixed`, `Removed`. Omit empty ones.
47+
- **Newest version first.** Reverse chronological order.
48+
- **Write for the upgrader.** Lead with *what* changed, not *why*. Note if action is needed.
49+
50+
## Writing Entries
51+
52+
Each entry is `- ` followed by a concise description. Use backticks for identifiers.
53+
54+
Good:
55+
```markdown
56+
- `Component()` now infers missing `footprint` from symbol `Footprint` property.
57+
- Fix `layout.sync` false positives caused by `.kicad_pro` newline drift.
58+
```
59+
60+
Avoid:
61+
```markdown
62+
- Updated code.
63+
- Fixed bug.
64+
- Refactored internals (no user-visible change).
65+
```
66+
67+
## Versioning
68+
69+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html):
70+
71+
- **Patch** (0.3.1 → 0.3.2): Metadata only — docs, property typos, manufacturer aliases. No connectivity or behavior changes.
72+
- **Minor** (0.3.x → 0.4.0): New non-breaking functionality — optional pins, new config options, additional footprint variants.
73+
- **Major** (0.x → 1.0): Breaking changes requiring design updates — changed pin definitions, restructured interfaces, removed features.
74+
75+
Pre-1.0: `pcb publish` bumps minor (0.3.2 → 0.4.0) since minor versions are treated as potentially breaking.
76+
77+
## Tooling
78+
79+
1. **`pcb publish`** — reads `[Unreleased]` as the release body for the annotated git tag.
80+
2. **Build-time extraction** — CLI parses changelog at compile time for `pcb doc --changelog`. Expects `## [...]` version headers and `### Category` subsections.
81+
82+
Both parsers are strict: use exactly `## [X.Y.Z] - YYYY-MM-DD` for versions and `## [Unreleased]` for the working section.
83+
84+
## Complete Example
85+
86+
```markdown
87+
# Changelog
88+
89+
All notable changes to this board will be documented in this file.
90+
91+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
92+
93+
## [Unreleased]
94+
95+
### Added
96+
97+
- CAN bus termination option via `config()` parameter.
98+
99+
## [0.2.0] - 2026-02-15
100+
101+
### Changed
102+
103+
- Replace LDO `U1` with TPS54331 buck converter for improved thermal performance.
104+
- Increase decoupling capacitors `C5`, `C6` from 10uF to 22uF.
105+
106+
### Fixed
107+
108+
- ESTOP debounce resistor value corrected from 47k to 10k.
109+
110+
### Removed
111+
112+
- Removed unused test points `TP4`, `TP5`.
113+
114+
## [0.1.0] - 2026-01-10
115+
116+
### Added
117+
118+
- Initial board design with STM32F4 MCU, CAN bus, and ESTOP circuit.
119+
- Power supply: 12V input, 3.3V and 1.8V rails.
120+
- SWD debug header on `J5`.
121+
```

0 commit comments

Comments
 (0)