Hello Luis,
We have now been able to establish an SWD debug connection by using the SPSDK Debug Mailbox tool.
The procedure we used is as follows:
1. Reset the MCU through the Debug Mailbox:
nxpdebugmbox -i mcu-link -s NBTF0IZ0B3DCX \
-o enable_recovery_reset=True \
--operation-timeout 5000 \
tool reset -f mcxn547
2. Start a debug session through the Debug Mailbox:
nxpdebugmbox -i mcu-link -s NBTF0IZ0B3DCX \
-o enable_recovery_reset=True \
--operation-timeout 5000 \
cmd -f mcxn547 start-debug-session
3. After the debug session has been opened, we connect to the Cortex-M33 core with LinkServer over SWD.
We did not use any authentication keys, passwords, debug credentials, or mass erase commands. It appears that the "start-debug-session" command temporarily enables AP0 through the always-accessible AP2 Debug Mailbox.
We also used the GDET register sequence from the NXP LS_preconnect_MCXN5XX.scp script after opening the debug session. The sequence disables the aGDET and dGDET reset routing and disables SPC glitch detection during debugging.
Regarding the power supplies:
- VDD_VBAT is directly connected to VDD, and both are 3.3 V.
- VDD_P4 is directly connected to VDD, and both are 3.3 V.
- VDD_ANA is connected to VDD through a ferrite bead.
- VDD is 3.3 V.
However, we now have another debugging problem.
When the board is powered on normally without an SWD debug reset, the firmware runs correctly. However, when we enter the debug session using the Debug Mailbox reset procedure described above, the firmware does not start correctly.
The debug connection is lost when single-stepping through the following SDK function:
static inline void SPC_SetActiveModeDCDCRegulatorVoltageLevel(
SPC_Type *base,
spc_dcdc_voltage_level_t voltageLevel)
{
base->ACTIVE_CFG =
(base->ACTIVE_CFG & (~SPC_ACTIVE_CFG_DCDC_VDD_LVL_MASK)) |
SPC_ACTIVE_CFG_DCDC_VDD_LVL(voltageLevel);
}
More specifically, the connection is lost when ACTIVE_CFG is written to change the active-mode DCDC voltage level.
The behavior is therefore different between the following two cases:
1. Cold power-on:
The firmware starts and runs normally.
2. Debug Mailbox reset followed by start-debug-session and SWD connection:
The firmware reaches the SPC DCDC configuration, but the debugger loses the target when ACTIVE_CFG is written, and the application cannot start normally.
Could the Debug Mailbox reset leave the SPC, DCDC, GDET, or reset status in a different state compared with a full power-on reset?
Is there a required sequence before modifying SPC ACTIVE_CFG after starting a Debug Mailbox debug session? For example:
- waiting for SPC_SC[BUSY] to clear;
- clearing an SPC or GDET status flag;
- unlocking or disabling glitch detection;
- using a specific reset type;
- avoiding a soft reset after start-debug-session;
- or applying the complete LS_preconnect_MCXN5XX.scp sequence?
Could writing the DCDC voltage level while debugging trigger a GDET event, DCDC protection event, brownout reset, or another system reset?
Please also advise which registers we should capture immediately before the ACTIVE_CFG write. We can provide values for registers such as SPC_SC, SPC_CNTRL, SPC_ACTIVE_CFG, SPC_GLITCH_DETECT_SC, CMC_SRS, CMC_SSRS, and the Debug Mailbox CSW.
Best Regards,