117 lines
4.9 KiB
Markdown
117 lines
4.9 KiB
Markdown
---
|
||
tags: [project-drogheda, hardware, watchdog, schematic, pcb]
|
||
project: Project Drogheda
|
||
author: Helgen CTO
|
||
date: 2026-06-20
|
||
status: Active
|
||
---
|
||
|
||
# Watchdog — Wiring & Schematic Spec (STM32F411 Blackpill)
|
||
|
||
> The as-built watchdog circuit, formalized for the production PCB. Pairs with
|
||
> the firmware [[04-Source-Code/firmware/blackpillrtkcode_v2/blackpillrtkcode_v2|blackpillrtkcode_v2.ino]]
|
||
> (pin map must match) and the [[03-Architecture-Hardware/BOM-master|BOM]].
|
||
|
||
## 1. Power tree (corrected)
|
||
|
||
```text
|
||
Cabinet 24 V ─GX16-5─► HBOX
|
||
└► Mean Well SD-15B-05 (24→5 V, 3 A) ─► 5 V rail ─► PowerBoost 1000C (USB in)
|
||
PowerBoost (BAT=18650 1S4P) ─► PowerBoost 5V OUT ─► STM32 5V + IRF9540N source
|
||
24 V ignition ─► DFR1015 (buck) ─► STM32 PA5 (ignition sense, ≤3.3 V)
|
||
```
|
||
|
||
## 2. STM32F411 pin map (matches firmware v2)
|
||
|
||
| Pin | Net | Function |
|
||
|---|---|---|
|
||
| PA0 | BAT_SENSE | 18650 voltage ÷ divider → ADC |
|
||
| PA4 | 5V_SENSE | PowerBoost USB (vehicle-power present) ÷ divider → ADC |
|
||
| PA5 | IGN_SENSE | ignition via **DFR1015** (digital, INPUT_PULLDOWN) |
|
||
| PA1 | PWR_CTRL | drives the RTK power switch (NPN→P-MOS) |
|
||
| PA2 | GNSS TX2 | UBX commands → simpleRTK2B RX1 |
|
||
| PA3 | GNSS RX | NMEA from simpleRTK2B (read-back) |
|
||
| PB0 | EXT_LED | external status LED (via N-MOSFET) |
|
||
| PC13 | onboard LED | active-LOW |
|
||
|
||
## 3. RTK power switch (high-side, P-channel)
|
||
|
||
```text
|
||
5V ───┬──────────────[10kΩ pull-up]──┐
|
||
│ │
|
||
IRF9540N Source Gate ── 2N3904 Collector
|
||
│ │
|
||
Drain ──► simpleRTK2B 5V 2N3904 Emitter ── GND
|
||
│
|
||
STM32 PA1 ──[1kΩ]── 2N3904 Base ──────────┘
|
||
```
|
||
|
||
- PA1 **HIGH** → 2N3904 conducts → pulls IRF9540N gate **LOW** → P-MOS **ON** →
|
||
5 V to the simpleRTK2B + 4G stack. PA1 LOW → gate held high by 10 kΩ → OFF.
|
||
- 10 kΩ gate pull-up = defined OFF at boot/reset (fail-safe: stack off until the
|
||
MCU asserts).
|
||
|
||
> **PCB note:** replace the 2N3904 + IRF9540N + pull-up with an **integrated
|
||
> high-side load switch / eFuse** (e.g., TPS25200 / TPS2596) — current-limited,
|
||
> fewer parts, defined turn-on, no gate-pull-up gotchas. Keep the same fail-safe
|
||
> (load off until MCU enables).
|
||
|
||
## 4. Status LED (low-side N-MOSFET, logic-level)
|
||
|
||
```text
|
||
3.3V ──[220–330Ω]──►|LED|──► 2N7000/BS170 Drain
|
||
Source ── GND
|
||
STM32 PB0 ── Gate ──┬── 10kΩ ── GND (pull-down: LED off while booting)
|
||
```
|
||
|
||
- 2N7000/BS170 are logic-level (switch fully at 3.3 V). 10 kΩ pull-down keeps the
|
||
LED off during MCU boot. PC13 onboard LED mirrors inverted (active-low).
|
||
|
||
## 5. Sense dividers
|
||
|
||
| Net | Source | Divider | At ADC (max) | Note |
|
||
|---|---|---|---|---|
|
||
| PA0 BAT | 18650 (3.0–4.2 V) | ÷2 (e.g. 10k/10k) | 1.5–2.1 V | firmware `DIVIDER_RATIO=2.0` |
|
||
| PA4 5V | PowerBoost USB ~5 V | ÷2 | ~2.5 V | "vehicle power present" |
|
||
| PA5 IGN | 24 V ignition | **DFR1015 buck** → ≤3.3 V | digital | isolated/scaled by DFR1015 |
|
||
|
||
> ⚠ The BOM lists a lone **1.5 kΩ "????"** resistor — confirm whether it's a
|
||
> divider leg or the LED resistor and pin it down on the schematic. Keep ADC
|
||
> inputs ≤3.3 V with margin.
|
||
|
||
## 6. Resistor / discrete BOM (watchdog)
|
||
|
||
| Ref | Value | Purpose |
|
||
|---|---|---|
|
||
| R1 | 1 kΩ | PA1 → 2N3904 base |
|
||
| R2 | 10 kΩ | IRF9540N gate pull-up (to 5 V) |
|
||
| R3 | 220–330 Ω | LED current limit |
|
||
| R4 | 10 kΩ | PB0 LED-MOSFET gate pull-down |
|
||
| R5/R6 | 10 kΩ/10 kΩ | PA0 battery divider (÷2) |
|
||
| R7/R8 | 10 kΩ/10 kΩ | PA4 5 V divider (÷2) |
|
||
| Q1 | 2N3904 (NPN) | gate driver |
|
||
| Q2 | IRF9540N (P-MOS) | RTK 5 V high-side switch |
|
||
| Q3 | 2N7000 / BS170 (N-MOS) | LED switch |
|
||
|
||
## 7. For the production PCB
|
||
|
||
- Integrated load switch (above) instead of the discrete trio.
|
||
- All ADC dividers with RC filtering; clamp/Zener protection on PA5 ignition.
|
||
- Bring out **SWD** + a **debug UART** (the v2 ANSI dashboard) on a keyed header.
|
||
- Add an external temp sensor near the 18650 / modem (v2 logs MCU temp; an
|
||
external one near the battery is more representative).
|
||
- Keep switching-regulator noise away from the GNSS antenna feed (RF integrity).
|
||
- Single keyed **GX16-5** for the 24 V + ignition interface to the cabinet.
|
||
|
||
## Open Questions
|
||
|
||
- [ ] Pin down the 1.5 kΩ resistor's role; finalize all divider values.
|
||
- [ ] Confirm DFR1015 output level into PA5 (≤3.3 V) and whether it's analog or digital sense.
|
||
- [ ] Load-switch part choice + current limit (from the measured power budget).
|
||
|
||
## Related
|
||
|
||
- [[CLAUDE|Master Index]] · [[04-Source-Code/firmware/blackpillrtkcode_v2/blackpillrtkcode_v2|firmware v2]] ·
|
||
[[03-Architecture-Hardware/hardware-respec-and-pcb-brief|Hardware re-spec + PCB brief]] ·
|
||
[[03-Architecture-Hardware/BOM-master|BOM]]
|