Hi Graeme
The uTasker loader ignores mailbox messages after a watchdog reset since such a reset is considered to be an error and so mailbox values could be corrupted.
// Only the bare-minimum loader calls this function to check the reset cause and maintain reset counters
//
static void fnSaveResetCause(void)
{
if ((SRC_SRSR & SRC_SRSR_IPP_RESET_B_M7) != 0) { // power on reset
*BOOT_RESET_COUNTER = 0; // delete persistent memory
*BOOT_WDOG_COUNTER = 0;
*SECRET_KEY_0 = 0; // delete trace of secret key (the key is written to persistant memory once when set so that the application can monitor it just once for test or tracking purposes)
*SECRET_KEY_1 = 0;
*SECRET_KEY_2 = 0;
*SECRET_KEY_3 = 0;
*BOOT_MAIL_BOX = DO_FULL_RESET; // initiate full boot cycle
#if defined ERR050538 // {1}
_CONFIG_PERIPHERAL(GPIO_AD_B0_07, JTAG_TCK, PORT_PS_UP_ENABLE); // enable pull-up on JTAG_TCK/SWD_CLK to avoid potential boot failure (this is retained across warm resets)
#endif
}
else { // not power on reset
#if defined iMX_RT105X || defined iMX_RT106X
if ((SRC_SRSR & (SRC_SRSR_LOCKUP_SYSRESETREQ_M7 | SRC_SRSR_WDOG3_RST_B_M7 | SRC_SRSR_WDOG_RST_B_M7)) == SRC_SRSR_LOCKUP_SYSRESETREQ_M7) // commanded reset (which retains the boot mailbox content)
#else
if ((SRC_SRSR & (SRC_SRSR_JTAG_SW_RST_M7 | SRC_SRSR_WDOG3_RST_B_M7 | SRC_SRSR_WDOG_RST_B_M7)) == SRC_SRSR_JTAG_SW_RST_M7) // commanded reset (which retains the boot mailbox content)
#endif
{
if ((*BOOT_MAIL_BOX & RESET_NO_COUNT_FLAG) != 0) { // commanded reset that should not be counted, nor should the last reset cause be updated
*BOOT_MAIL_BOX = (*BOOT_MAIL_BOX & ~RESET_NO_COUNT_FLAG);// remove the no count flag
WRITE_ONE_TO_CLEAR(SRC_SRSR, (SRC_SRSR_IPP_RESET_B_M7 | SRC_SRSR_LOCKUP_SYSRESETREQ_M7 | SRC_SRSR_CSU_RESET_B_M7 | SRC_SRSR_IPP_USER_RESET_B_M7 | SRC_SRSR_WDOG_RST_B_M7 | SRC_SRSR_JTAG_RST_B_M7
| SRC_SRSR_JTAG_SW_RST_M7 | SRC_SRSR_WDOG3_RST_B_M7 | SRC_SRSR_TEMPSENSE_RST_B_M7)); // clear reset cause flags
return; // return in order to avoid saving reset cause and incrementing reset counters
}
else {
*BOOT_RESET_COUNTER = (*BOOT_RESET_COUNTER + 1); // count the number of other resets
}
}
else { // not a commanded reset
if ((SRC_SRSR & (SRC_SRSR_WDOG3_RST_B_M7 | SRC_SRSR_WDOG_RST_B_M7)) != 0) { // watchdog reset detected
unsigned short usWatchdogCount = *BOOT_WDOG_COUNTER; // original watchdog reset count
++usWatchdogCount; // count the number of watchdog resets
if ((usWatchdogCount % 16) == 0) { // every 16th watchdog reset
*BOOT_MAIL_BOX = RESET_TO_FALLBACK_LOADER; // offer the fall-back loader so that potentially bad code can be updated
}
else {
*BOOT_MAIL_BOX = DO_FULL_RESET; // initiate full boot cycle on watchdog reset
}
*BOOT_WDOG_COUNTER = usWatchdogCount; // save the incremented watchdog reset counter
}
else {
*BOOT_RESET_COUNTER = (*BOOT_RESET_COUNTER + 1); // count the number of other resets
*BOOT_MAIL_BOX = DO_FULL_RESET; // initiate full boot cycle on non-commanded resets
}
}
}
*BOOT_RESET_CAUSE = (unsigned short)SRC_SRSR; // save the reset cause
WRITE_ONE_TO_CLEAR(SRC_SRSR, (SRC_SRSR_IPP_RESET_B_M7 | SRC_SRSR_LOCKUP_SYSRESETREQ_M7 | SRC_SRSR_CSU_RESET_B_M7 | SRC_SRSR_IPP_USER_RESET_B_M7 | SRC_SRSR_WDOG_RST_B_M7 | SRC_SRSR_JTAG_RST_B_M7
| SRC_SRSR_JTAG_SW_RST_M7 | SRC_SRSR_WDOG3_RST_B_M7 | SRC_SRSR_TEMPSENSE_RST_B_M7)); // clear reset cause flags
}
The relevant part is
if ((SRC_SRSR & (SRC_SRSR_WDOG3_RST_B_M7 | SRC_SRSR_WDOG_RST_B_M7)) != 0) { // watchdog reset detected
unsigned short usWatchdogCount = *BOOT_WDOG_COUNTER; // original watchdog reset count
++usWatchdogCount; // count the number of watchdog resets
if ((usWatchdogCount % 16) == 0) { // every 16th watchdog reset
*BOOT_MAIL_BOX = RESET_TO_FALLBACK_LOADER; // offer the fall-back loader so that potentially bad code can be updated
}
else {
*BOOT_MAIL_BOX = DO_FULL_RESET; // initiate full boot cycle on watchdog reset
}
*BOOT_WDOG_COUNTER = usWatchdogCount; // save the incremented watchdog reset counter
}
As you see, a watchdog reset will cause a full reset sequence to be executed and the mailbox cleared.
I haven't understood why there is an issue with performing a software reset on the EA boards since I never had such an issue but it would be possible to adjust the logic above to not clear the mailbox in case it does match one of the commands that you need.
In addition, the serial loader (fall-back loader) is in fact started every time 16x watchdog resets are detected. This puts the system in the fall-back loader mode fro 15s (allowing recovery in case the situation is due to loading a bad serial loader) and the 1 minute in the serial loader mode (in case it is due to a bad application). If you perform a watchdog reset 16x you should in fact enter the loader. Also you could change the counter value so that it does this after different counts or even every time.
Regards
Mark