Hi, @lukaszadrapa
Solved: Re: NXP s32k312 HSE Reset Issue - NXP Community
We are currently using RTD 4.0.0 and do not have the option to upgrade to a newer version. To address the HSE reset issue occurring without a debugger connection, we implemented the following solution 1 based on your earlier suggestion:
Solution 1:
/* Before configuring HSE_CLK and accessing the CONFIG_REG_GPR register,
the driver should wait for Secure BAF to enter WFI state by checking
the PRTN0_CORE2_STAT register. */
do {
WfiStatus = (BOARD_MC_ME->prtn0_core2_stat & MC_ME_PRTN0_CORE2_STAT_WFI_MASK);
} while (WfiStatus != MC_ME_PRTN0_CORE2_STAT_WFI_MASK);
This solution is implemented during clock initialization to ensure proper reset behavior without the debugger.
However, the NXP community also suggests an alternate approach:
Solution 2:
#define MU_FSR_ADDRESS (volatile os_uint32_t*)0x4038c104U
#define HSE_INIT_OK_SHIFT 24U
#define UTEST_HSE_ENABLED_ADDRESS (volatile os_uint32_t*)0x1B000000U
#define UTEST_HSE_ENABLED_DEFAULT 0xFFFFFFFFU
if (UTEST_HSE_ENABLED_ADDRESS != UTEST_HSE_ENABLED_DEFAULT)
{
board_waitforHSEinit();
}
void board_waitforHSEinit(void)
{
volatile os_uint32_t* Mu_FSR_Address = MU_FSR_ADDRESS;
while (((*Mu_FSR_Address >> HSE_INIT_OK_SHIFT) & 0x01) != 0x01U);
}
Although both solutions resolve the reset issue without a debugger, we are concerned that in Solution 2, if the HSE status bit is unexpectedly corrupted or never set (e.g., due to hardware fault), the software could get stuck indefinitely in the while loop.
Could you please advise which of these two approaches is more appropriate and robust for handling HSE reset issues without debugger support?