Author: AH_96 Version: **
The BOD (Brown Out Detection) circuit protects the operating or retaining logic from possibly unsafe supply conditions by applying reset to the device. The BOD circuit monitors the VCCD voltage and generates a reset if the voltage level dips below the minimum VCCD voltage required for safe operation. The system will not come out of RESET until the supply is detected to be valid again. In some BOD events, VCCD will fall below the minimum logic operating voltage, but remain above the minimum logic retention voltage.
If VCCD dips below the minimum logic operating voltage, but not below the minimum logic retention voltage, a BOD reset occurs; but the register values are retained. If VCCD dips below both minimum operating and minimum retention voltage, a BOD reset occurs without retention of registers. This register retention can be detected using a special register, PWR_BOD_KEY. The PWR_BOD_KEY register changes value only when written by firmware or when a non-retention reset such as a non-retention BOD, XRES, or POR event occurs.
Brown out reset can be detected by adding the following code to the application.
//Check the present value of CYREG_PWR_BOD_KEY register
uint32 key = CY_GET_REG32(CYREG_PWR_BOD_KEY);
//set CYREG_PWR_BOD_KEY register to 0x3A71
//if key is 0x3A71, it indicates that the program was reset due to Brown out
return (key == 0x3A71);
int main (void)
/* Place your application code here. */
However, CYREG_PWR_BOD_KEY will be retained when the device wakes up from Hibernate. Therefore, the reset condition must be checked. The reset condition for Hibernate can be checked by using
CySysPmGetResetReason() == CY_PM_RESET_REASON_WAKEUP_HIB.
If this condition returns TRUE, it indicates that the reset reason was Hibernate and BOD need not be checked.