Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM:Add Jtag to Dormant sequence in case the target has both jtag and swd #1959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/target/adiv5_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
#define ADIV5_SWD_TO_JTAG_SELECT_SEQUENCE 0xe73cU /* 16 bits, LSB (MSB: 0x3ce7) */
#define ADIV5_JTAG_TO_SWD_SELECT_SEQUENCE 0xe79eU /* 16 bits, LSB (MSB: 0x79e7) */

/* ADIv5 JTAG to dormant sequence */
#define ADIV5_JTAG_TO_DORMANT_SEQUENCE0 0x1fU /* 5 bits */
#define ADIV5_JTAG_TO_DORMANT_SEQUENCE1 0x33bbbbbaU /* 31 bits, LSB (MSB : 0x2eeeeee6) */
#define ADIV5_JTAG_TO_DORMANT_SEQUENCE2 0xffU /* 8 bits */

/*
* ADIv5 Selection Alert sequence
* This sequence is sent MSB first and can be represented as either:
Expand Down
12 changes: 10 additions & 2 deletions src/target/adiv5_swd.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,19 @@ static void dormant_to_swd_sequence(void)
* §5.3.4 Switching out of Dormant state
*/

DEBUG_INFO("Switching out of dormant state into SWD\n");

/* Send at least 8 SWCLKTCK cycles with SWDIOTMS HIGH */
swd_line_reset_sequence(false);

/*
* If the target is both JTAG and SWD with JTAG as default, switch JTAG->DS first.
* See B5.3.2
*/
DEBUG_INFO("Switching from JTAG do dormant\n");
swd_proc.seq_out(ADIV5_JTAG_TO_DORMANT_SEQUENCE0, 5U);
swd_proc.seq_out(ADIV5_JTAG_TO_DORMANT_SEQUENCE1, 31U);
swd_proc.seq_out(ADIV5_JTAG_TO_DORMANT_SEQUENCE2, 8U);
/* Send the 128-bit Selection Alert sequence on SWDIOTMS */
DEBUG_INFO("Switching out of dormant state into SWD\n");
swd_proc.seq_out(ADIV5_SELECTION_ALERT_SEQUENCE_0, 32U);
swd_proc.seq_out(ADIV5_SELECTION_ALERT_SEQUENCE_1, 32U);
swd_proc.seq_out(ADIV5_SELECTION_ALERT_SEQUENCE_2, 32U);
Expand Down
Loading