Feature: Add BPIO2 support for UART Glitch mode:
What I’m trying to do
Being able to control UART glitching through BPIO2 would let me:
- Run automated parameter sweeps from Python
- Log results programmatically
- Integrate with other tools in my workflow
Current glitch parameters
From looking at src/commands/uart/glitch.c, these are the settings:
| Parameter | What it does |
|---|---|
glitch_trg |
Character that triggers the glitch (default: 13 = Enter) |
glitch_delay |
How long after the stop bit to fire (in 10ns units) |
glitch_wander |
How much to vary the timing for sweeping |
glitch_time |
How long the glitch pulse lasts |
glitch_recycle |
Minimum wait between attempts (ms) |
fail_resp |
Character that means “bad password” (to detect success) |
retry_count |
How many times to try before giving up |
disable_ready |
Skip checking the ready input |
Pins used:
- IO0 - Trigger output (goes to your glitcher)
- IO1 - Ready input (optional - glitcher signals when it’s recharged)
What I’d like to see
Something like this in Python:
client = BPIOClient('/dev/cu.usbmodem6buspirate3')
# Set up UART first (needs issue #1)
client.configuration_request(mode='UART', mode_configuration={'speed': 115200})
# Start the glitch attack
client.uart_glitch_request(
trigger_char=13, # Enter key
delay_ns10=100, # Start at 1000ns delay
wander_ns10=50, # Sweep ±500ns
pulse_ns10=10, # 100ns pulse
fail_char=ord('#'), # '#' means bad password
max_retries=1000,
start=True
)
# Check progress
while True:
status = client.uart_glitch_status()
if status['success']:
print(f"Got it! Response: {status['response']}")
break
if not status['running']:
print("No luck this time")
break
Notes
- This depends on basic UART BPIO2 support being added first (issue #1)
- The existing PIO code in
glitch.pioshould work as-is - Would be nice if it auto-stops when you disconnect or change modes
Happy to help test if you want to point me at a branch!
Issue opened by: tc-mgriff