cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

user_4371246
New Contributor II

Hi there,

I'm new with Cypress CPUs. And at the moment I'm very confused since I try to figure out

how I can clear/reset the WatchDog.

I want use it with it's main function: to reset the system if something "hangs"

Therefor I must clear the watchdog counter at special points in my code

Ii tis easy to configure it and the watchdog works fine. It resets the system at the determined time.

But I cannot figure out how I can clear the wdt.

I tried to use "CySysWdtResetCounters(CY_SYS_WDT_COUNTER0);" but this function is not declared.

So what function or way can I use to clear the WDT counter?

Marcus

0 Likes
3 Replies
NoriakiT_91
Employee

Please use CySysWdtClearInterrupt() to feed the watchdog.

GS004403.png

The code example "CE210292 – WDT P4S Example" for PSoC 4000S will be a good example for PSoC 4200DS.

0 Likes
user_4371246
New Contributor II

You are right.

But I didn't expect that a ClearInt also clears the wdt counter value.

I thougt it clears only the interrupr flag.

Now I found the descibtion here:

https://www.cypress.com/file/130586/download

on Page 97

"Pending interrupt to the WDT block must be cleared by the call to the CySysWdtClearInterrupt() function. The call to the function will clear the unhandled WDT interrupt counter, if WDT is configured to be in “generate interrupts and reset on 3rd unhandled interrupt” mode. It is recommended to use WDT ISR as timer to trigger certain actions and to change the next WDT match value."

Thanks a lot !!!!

0 Likes
NoriakiT_91
Employee

I have created a simple example project on the PSoC® 4 CY8CKIT-146 4200DS Prototyping Kits as attached.

    CySysWdtEnable();

    for(;;)

    {

        /* Place your application code here. */

        if (Pin_SW1_Read()) {

            CySysWdtClearInterrupt();

        }

        CyDelay(100);

    }

The on-board tactile switch SW1 is used to stop the watchdog feeding.  So, the watchdog reset occurs when SW1 is pressed for approximately 3 seconds.

Please note that the watchdog timer is configured in the "Low Frequency Clocks" tab of the "Clock Editor" dialogue.

GS004404.png

The UART interface is used to show the reset reason out of reset.

0 Likes