Skip to content

Commit

Permalink
Github-324: Clear DP sticky error bits in 'DebugPortStart' sequence (#…
Browse files Browse the repository at this point in the history
…326)

This PR addresses #324 and provides a proposal for how to update the
default `DebugPortStart` debug sequence to check and clear a DP's sticky
error bits before starting the DP power-up sequence.

The changed sequence was tested with Keil MDK uVision and Arm Debugger,
and with patched variants of real-world DFP PDSC files. Previously
failing combinations work now. Previously working combinations didn't
show regressions.

This PR updates both the docs revision history and the `Pack.xsd`
revision history. Though I am not entirely sure if the latter was really
necessary because this effectively is a docs-only change. Note the
version gap from a previous docs-only change.

---------

Co-authored-by: Joachim Krech <8290187+jkrech@users.noreply.github.com>
  • Loading branch information
jreineckearm and jkrech authored Aug 30, 2024
1 parent af51f5f commit ed2e497
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 14 deletions.
2 changes: 1 addition & 1 deletion doxygen/pack.dxy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Open-CMSIS-Pack"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Version 1.7.37"
PROJECT_NUMBER = "Version 1.7.39"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
6 changes: 6 additions & 0 deletions doxygen/src/General.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ The following sections provide more information:
<th>Version</th>
<th>Description</th>
</tr>
<tr>
<td>1.7.39</td>
<td>
- modified default 'DebugPortStart' debug sequence to clear DP sticky error bits
</td>
</tr>
<tr>
<td>1.7.38</td>
<td>
Expand Down
49 changes: 40 additions & 9 deletions doxygen/src/debug_description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,49 @@ Connect to the target debug port and power it up.
<sequence name="DebugPortStart">

<block>
__var SW_DP_ABORT = 0x0;
__var DP_CTRL_STAT = 0x4;
__var DP_SELECT = 0x8;
__var powered_down = 0;
__var SW_DP_ABORT = 0x0;
__var DP_CTRL_STAT = 0x4;
__var DP_SELECT = 0x8;
__var DP_STICKY_BITS = 0x000000B2; // DP CTRL/STAT: STICKYORUN | STICKYCMP | STICKYERR | WDATAERR
__var JTAG_DP_STICKY_BITS_CLR = 0x00000032; // DP CTRL/STAT: STICKYORUN | STICKYCMP | STICKYERR
__var SWD_DP_STICKY_BITS_CLR = 0x0000001E; // DP ABORT: ORUNERRCLR | WDERRCLR | STKERRCLR | STKCMPCLR
__var powered_down = 0;
__var ctrl_stat_val = 0;

// Switch to DP Register Bank 0
WriteDP(DP_SELECT, 0x00000000);

// Read DP CTRL/STAT Register and check if CSYSPWRUPACK and CDBGPWRUPACK bits are set
powered_down = ((ReadDP(DP_CTRL_STAT) &amp; 0xA0000000) != 0xA0000000);
ctrl_stat_val = ReadDP(DP_CTRL_STAT);
powered_down = ((ctrl_stat_val &amp; 0xA0000000) != 0xA0000000);
</block>

<!-- Check and clear sticky error bits -->
<control if="ctrl_stat_val &amp; DP_STICKY_BITS">

<!-- JTAG specific part -->
<control if="(__protocol &amp; 0xFFFF) == 1">

<block>
// Clear JTAG-DP sticky error bits by writing '1', preserve other values
WriteDP(DP_CTRL_STAT, ctrl_stat_val | JTAG_DP_STICKY_BITS_CLR);
</block>

</control>

<!-- SWD specific part -->
<control if="(__protocol &amp; 0xFFFF) == 2">

<block>
// Clear SWD-DP sticky error bits by writing to DP ABORT
WriteDP(SW_DP_ABORT, SWD_DP_STICKY_BITS_CLR);
</block>

</control>

</control>

<!-- Check if DP is powered down and power it up if so -->
<control if="powered_down">

<block>
Expand All @@ -485,26 +516,26 @@ Connect to the target debug port and power it up.
<!-- Wait for Power-Up Request to be acknowledged -->
<control while="(ReadDP(DP_CTRL_STAT) &amp; 0xA0000000) != 0xA0000000" timeout="1000000"/>

<!-- JTAG Specific Part of sequence -->
<!-- JTAG specific part -->
<control if="(__protocol &amp; 0xFFFF) == 1">

<block>
// Init AP Transfer Mode, Transaction Counter, and Lane Mask (Normal Transfer Mode, Include all Byte Lanes)
// Additionally clear STICKYORUN, STICKYCMP, and STICKYERR bits by writing '1'
WriteDP(DP_CTRL_STAT, 0x50000F32);
WriteDP(DP_CTRL_STAT, 0x50000F00 | JTAG_DP_STICKY_BITS_CLR);
</block>

</control>

<!-- SWD Specific Part of sequence -->
<!-- SWD specific part -->
<control if="(__protocol &amp; 0xFFFF) == 2">

<block>
// Init AP Transfer Mode, Transaction Counter, and Lane Mask (Normal Transfer Mode, Include all Byte Lanes)
WriteDP(DP_CTRL_STAT, 0x50000F00);

// Clear WDATAERR, STICKYORUN, STICKYCMP, and STICKYERR bits of CTRL/STAT Register by write to ABORT register
WriteDP(SW_DP_ABORT, 0x0000001E);
WriteDP(SW_DP_ABORT, SWD_DP_STICKY_BITS_CLR);
</block>

</control>
Expand Down
10 changes: 6 additions & 4 deletions schema/PACK.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
limitations under the License.
$Date: 13. May 2024
$Revision: 1.7.37
$Date: 30. Aug 2024
$Revision: 1.7.39
$Project: Schema File for Package Description File Format Specification
Package file name convention <vendor>.<name>.<version>.pack
SchemaVersion=1.7.37
SchemaVersion=1.7.39
30. Aug 2024: v1.7.39
- modified default 'DebugPortStart' debug sequence to clear DP sticky error bits (specification docs only)
13. May 2024: v1.7.37
- added Nationstech vendor
- added NSING vendor
Expand Down Expand Up @@ -231,7 +233,7 @@
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified" version="1.7.37">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified" version="1.7.39">

<!-- NonNegativeInteger specifies the format in which numbers are represented in hexadecimal or decimal format -->
<xs:simpleType name="NonNegativeInteger">
Expand Down

0 comments on commit ed2e497

Please sign in to comment.