Skip to content

Commit 0607cfa

Browse files
committed
feat(test_runner): don't reset the whole RP2040 bootrom device, only the PICOBOOT interface
1 parent af2d37f commit 0607cfa

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/r3_test_runner/src/targets/rp_pico.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,6 @@ fn open_picoboot() -> Result<PicobootInterface> {
286286
.open()
287287
.with_context(|| format!("Failed to open the device '{:?}'.", device))?;
288288

289-
// Reset the device
290-
device_handle
291-
.reset()
292-
.with_context(|| format!("Failed to reset the device '{:?}'.", device))?;
293-
294289
// Claim the interface
295290
device_handle
296291
.claim_interface(interface_i)
@@ -301,6 +296,24 @@ fn open_picoboot() -> Result<PicobootInterface> {
301296
)
302297
})?;
303298

299+
// Reset the PICOBOOT interface
300+
//
301+
// This request is handled by this code:
302+
// <https://github.com/raspberrypi/pico-bootrom/blob/00a4a19114/bootrom/usb_boot_device.c#L229>
303+
//
304+
// The RP2040 datasheet (release 1.2) says `bmRequestType` is `00100001b`,
305+
// but it's actually `01000001b`.
306+
// <https://github.com/raspberrypi/pico-feedback/issues/99>
307+
log::debug!("Sending INTERFACE_RESET");
308+
device_handle
309+
.write_control(0x41, 0x41, 0x0000, interface_i as u16, &[], DEFAULE_TIMEOUT)
310+
.with_context(|| {
311+
format!(
312+
"Failed to send INTERFACE_RESET to the device '{:?}'.",
313+
device
314+
)
315+
})?;
316+
304317
Ok(PicobootInterface {
305318
device_handle,
306319
out_endpoint_i,

0 commit comments

Comments
 (0)