6 Replies Latest reply on Jul 4, 2019 10:16 PM by DaPi_1514011

    How do you determine brown out detection event?

    DaPi_1514011

      Hi

       

      CYBLE-022001-00.

       

      From PRoC BLE Registers TRM, Document No. 001-93112 Rev. *B, it says:

          // To detect brown-outs firmware should do this on boot:

          // 1. Set key= KEY16

          // 2. Set KEY16= 0x3A71

          // 3. If key==0x3A71 this was a brown-out event.

          // Default Value: X

       

      I implemented this as follows, but it appears to raise an exception on the processor when running.

       

      Is there an unlock or something that has to occur before this register can be written to?

       

       

      int BootTestAndEnableBodOnRestart(void)

      {

          // from PRoC BLE Registers TRM, Document No. 001-93112 Rev. *B

          // To detect brown-outs firmware should do this on boot:

          // 1. Set key= KEY16

          // 2. Set KEY16= 0x3A71

          // 3. If key==0x3A71 this was a brown-out event.

          // Default Value: X

         

          unsigned short key = CY_GET_REG16(CYREG_PWR_BOD_KEY);

         

          CY_SET_REG16(CYREG_PWR_BOD_KEY,0x3A71);

         

          return (key == 0x3A71);

      }