Chat


How can I help you?

Explain project
Write a project description
Find schematic issues

Firmware Starter
Scope and safety — 23 October 2026
Charge-disabled diagnostic only. Not production firmware, permission to charge, manufacturing approval or physical test evidence. Existing project files were listed before writing; no previous firmware/bring-up file existed. No schematic, PCB, component or reserved charging-status/power-budget/redesign document was modified.
Complete source, build products, pin map, flashing instructions and evidence. The archive contains platformio.ini, src/main.cpp, src/decode.h, host tests, README, SHA256SUMS, BUILD.log, TEST.log and firmware/bootloader/partition binaries, ELF and map. ELF, application BIN, link map.
Exact build result
Final pio run -d /root/work/diagnostic: exit 0, SUCCESS, 2.29 seconds, release build. espressif32 6.9.0; Arduino framework 3.20017.241212+sha.dcc1105b (Arduino ESP32 2.0.17), Xtensa GCC 8.4.0+2021r2-patch5, esptool 4.5.1. RAM 19,228 / 327,680 bytes (5.9%); application flash 297,789 / 3,342,336 bytes (8.9%). Flash denominator is selected application partition, not entire 8MB device. Compiler warnings: application 0, framework/dependencies 0 in final build log. No compiler failure occurred; source review replaced a potentially unsafe HardwareSerial default-TX selection with explicitly RX-only IDF UART before the final successful rebuild.
Host decode tests compiled with clang++ -g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer; output verbatim: PASS decode tests; ASan/UBSan: no findings. Tests cover signed normal/extended TMP102, bus/ADC scaling, ratiometric resistance and invalid excitation/open/short guards. Linked ELF inspection: 42001afc T initVariant confirms the custom early initialization hook is linked strongly. Source readback shows every GPIO41 assignment is zero/LOW, first setup operation LOW, with no command, timer, flag or peripheral that can generate heartbeat. This is software inspection, not an oscilloscope waveform measurement.
Build, flash and console
Unzip, run pio run -e diagnostic. After no-pack/emulator bring-up approval, flash using pio run -e diagnostic -t upload --upload-port /dev/ttyUSB0; monitor UART0 at 115200 8N1. PlatformIO manages all image offsets; do not flash the application BIN alone at address zero. Standard application offset is 0x10000. Manual boot: hold BOOT low, reset EN, then release BOOT after download entry. No hardware connected/flashed/tested here.
Build target esp32-s3-devkitc-1 was confirmed by pio boards: N8, 8MB/no PSRAM. Actual host is U6 ESP32-S3-MINI-1-N8; CPU 240MHz, module clock, flash DIO 80MHz, USB CDC disabled. Manifest selection does not assert devkit connector equivalence. Console J4: 1=3V3 reference, 2=GND, 3=host TX(GPIO43), 4=host RX(GPIO44), 5=EN, 6=BOOT. Use 3.3V UART logic and common ground, never adapter 3V3 as board power. USB19/20 are untouched by application; USB recovery remains a separate hardware/core capability.
Safe boot and complete MCU mapping
Mapping comes from live net memberships, not stale Role Details. U15 Role Details incorrectly describe obsolete channels; live AIN0/1 are grounded and AIN2/3 are probe/excitation. Final hardware reconciliation confirms GPIO40 is CHGR_STAT1_N from BQ24610 STAT1, not NC or an I²C-charger interrupt. GPIO41 remains the inhibited heartbeat input. Documentation was reconciled after the completed hardware/pad corrections; no binary change was required.

Table


