cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

LuBe_4654241
New Contributor II

Hi,

Do you have an example code of watchdog reset for PSOC4100 ?

Best regards

LB

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator

Hi @LuBe_4654241 , the attached project is tested to work with PSoC 4100 PS device. Please test this at your end and let us know your observations.

In PSoC 4100 S device, WDT reset feature can't be enabled in the Clock configuration but can be enabled using the WDT APIs and the global signal reference component. I have attached a project for that as well that works at my end. Please test and let us know your observations.

Regards,
Bragadeesh

View solution in original post

0 Likes
10 Replies
MotooTanaka
Esteemed Contributor
0 Likes
LuBe_4654241
New Contributor II

Hi,

1) I have enabled wdt timer reset as you can see in the file Wdt clk.jpg

2) Inserted the global signal for interrupt configured as  watch dog timer interrupt, see attached file.

3) Main:

    WdtIsr_StartEx(WdtIsr); 


    CyGlobalIntEnable;
    while (1)
    {
        Cnt = CySysWdtGetCount();
        if ( Cnt == 1000 )
        {
            CyDelay(10);
        }
        else
            CyDelay(1);
    }
 
CY_ISR(WdtIsr)
{
    /* Clear WDT only after device reset caused by WDT */
    if(RESET_FLAG_ACTIVE == resetFlag)
    {
    CySysWdtMaskInterrupt();
 
    interruptFlag = SET;
    }
}

The reset and interrupt no work, why ?

Best regards

LB

 

 

0 Likes
BragadeeshV
Moderator
Moderator

Hi @LuBe_4654241 ,

1. If you want to use a custom code for WDT ISR, such as by using a global signal reference component, the Timer WDT (ISR) setting should be User provided and not auto generated. If the setting is auto generated, then  the CySysWdtIsr() function is registered as the WDT interrupt handler. This overrides your WdtIsr() function.

Can make it user provided and try again?

2. From image Wdt clk.JPG, it doesn't look like you are using PSoC 4100 family. PSoC 4100 family doesn't support WCO. Can you please reconfirm if you are using PSoC 4100 S or PSoC 4100 family.

 

Regards,
Bragadeesh
0 Likes
LuBe_4654241
New Contributor II

Hi,

I am using PSOC 4100PS.

Can you show me the example code for watchdog reset ?

Best regards

LB

0 Likes
LuBe_4654241
New Contributor II

Hi,

PSOC4100S not support the reset, as you can see reigister manual: Reset not supported.

Is the best way the reset on the interrupt ?

Best regards

LB

0 Likes
LuBe_4654241
New Contributor II

Hi, 

Can someone answer to my question ?

 

Best regards

LB

0 Likes
BragadeeshV
Moderator
Moderator

Hi @LuBe_4654241 , the attached project is tested to work with PSoC 4100 PS device. Please test this at your end and let us know your observations.

In PSoC 4100 S device, WDT reset feature can't be enabled in the Clock configuration but can be enabled using the WDT APIs and the global signal reference component. I have attached a project for that as well that works at my end. Please test and let us know your observations.

Regards,
Bragadeesh

View solution in original post

0 Likes
LuBe_4654241
New Contributor II

Hi,

the watchdog timer works well, but the watchdog reset to avoid firmware crash seems that the reset time is not correct. For example I have changed the main module for testing reset, but the reset starts after some second and not after the 500ms timeout, why ?

Best regards

0 Likes
LuBe_4654241
New Contributor II

Hi,

Can someone answer to my question ?

Best regards

LB

0 Likes
BragadeeshV
Moderator
Moderator

 Hi @LuBe_4654241 , Can you please let us know the actual time it takes in your firmware for the WDT to reset the device. You can toggle a pin in the beginning of the main() to get the exact reset to reset timing. From your code, you have set the WDT interval to 500 ms, therefore if the WDT is not serviced for 500 x 3 = 1.5 seconds, it will reset the device. Note that the watchdog will trigger a reset only for the 3rd un serviced interrupt.

Regards,
Bragadeesh
0 Likes