This is an automated email from Gerrit. "Marian Buschsieweke <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9722
-- gerrit commit 99b19d5517b145e6fb4f89fd57709641084708b8 Author: Marian Buschsieweke <[email protected]> Date: Thu May 28 20:55:49 2026 +0200 tcl/target: restore power management on ATSAME5x after shutdown This registers a shutdown handler to restore the power management on shutdown. This solves the issue that MCUs do not enter low power mode after OpenOCD connected until a power-on reset is performed. Change-Id: I623930461fd54c7182a45fe8bea76c509ddc5cd6 Signed-off-by: Marian Buschsieweke <[email protected]> diff --git a/tcl/target/atsame5x.cfg b/tcl/target/atsame5x.cfg index 0f759a242c..ae84582d00 100644 --- a/tcl/target/atsame5x.cfg +++ b/tcl/target/atsame5x.cfg @@ -69,3 +69,16 @@ if {![using_hla]} { set _FLASHNAME $_CHIPNAME.flash flash bank $_FLASHNAME atsame5 0x00000000 0 1 1 $_TARGETNAME + +# The documentation of dpreg suggests to use `poll off` to prevent background +# activity to disturg low level access. Specifically, we will allow the target +# to enter low power modes again, which may result in the target to immediately +# do so and become unresponsive on the debug port. Not having background +# activity failing will result in a clear output. +lappend pre_shutdown_commands {poll off} + +# Now we clear CTRL/STAT register (at offset 4) of the debug port. +# We mostly care about the CSYSPWRUPREQ and CDBGPWRUPREQ bits that request the +# MCU to be powered, so that target's power management is resuming normal +# operation once we disconnect. +lappend pre_shutdown_commands {atsame5.dap dpreg 4 0} --