GPIOConnected functionStarter action
0Host BOOT strap/SW2/J4-6Untouched
1,2,7,38SparesInputs
3,45,46No connected application net/strapsUntouched
4,5SDA/SCLWire 100kHz, timeout25ms
6TMP102 ALERTRaw input
8,9,10CAN TX/RX/STBTX HIGH, RX input, STB HIGH
11,12Expansion power enable/faultEnable LOW; fault raw input, no reset
13,14U4 STAT1/STAT2Raw input only, no charge-state decode
15,16Host modem TX/RXTX detached input; RX-only UART1 115200 8N1
17,18Modem NRST/BOOT0 through1kBoth LOW; no reset release command
19,20USB D−/D+Untouched, CDC not enabled
21Status LEDLOW
26,34Unused/reserved module pinsUntouched
33VBUS_OK/U13 select/hardware statusRaw input; NOT charge authorization
35,36,37Accessory MOSI/SCK/MISOInputs; no SPI clocks
39Accessory resetInput; polarity/protocol unspecified
40CHGR_STAT1_N from BQ24610 STAT1Input, no interrupt handler or interpretation
41CHARGE_ENABLE → U31 TRIGAlways LOW
42Probe excitationLOW except bounded read then LOW on success/error
43,44UART0 TX/RX115200 console
47,48Accessory CS/IRQCS HIGH, IRQ input
EN,3V3,GNDReset/power/module ground padsHardware, no GPIO control
Custom initVariant sets IO41 LOW, CAN STB HIGH, expansion enable LOW, modem reset LOW before setup; first setup operation repeats IO41 LOW. Loop invariants repeat these levels. Reset/ROM/bootloader precede this hook: safety during those intervals comes from physical Q6 DNP, pull-downs and hardware interlocks, not a software claim. Modem can execute before host initialization; for absolutely no RF over the whole boot interval, physically restrain modem NRST or install a verified non-transmitting modem image before powering. Do not let a J5 programmer override reset during this diagnostic. Starter itself never releases modem reset, sends UART commands, loads Wi-Fi/BLE/LoRa stacks, enables CAN, injects or ACKs frames.
Device initialization and read definitions
  • U22 INA237 0x40 vehicle remote voltage; U23 0x41 backup voltage: require manufacturer reg0x3E=0x5449, preserve ADC_CONFIG low12 bits, select/read back mode9 continuous bus-only. Bus register5 has3.125mV/LSB. Shunt pins grounded; never report current/power/SOC. Failed transactions print unavailable. No invented device-ID register.
  • U10 TMP102 0x48: config read, shutdown marks unavailable; temperature reg0 signed12/13-bit decoded using temperature-data format marker,0.0625°C/LSB; first report waits300ms. No config/alert writes. Board temperature is not pack temperature. Prior non-default configuration can affect freshness; reset/config must be checked on bench.
  • U15 ADS1115 0x49: AIN2=probe voltage, AIN3=excitation; single-shot PGA±4.096V/128SPS with comparator disabled; derived words E383/F383; poll OS with50ms deadline and config readback,125µV/LSB. IO42 HIGH20ms settling, then both reads, then LOW. R83 live10k: Rntc=10000×V2/(V3−V2). Prints volts and ohms; external-probe Celsius unsupported pending exact installed curve/cable calibration. Diagnostic plausibility guards are not safety trip thresholds. J6 probe is independent of J3 BAT_NTC; starter has no pack-temperature reading.
  • U7 modem: live PA2/UART2_TX→host16, PA3/UART2_RX←host15; NRST17, BOOT18 through series resistors. IDF UART1 attaches RX16 only, never a default TX. Passive hex RX diagnostic; silence expected while reset LOW. 115200 baud is an explicit assumption, not verified modem identification. i prints ESP chip identity and modem wiring. AT identity/version/UID queries intentionally unsupported until exact non-T RUI3 image and non-autojoin policy are verified; no generic passthrough. J5:1=3V3ref,2=GND,3=SWDIO,4=SWCLK,5=NRST,6=BOOT0,7=modemTX,8=modemRX. No destructive factory erase or independent modem firmware build is supplied.
  • U8 CAN / U9 expansion eFuse: STB HIGH disables driver/normal receiver; no TWAI initialization. TX HIGH, RX raw, expansion EN LOW and fault raw only. Intended future baseline classical125kbit/s with endpoint termination; not active in starter. No CAN-FD or vehicle-CAN interface claim.
  • J7 accessory:1=3V3,2=GND,3=SCK36,4=MOSI35,5=MISO37,6=CS47,7=IRQ48,8=reset39. No fitted SPI controller/PHY/protocol: unsupported, unclocked, no direct vehicle-CAN connection.
  • U4 BQ25185: hardware permanently CE HIGH, raw STAT13/14 only. U25 BQ24610: resistor-programmed, no I²C or initialization/readback requirements. STAT1 connects GPIO40; PG and STAT2 are intentionally NC. GPIO40 remains uninterpreted input. No obsolete BQ25620 writes/addresses exist in source.
  • U1, U2/U24, U5, U17, U18/U19/U20, U13, U26/U27, U31, U32/U33 and discrete gates: hardware-only ideal diode/bucks/buck-boost/USB admission/comparators/switching/interlocks; no firmware register interfaces invented. U31 receives no edges. No host sensing of actual CE, charge current, pack NTC or individual hardware permissions; use instruments.
Commands: r readings, i host identity/wiring, ? help; every other byte rejected. No credentials needed. No radio transmit, pack charging or CAN injection by default or by any starter command.
Completion and dependencies
Final read-only U6 net inspection after archive creation confirmed unchanged IO41→CHARGE_ENABLE→U31 TRIG and the sensor/CAN/modem mapping above; IO40 is CHGR_STAT1_N→BQ24610 STAT1 with R95 pull-up. The compiled starter keeps IO40 high-impedance with no interpretation, so no binary change is needed. PG/STAT2 are intentionally NC; production STAT1 decoding is not implemented. The archive README preserves the earlier pending-status snapshot; this document is the newer hardware mapping and does not change the archived source or hashes.
Completed: live mapping/device audit; complete source; final compile; sanitizer decode tests; linked-hook and source-level safety readback; durable archive and project files. Explicit unsupported interfaces: external-probe Celsius, modem AT identification/programming, CAN active reception/injection, future SPI accessory and final charger-status decoding. These are not fabricated implementations. Unattempted: physical flashing, waveform/sensor validation, charging, RF/CAN tests and manufacturing release.
Production work remains: sensing/NTC calibration, bounded telemetry/queue/retry behavior, independent modem image validation/provisioning, secure credentials/update/recovery, CAN protocol, sleep/runtime budget, watchdog/temperature/source/fault policy, STAT1 decoding and all hardware charging release tests. A separate reviewed implementation is required for charging; do not add a hidden enable flag here.
  • Scope and safety — 23 October 2026

  • Exact build result

  • Build, flash and console

  • Safe boot and complete MCU mapping

  • Device initialization and read definitions

  • Completion and dependencies