Schematic Fixes


Thought for 9 mins 8 sec
Referenced guidance.
Created 3 tasks.
1/3 Audit schematic connectivity and MCU support circuits

Audit schematic connectivity and MCU support circuits

Apply focused schematic fixes

Re-run ERC and verify corrected nets

Thought for 17 sec
Thought for 6 sec
Awaiting 1 background task
Thought for 7 sec
Checking Binary Watch Schematic Audit progress…
"Binary Watch Schematic Audit" completed.
The repair pass is complete. I’m independently checking the updated ERC results and the critical MCU, clock, button, LED, and programming nets now.
Schematic issues fixed: added NRST filtering, three button pull-ups, corrected LSE capacitors to 8.2 pF, and marked unused MCU/header pins no-connect. Fresh ERC and passive checks are clean.
Open items: select a real low-leakage Schottky MPN and place/route the four new passives on the PCB. Full details: Schematic Audit Report.
Design-wise, I'd like the diodes to be centered on a circular board, with the battery on the backside
I’ll reorganize the PCB so the LED display is centered and visually balanced on the circular face, with the coin-cell holder moved to the back, then check overlaps and board-edge clearance.
The board is currently a 45 × 38 mm rounded rectangle, with 12 LEDs in two rows and the battery holder on top. I propose a 45 mm circular board, a centered 3 × 4 LED grid on the front, buttons along the right edge, and the CR2032 holder on the back; other circuitry stays around the display where practical.
Confirm this arrangement and I’ll implement the placement.

Firmware Starter — STM32L433 Binary Watch
Platform & Toolchain
  • MCU: STM32L433CBT6
  • Framework: Arduino STM32 core via PlatformIO
  • Power model: sleep most of the time, wake on button, show LEDs for a short timeout
  • Clock: 32.768 kHz LSE crystal on PC14/PC15 for RTC timekeeping
Pin Mapping

Table


FunctionMCU PinNetDirectionNotes
Hour bit 1PA0LED_H1OutputLED through R1
Hour bit 2PA1LED_H2OutputLED through R2
Hour bit 4PA2LED_H4OutputLED through R3
Hour bit 8PA3LED_H8OutputLED through R4
Minute bit 1PA4LED_M1OutputLED through R5
Minute bit 2PA5LED_M2OutputLED through R6
Minute bit 4PA6LED_M4OutputLED through R7
Minute bit 8PA7LED_M8OutputLED through R8
Minute bit 16PB0LED_M16OutputLED through R9
Minute bit 32PB1LED_M32OutputLED through R10
PM/Accent LEDPB10LED_AMPMOutputOptional PM indicator
Decorative LEDPB11LED_DECOROutputOptional flair/status LED
Display/Wake buttonPB12BTN_DISPLAYInput pull-upButton shorts to GND
Mode buttonPB13BTN_MODEInput pull-upButton shorts to GND
Set buttonPB14BTN_SETInput pull-upButton shorts to GND
LSE crystal inPC14LSE_INAnalog clock32.768 kHz crystal
LSE crystal outPC15LSE_OUTAnalog clock32.768 kHz crystal
SWDIOPA13SWDIODebugSWD header
SWCLKPA14SWCLKDebugSWD header
ResetNRSTNRSTResetSWD header reset
platformio.ini

Ini


[env:genericSTM32L433CB]
platform = ststm32
board = genericSTM32L433CB
framework = arduino
upload_protocol = stlink
debug_tool = stlink
monitor_speed = 115200
build_flags =
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
src/main.cpp

Cpp


#include <Arduino.h>
#include <STM32RTC.h>

STM32RTC& rtc = STM32RTC::getInstance();

#define LED_H1       PA0
#define LED_H2       PA1
#define LED_H4       PA2
#define LED_H8       PA3
#define LED_M1       PA4
#define LED_M2       PA5
#define LED_M4       PA6
#define LED_M8       PA7
#define LED_M16      PB0
#define LED_M32      PB1
#define LED_PM       PB10
#define LED_DECOR    PB11

#define BTN_DISPLAY  PB12
#define BTN_MODE     PB13
#define BTN_SET      PB14

