2 Replies Latest reply on Jul 18, 2019 6:18 AM by DaPi_1514011

    How to detect Brown Out

    DaPi_1514011

      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

        • 1. Re: How to detect Brown Out
          AH_96

          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

          • 2. Re: How to detect Brown Out
            DaPi_1514011

            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.