We are seeing an asymmetric SWJ‑DP mode‑switching issue on the SoC:
For reference, at IP level this switching works. The IP uses dap_dp_switchmode() whereas the SoC flow uses dap_dp_switchmode1(), which dynamically adapts to the SoC component tree/ROM‑table rather than a fixed pointer. Function definitions are in the attached document.
Test sequence (SoC):
Failing sequence (SWD → JTAG):
Passing sequence(JTAG -> SWD):
Core/IP Passing Sequence:
uint32_t dap_dp_switchmode(void)
{
uint32_t sw_dpidr = 0;
uint32_t jtag_idcode = 0;
if(init_data.default_route_index == 0)
MSG("[CXDT MSG] dap_dp_switchmode: Switching route to access the DP using Serial Wire:\n");
init_data.default_route_index = 1;
if(SelectMemRoute(&mydp->addr, 0, route_p, MAX_ROUTESTEPS) == 0)
return FAIL;
if(ReadReg(DP_DPIDR, &sw_dpidr, route_p) == FAIL)
MSG("[CXDT MSG] dap_dp_switchmode: Read SW_DPIDR: 0x%08x", sw_dpidr);
// Check for expected value
if(sw_dpidr == EXPECTED_SW_DPIDR)
MSG("\n");
return PASS;
}
else
MSG_ERROR("Expected SW DPIDR: 0x%08x\n", EXPECTED_SW_DPIDR);
if(init_data.default_route_index == 1)
MSG("[CXDT MSG] dap_dp_switchmode: Switching route to access the DP using JTAG:\n");
init_data.default_route_index = 0;
if(ReadReg(JTAG_IDCODE, &jtag_idcode, route_p) == FAIL)
MSG("[CXDT MSG] dap_dp_switchmode: Read JTAG IDCODE: 0x%08x", jtag_idcode);
if(jtag_idcode == EXPECTED_JTAG_IDCODE)
MSG("Expected JTAG IDCODE: 0x%08x\n", EXPECTED_JTAG_IDCODE);
uint32_t dap_dp_switchmode1(void)
if(SOC_DATA.default_route_index == 0)
MSG("[CXDT MSG] dap_dp_switchmode1: Switching route to access the DP using Serial Wire:\n");
SOC_DATA.default_route_index = 1;
for(uint32_t instindex = 0; instindex < *socdata_p->num_components_p; instindex++)
csinst_t * inst_p = &socdata_p->components_p[instindex];
if(inst_p->type == DEBUGPORT)
MSG("\nCXDT MSG:Checking Debug Port: inst[%u] (%s)\n", instindex, inst_p->name);
if(SelectMemRoute(&inst_p->addr, 0, route_p, MAX_ROUTESTEPS) == 0)
MSG_ERROR("TUBE:Could not access DP.\n");
MSG("[CXDT MSG] dap_dp_switchmode1: Read SW_DPIDR: 0x%08x", sw_dpidr);
if(SOC_DATA.default_route_index == 1)
MSG("[CXDT MSG] dap_dp_switchmode1: Switching route to access the DP using JTAG:\n");
SOC_DATA.default_route_index = 0;
MSG("[CXDT MSG] dap_dp_switchmode1: Read JTAG IDCODE: 0x%08x", jtag_idcode);
Please raise an official support case from the menu below.
I do not think this level of question can be addressed in a public forum.
If the suggested AI response does not answer your query there should be a button saying (something like) "Continue to open case".
Have you used a free email account (gmail or similar?). Those may be blocked.