How to detect Brown Out

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaPi_1514011
Level 3
Level 3
First like received

Hi,

Following on from this thread: How do you determine brown out detection event?

How do you actually detect the brown out?  It appears that when the MCU enters hibernate and then comes out, that this flag is set.

Is there a pattern for accurately detecting a brown out, as the simple pattern of checking if key==0x3A71 doesn't always indicate a brown out?

Thanks, Dave

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi DaPi_1514011

You can get the reason for reset from the CySysPmGetResetReason() API. This will return CY_PM_RESET_REASON_WAKEUP_HIB when the device comes out of hibernate. Brown out can be detected by reading the PWR_BOD_KEY register and checking if the value is retained using

uint32 key = CY_GET_REG32(CYREG_PWR_BOD_KEY);

    CY_SET_REG32(CYREG_PWR_BOD_KEY,0x3A71);

    return (key == 0x3A71);

I have attached a sample project that will show brown-out reset by blinking LEDs. Please have a look and let me know if you require further clarifications.

Thanks and regards

Harigovind

View solution in original post

0 Likes
2 Replies