diff --git a/crates/dsm-anchor-pico/src/main.rs b/crates/dsm-anchor-pico/src/main.rs index 8c9283772..d9dcc5cb9 100644 --- a/crates/dsm-anchor-pico/src/main.rs +++ b/crates/dsm-anchor-pico/src/main.rs @@ -474,6 +474,10 @@ fn main() -> ! { // ---- Phase 1: raw link probe ~3s while USB enumerates ---- let probe_until = timer.get_counter().ticks() + 3_000_000; let mut last = timer.get_counter(); + // What the chip last put on MISO for the raw probe: the halt below reports + // it, so a silent bus (all 0x00 or all 0xFF) reads apart from a chip that + // answers but is refused. + let mut probe_rx = [0u8; 4]; while timer.get_counter().ticks() < probe_until { usb_dev.poll(&mut [&mut serial]); if (timer.get_counter() - last).to_millis() >= 1000 { @@ -481,6 +485,7 @@ fn main() -> ! { let mut rx = [0u8; 4]; let tx = [0xAAu8, 0, 0, 0]; let _ = spi_dev.transfer(&mut rx, &tx); + probe_rx = rx; let _ = serial.flush(); } } @@ -493,14 +498,22 @@ fn main() -> ! { let mut tropic = Tropic01::new(spi_dev); let chip_id_hash = match tropic.get_info_chip_id() { Ok(id) => anchor_core::hash::h("DSM/anchor/chip-id/v1", &[id]), - Err(_) => { - put( - &mut serial, - b"[T1] chip id: FAIL (no real identity; halting)\r\n", + Err(e) => { + // The halt names its cause, and repeats it: the banner is printed + // once at boot, before a phone or a Mac has attached to read it. + let why = alloc::format!( + "[T1] chip id: FAIL (no real identity; halting): {e:?}; raw probe MISO {probe_rx:?}\r\n" ); + put(&mut serial, why.as_bytes()); let _ = serial.flush(); + let mut last = timer.get_counter(); loop { usb_dev.poll(&mut [&mut serial]); + if (timer.get_counter() - last).to_millis() >= 2000 { + last = timer.get_counter(); + put(&mut serial, why.as_bytes()); + let _ = serial.flush(); + } } } };