Files
STM32F4-Base/MDK-ARM/retracted_bench_20260922/probe_partial.py
T

31 lines
1.2 KiB
Python

# Battery C (partial drain + partial read): 64x10 + 1460 fill + 1460 canary + tail 64x10.
# Firmware variant: PHASE6_RECV_LIMIT=1024 (drains only 1024 of the 1460 fill),
# PHASE_PROBE_ARM_MIN=1000 (probe arms on that partial drain). The probe then reads
# 64B from the 436B REMAINDER (partial buffer, partial read, after a NON-full drain:
# window re-announced 588 -> 1612, never zero). If the canary stalls, partial drains
# also create the fragile window; if it passes, only the zero-window (exact-full)
# re-arm is fragile.
from probe_bench_lib import *
def main():
s = connect()
if not send_rounds64(s, 10, 0, "R"):
finish(s, 1)
b1460 = pattern(640, 1460)
s.sendall(b1460)
# echo of the fill = first 1024 (drained) + 436 remainder minus probe-eaten 64
rx, _ = wait_step(s, 1460, "B1460", 2.0)
time.sleep(0.15)
k1460 = pattern(2100, 1460) # canary (separate pattern region)
s.sendall(k1460)
time.sleep(0.30)
tail_base = 2100 + 1460
for i in range(10):
s.sendall(pattern(tail_base + i * 64, 64))
rx2, _ = wait_step(s, 2100, "K1460+TAIL", 4.0)
hexdump(rx)
hexdump(rx2, "HEX2")
finish(s, 0)
main()