Hello guys,
can someone please help me make sense of this, I’m trying to detect the reason for the restart, but the below never returns true when WDT resets the board… basically if i don’t feed the WDT the board will resets and returns a value of 00000011 which is not what CY_SYS_RESET_WDT is since that corresponds to 00000001 as shown below.
void setup(){
uint32_t reason;
reason = CySysGetResetReason(CY_SYS_RESET_WDT | CY_SYS_RESET_PROTFAULT | CY_SYS_RESET_SW);
Serial.printf("reason%08X\n", reason); //outputs 00000011
Serial.printf("CY_SYS_RESET_WDT %08X\n", CY_SYS_RESET_WDT); //outputs 00000001
Serial.printf("CY_SYS_RESET_WDT_SHIFT %08X\n", CY_SYS_RESET_WDT_SHIFT);//outputs 00000000
Serial.printf("CY_SYS_RESET_PROTFAULT %08X\n", CY_SYS_RESET_PROTFAULT);//outputs 00000008
Serial.printf("CY_SYS_RESET_SW %08X\n", CY_SYS_RESET_SW);//outputs 00000010
if (CySysGetResetReason(CY_SYS_RESET_WDT) == CY_SYS_RESET_WDT)
{
Serial.print("Disabled the WDT CY_SYS_RESET_WDT\n");
}
}
is this a bug or am i doing it wrong?