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

PSoC™ 4

DaPi_1514011
Level 3
First like received
Level 3

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
Hari
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
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
2 Replies
Hari
Moderator
Moderator 750 replies posted 500 replies posted 250 solutions authored
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

0 Likes
DaPi_1514011
Level 3
First like received
Level 3

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