This is an automated email from Gerrit.

"Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/8436

-- gerrit

commit 999d6afcd67b6d565a1fb47aadb60fdd9b9517af
Author: Tomas Vanek <van...@fbl.cz>
Date:   Thu Feb 15 20:13:08 2024 +0100

    jtag/swd.h: send more SWDIO 1 bits in SWD to DORMANT seq
    
    If the synchronisation between an adapter and a device gets lost
    for whatever reason we need to send extra ones to finish
    the started SWD command first and then 50 bits of line reset starts
    counting. In the worst case it could require up to 39 additional
    one bits.
    
    The most probable scenario how this problem could happen
    is a SWD FAULT or WAIT during the first connect before OpenOCD sets
    ORUNDETECT in DP CTRL/STAT.
    
    Use longer sequence to ensure it works in any case.
    
    Signed-off-by: Tomas Vanek <van...@fbl.cz>
    Change-Id: I8eecfac8427a03d0ca8c0c462d90a830c4d21cdb

diff --git a/src/jtag/swd.h b/src/jtag/swd.h
index 5f626c1bf8..d393de403a 100644
--- a/src/jtag/swd.h
+++ b/src/jtag/swd.h
@@ -151,12 +151,16 @@ static const unsigned swd_seq_swd_to_jtag_len = 80;
  * Bits are stored (and transmitted) LSB-first.
  */
 static const uint8_t swd_seq_swd_to_dormant[] = {
-       /* At least 50 SWCLK cycles with SWDIO high */
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+       /* At least 50 SWCLK cycles with SWDIO high.
+        * Send more (at least 89, actually 96) to ensure the sequence works
+        * in the middle of a SWD command, e.g. after error
+        * if overrun detection is mismatched */
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+       0xff, 0xff, 0xff, 0xff,
         /* Switching sequence from SWD to dormant */
        0xbc, 0xe3,
 };
-static const unsigned swd_seq_swd_to_dormant_len = 72;
+static const unsigned swd_seq_swd_to_dormant_len = 112;
 
 /**
  * Dormant-to-SWD sequence.

-- 

Reply via email to