Hi,
We sometimes faced initialization failure/stuck_at_#1 of SRTC, even code was same as WEC7 BSP for i.MX53QSB.
#0 IES=0, NVES=0, STATE_LP=00 //initailization state
#1 IES=1, NVES=0, STATE_LP=00 <== stuck HERE!
#2 IES=1, NVES=0, STATE_LP=01 //non-valid state
#3 IES=1, NVES=1, STATE_LP=10 //valid state
According to the manual, SRTC state machine will exit from initialization/no-valid state by setting IE/NVE bit of LPSR respectively.
Why our board sometimes didn't exit from #1 in spite of IES=1?
I checked SRTC errata but new silicon already fixed it.
I found Fig.72-5 which described that state machine hold current state if SystemPOR asserted but I think SystemPOR always negated before IE set.
Is there any other reasons to stuck at #1? Anyone can help me?
BR
Hi torus1000
This function is called by WinCE higher layer which code was developed by Deactivated user
It will be called every time, but it will check the register value of g_pSRTC->LPPDR, and will set the value of this register to “SRTC_PWR_GLITCH_VAL” at the first time, In the next time it will check if this register be set. If it is set, then RTC will not reset the time.
Please refer to below code:
if (INREG32(&g_pSRTC->LPPDR) != SRTC_PWR_GLITCH_VAL)
{
OALMSG(OAL_WARN, (L"WARNING: SRTC was reset.\r\n"));
// Initialize glitch detector
OUTREG32(&g_pSRTC->LPPDR, SRTC_PWR_GLITCH_VAL);
// Configure IE bit to exit from INIT state
INSREG32BF(&g_pSRTC->LPCR, SRTC_LPCR_IE, SRTC_LPCR_IE_NORMAL);
// Wait for IES to indicate exit from INIT state. Terminate loop if SRTC enters FAILURE state.
while ((EXTREG32BF(&g_pSRTC->LPSR, SRTC_LPSR_IES) != SRTC_LPSR_IES_NORMAL) &&
(EXTREG32BF(&g_pSRTC->LPSR, SRTC_LPSR_STATE_LP) != SRTC_LPSR_STATE_LP_FAILURE));
// Configure NVE bit to exit from INVALID state
INSREG32BF(&g_pSRTC->LPCR, SRTC_LPCR_NVE, SRTC_LPCR_NVE_VALID);
// Wait for NVES to indicate exit from INVALID state. Terminate loop if SRTC enters FAILURE state.
while ((EXTREG32BF(&g_pSRTC->LPSR, SRTC_LPSR_NVES) != SRTC_LPSR_NVES_VALID) &&
(EXTREG32BF(&g_pSRTC->LPSR, SRTC_LPSR_STATE_LP) != SRTC_LPSR_STATE_LP_FAILURE));
// Check if we successfully entered VALID state
if (EXTREG32BF(&g_pSRTC->LPSR, SRTC_LPSR_STATE_LP) != SRTC_LPSR_STATE_LP_VALID)
{
OALMSG(OAL_WARN, (L"WARNING: SRTC is not in VALID state.\r\n"));
}
}
Hope this helps