This is an automated email from Gerrit.

"Nishanth Menon <[email protected]>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/9725

-- gerrit

commit 0be5a94827fa4e9e33ea040c5cd14840d31ecf58
Author: Nishanth Menon <[email protected]>
Date:   Thu May 28 10:54:31 2026 -0500

    tcl/target/ti/mspm0: fix mspm0_board_reset DebugSS recovery
    
    Using 'reset_config srst_only' (without srst_nogate) causes
    cortex_m_deassert_reset to call dap_dp_init_or_reconnect immediately
    after nRST is deasserted. The MSPM0 DebugSS needs time to recover
    after nRST, so this DAP reconnect races and fails intermittently,
    propagating an error back through catch.
    
    Fix by adding srst_nogate to skip the automatic DAP re-init in
    deassert_reset, then explicitly polling arp_examine every 100ms until
    the DebugSS is ready, with a 2s timeout. This avoids an arbitrary
    fixed sleep and gives a clear error if the DebugSS genuinely fails to
    come up. This duration can vary depending on the device operational
    frequency, an arbitrary 2s upper bound is selected as conservative 2x
    debug subsystem mailbox timeout.
    
    Change-Id: Ie72b2a981fbad5bf4ef7bfe23c05a4d92c8a0e87
    Signed-off-by: Nishanth Menon <[email protected]>

diff --git a/tcl/target/ti/mspm0.cfg b/tcl/target/ti/mspm0.cfg
index 95867a75ed..199b764bc9 100644
--- a/tcl/target/ti/mspm0.cfg
+++ b/tcl/target/ti/mspm0.cfg
@@ -153,16 +153,33 @@ add_help_text mspm0_start_bootloader "Ask explicitly for 
bootloader startup"
 # However this cannot be the default configuration as this
 # prevents reset init reset halt to function properly
 # since the Debug Subsystem (debugss) logic or coresight
-# seems impacted by nRST.
+# seems impacted by nRST. srst_nogate is used to skip the
+# automatic DAP re-init in cortex_m_deassert_reset since
+# the MSPM0 DebugSS needs time (depends on device frequency)
+# to recover after nRST before the DAP is accessible.
+# We manually poll arp_examine with a timeout instead of
+# relying on a fixed sleep.
+#
 # This can be overridden in board file as required.
 #
 # mspm0_board_reset: Board level reset
 proc mspm0_board_reset {} {
        set user_reset_config [reset_config]
-       reset_config srst_only
+       reset_config srst_only srst_nogate
        set errno [catch {reset} errmsg]
        eval reset_config $user_reset_config
        if {$errno} {error "board reset failed with error: $errmsg ($errno)"}
+       # Poll until DebugSS is ready, up to 2000ms
+       set timeout 2000
+       set step 100
+       while {$timeout > 0} {
+               if {![catch {$::_TARGETNAME arp_examine}]} {
+                       return
+               }
+               sleep $step
+               set timeout [expr {$timeout - $step}]
+       }
+       error "board reset: DebugSS failed to come up within timeout"
 }
 
 add_help_text mspm0_board_reset "Request a board level reset"

-- 

Reply via email to