cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

New Contributor II

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
Reply
1 Solution
Moderator
Moderator

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
Reply
2 Replies
Moderator
Moderator

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
Reply
New Contributor II

Thank you.  This is what I found to work before your response.  We ended up checking CySysPmGetResetReason() for whether the wake up cause was hibernate and ignored the brownout check in that instance.

Thank you for the example.

0 Likes
Reply