const uint8_t hourLedPins[4] = {LED_H1, LED_H2, LED_H4, LED_H8};
const uint8_t minuteLedPins[6] = {LED_M1, LED_M2, LED_M4, LED_M8, LED_M16, LED_M32};
const uint8_t allLedPins[12] = {
  LED_H1, LED_H2, LED_H4, LED_H8,
  LED_M1, LED_M2, LED_M4, LED_M8, LED_M16, LED_M32,
  LED_PM, LED_DECOR
};

const uint32_t DISPLAY_TIMEOUT_MS = 5000;
uint32_t displayUntil = 0;
bool showing = false;

void allLedsOff() {
  for (uint8_t pin : allLedPins) {
    digitalWrite(pin, LOW);
  }
}

void showBinaryTime() {
  uint8_t hour24 = rtc.getHours();
  uint8_t minute = rtc.getMinutes();
  bool pm = hour24 >= 12;
  uint8_t hour12 = hour24 % 12;
  if (hour12 == 0) hour12 = 12;

  for (int i = 0; i < 4; i++) {
    digitalWrite(hourLedPins[i], (hour12 & (1 << i)) ? HIGH : LOW);
  }
  for (int i = 0; i < 6; i++) {
    digitalWrite(minuteLedPins[i], (minute & (1 << i)) ? HIGH : LOW);
  }
  digitalWrite(LED_PM, pm ? HIGH : LOW);
  digitalWrite(LED_DECOR, HIGH);

  showing = true;
  displayUntil = millis() + DISPLAY_TIMEOUT_MS;
}

bool pressed(uint8_t pin) {
  static uint32_t lastMs = 0;
  if (digitalRead(pin) == LOW && millis() - lastMs > 180) {
    lastMs = millis();
    return true;
  }
  return false;
}

void incrementHour() {
  uint8_t h = rtc.getHours();
  h = (h + 1) % 24;
  rtc.setHours(h);
}

void incrementMinute() {
  uint8_t m = rtc.getMinutes();
  m = (m + 1) % 60;
  rtc.setMinutes(m);
  rtc.setSeconds(0);
}

void setup() {
  for (uint8_t pin : allLedPins) {
    pinMode(pin, OUTPUT);
    digitalWrite(pin, LOW);
  }

  pinMode(BTN_DISPLAY, INPUT_PULLUP);
  pinMode(BTN_MODE, INPUT_PULLUP);
  pinMode(BTN_SET, INPUT_PULLUP);

  // Use external 32.768 kHz LSE crystal where supported by the board core.
  rtc.setClockSource(STM32RTC::LSE_CLOCK);
  rtc.begin();

  // First-program default. User can set using MODE/SET buttons.
  if (!rtc.isTimeSet()) {
    rtc.setTime(12, 0, 0);
    rtc.setDate(1, 1, 24);
  }
}

void loop() {
  if (pressed(BTN_DISPLAY)) {
    showBinaryTime();
  }

  // Simple setting mode while LEDs are awake:
  // MODE increments hours, SET increments minutes.
  if (showing && pressed(BTN_MODE)) {
    incrementHour();
    showBinaryTime();
  }
  if (showing && pressed(BTN_SET)) {
    incrementMinute();
    showBinaryTime();
  }

  if (showing && (int32_t)(millis() - displayUntil) >= 0) {
    allLedsOff();
    showing = false;
  }

  // For the first revision, keep this simple. Later firmware can enter STOP mode
  // and wake from EXTI on BTN_DISPLAY for much longer battery life.
  delay(20);
}
Build & Flash
  1. Install PlatformIO.
  2. Connect ST-Link to SWD header: VDD, GND, SWDIO, SWCLK, NRST.
  3. Build: pio run
  4. Flash: pio run -t upload
  5. If low-power optimization is needed, replace the simple delay(20) loop with STM32 STOP mode and wake on the display button EXTI interrupt.
  • Platform & Toolchain

  • Pin Mapping

  • `platformio.ini`

  • `src/main.cpp`

  • Build & Flash