Skip to main content

connect_check

Function connect_check 

Source
pub fn connect_check(usbdev: &UsbDev) -> Result<Connect, String>
Expand description

Holds the tag in reset, reads its device ID and the supply voltage, and releases it: the connect check. The tag reboots afterwards.

The counterpart of qtprogram’s STM32_Programmer_CLI -c port=SWD mode=UR call. It uses tagcore’s LinkAdapt directly rather than a probe-rs session, so it is the same on every base generation and needs no target name: the ID is read from the L4 DBGMCU_IDCODE address and then the U3 one, and the first plausible value (low 12 bits neither all zeros nor all ones) wins.

Whatever the tag was doing is ended by the reset, and releasing nRST at the end boots its firmware from the start.

§Errors

  • "Cannot open the base" if the base cannot be opened or attached;
  • "No STM32 target found" if neither ID address reads plausibly (no tag on the cradle, an unpowered tag, or an unrecognised part).