3 Replies Latest reply on Jul 8, 2017 3:57 AM by Gyan Chand

    "WDT_P4_Example01" Sample program issue

    rautinst_2245351

       I am implementing "WDT_P4_Example01" sample program on PROC BLE and the program generates reset after 5 seconds and after power ON red LED turns ON for 200ms since reset is caused by the watchdog timer.

         

      But when I make only one change to program i.e instead of "uint32 interruptCnt = 1u;" if I define it as "uint16 interruptCnt = 1u;" the reset is cause is not due to WDT and red LED doesn't turns ON for 200 ms.

         

      I am using "CY8CKIT-042-BLE" kit with PROC BLE board. I had attached project with single modification as mentioned above please reply.

        • 1. Re: "WDT_P4_Example01" Sample program issue
          Gyan Chand

          Hi,

             

          Sorry for the inconvenience happened to you!!

             

          When the WDT timer mode is configured as Watchdog(w/interrupt) [ PSoC Creator ,.cydwr file-> Clocks tab-> Edit Clock-> Low frequency Clock-> Timer0 Mode] and the WDT interrupt is not cleared, then the WDT interrupt will generate continuously at every LFCLK cycle.

             

          So when we select a 32 bit variable (uint32 interruptCnt) it increments upto =< 2^32  in 0.5*3 seconds( WDT interrupt interval) . Means the condition "if (interruptCnt <= LED_BLINK_5_TIMES)" will not satisfy after uint32 interruptCnt=10 and WDT interrupt will not clear in 0.5*3=1.5 seconds and device will reset.

             

          But  when we select a 16 bit variable (uint16 interruptCnt) it increments upto =< 2^16  in 0.5*3 seconds( WDT interrupt interval) and it might overflow and the  condition "if (interruptCnt <= LED_BLINK_5_TIMES)" will satisfy after uint16 interruptCnt<=10 again in 1.5 seconds and  WDT interrupt will clear in 0.5*3=1.5 seconds and device will not reset which is happening here.

             

          To overcome this problem you can disable the WdtIsr after interruptCnt==11.

             

          Please find the attached modified project attached with this response.

             

           

             

          Regards,

             

          Gyan

          • 2. Re: "WDT_P4_Example01" Sample program issue
            rautinst_2245351

            Thank you for reply Gyan but I didn't understand your explanation.

            • 3. Re: "WDT_P4_Example01" Sample program issue
              Gyan Chand

              Hi,

                 

                Hope the project worked fine for you.

                 

              " When the variable is declared as uint8 , it overflows and becomes '0' within the period (0.5*3) and when it becomes '0' the LED blink condition also becomes true,and it will continuously blinks rather the interrupt causing system 'RESET' ".

                 

              -Gyan

              1 of 1 people found this helpful