Gadgeteer & Shortcut
Hey Shortcut, have you heard about the new ultra‑low‑power microcontroller that clocks down to 0.5 µA in sleep mode? I’m curious how that could shave milliseconds off a speedrun.
Yeah, that’s the one I’ve been eyeing. If you can keep the MCU in 0.5 µA mode while waiting for input, the wake‑up latency drops a lot—just a few hundred microseconds. In a 100‑second run that’s a handful of milliseconds that can be the difference between a new record and a miss. The trick is to design the loop so the CPU sleeps as soon as it’s safe and only wakes for critical events. It’s a perfect blend of low power and speed, just what we need.
That’s exactly the sweet spot—wake‑up latency in the sub‑500 µs range can turn the tide in a tight race. I’d start by profiling the current ISR chain, make sure the debounce logic is snappy, and then tweak the watchdog timeout to the minimal viable period. If you can lock the sleep transition to an edge‑triggered pin instead of polling, you’ll avoid those hidden micro‑seconds of overhead. Just keep an eye on the interrupt coalescence; over‑disabling interrupts to save power can backfire if you miss a cascade event. It’s a tight dance between power budget and latency—let’s dive into the register map and pin‑mux matrix to map it out.
Nice plan—profiling the ISR first is the move, no surprises. Keep that debounce tight, watch the watchdog, and use an edge trigger for sleep. Just remember if you over‑kill the interrupt gating you’ll miss a cascade. Let’s hit the register map and pin‑mux, lock down the timing, and squeeze those microseconds. This is the sweet spot.
Right on—tight debounce, minimal watchdog window, and an edge‑triggered pin‑mux for the sleep edge. Just keep the ISR chain short, maybe pull the watchdog reload out of the ISR and into a timer that wakes only if a cascade is imminent. Then map the core registers, lock the clock gating, and you’ll see those microseconds squeeze out. Let’s get to it.
Sounds solid—let's lock the watchdog into a timer, keep the ISR lean, and punch those edge‑triggers. Hit the clock gating and register map, and we’ll squeeze every microsecond out. Let's dive in.
Got it—watch the watchdog timer, keep ISR lean, lock those edge triggers, and we’ll hit the clock gating just right. Let’s dive into the register map and squeeze every microsecond we can.
Got it, let’s pull up the register map and start tightening everything—watchdog on timer, lean ISR, edge triggers, clock gating lock‑in. Every microsecond counts, so let’s get to it.
Alright, pull up the datasheet, pin‑mux table, and clock tree. We’ll lock the watchdog into the timer, strip the ISR down to a single flag set, and hook the sleep edge to the input pin. Then we can gate the unused clocks and watch the timing tighten. Let’s get those numbers.
Here’s the quick reference we need:
**Datasheet Summary**
- Core: 32‑bit RISC‑V, 48 MHz max, 0.5 µA sleep
- Flash: 512 KB, 3 V‑5 V supply
- RAM: 64 KB, 3 V‑5 V supply
- I/O: 48 GPIOs, 6‑channel ADC, 2‑channel DAC, UART, SPI, I²C, PWM
- Power: LDO regulator 3.3 V, optional buck to 1.8 V for peripherals
**Pin‑mux Table (selected)**
| Function | Pin | Mode | Comment |
|----------|-----|------|---------|
| GPIO0 | PA0 | GPIO | Sleep wake‑up |
| GPIO1 | PA1 | ADC0 | Pin‑mux for ADC input |
| UART_TX | PB0 | UART | Primary data out |
| UART_RX | PB1 | UART | Primary data in |
| SPI_SCK | PB2 | SPI | Clock line |
| SPI_MOSI | PB3 | SPI | Master out |
| SPI_MISO | PB4 | SPI | Master in |
| PWM0 | PB5 | PWM | Low‑power timing test |
| I²C_SCL | PB6 | I²C | I²C master |
| I²C_SDA | PB7 | I²C | I²C master |
**Clock Tree**
- Main oscillator 12 MHz crystal → PLL → 48 MHz system clock
- Sysclk → Core, AHB, APB bus
- Peripheral clock gates per module (ADC, UART, SPI, PWM, I²C)
- Low‑power clock domain: 32 kHz from RTC for sleep wake‑up
- Watchdog timer runs on 1 MHz internal clock, can be gated off during active run
**Implementation Tips**
- Gate peripheral clocks that aren’t used during the active phase.
- Use the 32 kHz RTC to time wake‑ups for the watchdog timer.
- Set GPIO0 as an edge‑triggered wake‑up pin; keep it high‑impedance to save leakage.
- In the ISR, just set a flag and clear the interrupt; let the main loop handle the heavy lifting.
That’s the skeleton—let me know which section you want to drill into next.
Sounds like a solid skeleton. I’d say start with the watchdog timer first—lock it into that 1 MHz core clock and gate it off when you’re in the active phase. Once that’s nailed, we can push the GPIO0 edge trigger into the low‑power domain and lock the peripheral clocks. Which part do you want to dig into first?