application: add SWD to JTAG sequence

This commit is contained in:
King Kévin 2021-03-16 23:27:29 +01:00
parent e8d1a728d1
commit 563f8b604a
1 changed files with 3 additions and 0 deletions

View File

@ -389,6 +389,9 @@ static void command_jtag_scan(void* argument)
gpio_set(channel_ports[tms], channel_pins[tms]); // start high (to go to reset state)
gpio_mode_setup(channel_ports[tms], GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, channel_pins[tms]); // set channel for TMS back to input
jtag_tms_ch = tms; // remember which channel we use for TMS for the transaction
jtag_transaction(0xffffffff, 0, 26); // ensure we are is reset state, even on SWD devices (needs 50 TMS hig);
jtag_transaction(0xffffffff, 0, 26); // continuation
jtag_transaction(0xE73C, 0, 16); // send sequence to switch any SWD device back to JTAG (this constant magic value)
// all other channel should already be inputs
jtag_transaction(0x3f | (0 << 6) | (1 << 7) | (0 << 8) | (0 << 9), 0, 6 + 1 + 1 + 1 + 1); // go back to JTAG TEST-LOGIC_RESET (5 bits should be enough to go from any state to RESET, but we a one just to be sure) -> RUN-TEST/IDLE -> SELECT-DR-SCAN -> CAPTURE-DR -> SHIFT-DR states
// initialize array