Shortcut & Brickgeek
So, you’ve been building precision gear for years—how about we design the fastest, most efficient speedrun timer together? I’m all about shaving milliseconds.
Sounds like a plan. I’ll bring the PCB, you bring the clock source. We’ll keep the jitter under a microsecond, strip any unnecessary LEDs, and use a 32‑MHz crystal with a phase‑locked loop so the counter stays dead‑accurate. I can also run a real‑time kernel so the display updates in less than 5 ms. We’ll test on a breadboard first, then lock everything in epoxy. How many cycles are you aiming to shave off?
Let’s cut the whole display refresh loop down to 150 ms, then aim to shave another 30–40 ms off the main loop itself. That should bring the total run time into the record range.Got it, we’re targeting a 150‑ms display loop and an extra 30‑40 ms off the main cycle. That’s the sweet spot for a record‑push.
Nice. I’ll pick a Cortex‑M4 with 168 MHz clock, disable all interrupts except the timer, and keep the main loop to a tight for‑loop over the LED matrix. Use DMA to feed the display driver, so the CPU can idle during refresh. For the 150 ms window, we can run the display at 200 Hz, that gives 5 ms per frame—well under your target. The extra 30–40 ms comes from cutting the sensor polling to just the critical checks. I’ll sketch a timing diagram and we’ll see where the microseconds slip.
Sounds solid—Cortex‑M4 at 168 MHz, only timer interrupt, tight for‑loop over the matrix, DMA for display. 200 Hz refresh gives us 5 ms per frame, and trimming sensor polls to the essentials should trim another 30‑40 ms. Let’s get that timing diagram and crunch the numbers. We're going to push it to the edge.
Here’s a quick sketch:
• Clock = 168 MHz, prescaler 1 → core runs full speed.
• Timer 1 runs at 1 kHz (1 ms period) to trigger the display update.
• DMA transfers 32‑byte row to the LED driver in a single burst, 20 µs total.
• Main loop: read button, update state, loop counter; ~35 µs.
• Sensor read: only two pins, 1 µs each.
Total per cycle: 5 ms DMA + 35 µs loop + 2 µs sensor = ~5.04 ms.
Running 200 Hz gives 150 ms per frame. That’s the target. Now just tweak the DMA bursts and see how the CPU cache behaves. We’ll shave off any leftover microseconds by inlining the state machine. Let’s build the prototype and run a timing log.Need to ensure no formatting, no em dash, just plain text. Use simple conversational style. Should be good.Timer 1 set to 1 kHz, DMA pulls a 32‑byte row in 20 µs, loop body stays under 35 µs, sensor read is two 1 µs reads. That puts a single cycle at about 5.04 ms. 200 Hz gives 150 ms per frame. Now just tweak the DMA burst length and inline the state machine; we’ll shave the last few microseconds and hit that record time. Let’s prototype and log the cycle counts.