CE224703 PSOC4 WDT work on -042 kit but on on -044 kit

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiRo_263836
Level 5
Level 5
100 replies posted 50 likes received 50 replies posted

I am trying to implement a WDT interrupt on a P4100M device.  I found the code example CE224703 - PSOC4 WDT.   It produces the output in the pdf on the CY8CKIT-042 kit. The WDT interrupt sets a flag and in the main loop it checks the flag and increments a count and displays it then clears the flag.

CY_ISR(ISR_WatchDog)

{

    /* Sets flag for printing the current count status of the Watchdog Timer */

    currentStatus = 1u;

   

    /* Clear interrupts state and pending interrupts */

    CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);

    CyIntClearPending(interruptNumWDT);

}

main loop

   for(;;)

    {

        /* Print current count status of the Watchdog Timer if flag is set to 1 */

        if(currentStatus != 0)

        {

            sprintf(snum, "%lu" ,CySysWdtReadCount(1u));

            UART_UartPutString(snum);

            currentStatus = 0u;

        }

    }

pastedImage_0.png

Then I followed the instructions to target for my CY8CKIT-044 kit with the CY8C4247-AZI_M485 and select the UART pins P70 and P71.

This is my TeraTerm output

pastedImage_1.png

It looks like the WDT interrupt is not happening so the flag isn't set and the main loop doesn't display the Timer 1 count

What is the difference in the WDT for the 4200 and 4200M. 

Thanks,
Mike Roberts

0 Likes
1 Solution
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

The IRQ number is specified in the "main.c" file as follows.

/*******************************************************************************

*            Constants

*******************************************************************************/

#define interruptNumWDT 9

This is TRUE for PSoC 4200.  The Architecture TRM says as follows.

GS004483.png

PSoC 4100/4200 Family PSoC 4 Architecture TRM, Document No. 001-85634

But the IRQ number of PSoC 4200M was changed as follows.

GS004484.png

PSoC 4100M/4200M Family PSoC 4 Architecture TRM, Document No. 001-95223

So, the IRQ number must be changed in the main.c file.

/*******************************************************************************

*            Constants

*******************************************************************************/

#define interruptNumWDT 7

Or, it is recommended to use the auto-generated ISR as follows.

//CY_ISR(ISR_WatchDog)

//{

//    /* Sets flag for printing the current count status of the Watchdog Timer */

//    currentStatus = 1u;

//   

//    /* Clear interrupts state and pending interrupts */

//    CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);

//    CyIntClearPending(interruptNumWDT);

//}

void Watchdog_Callback(void) {

    /* Sets flag for printing the current count status of the Watchdog Timer */

    currentStatus = 1u;

}

    /* Sets interrupt handler for WDT and enables interrupt number */

//    CyIntSetVector(interruptNumWDT, ISR_WatchDog);

//    CyIntEnable(interruptNumWDT);

    CySysWdtSetInterruptCallback(CY_SYS_WDT_COUNTER0, Watchdog_Callback);

There is no need to care about the interrupt vector and the interrupt flags.

View solution in original post

3 Replies
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

The IRQ number is specified in the "main.c" file as follows.

/*******************************************************************************

*            Constants

*******************************************************************************/

#define interruptNumWDT 9

This is TRUE for PSoC 4200.  The Architecture TRM says as follows.

GS004483.png

PSoC 4100/4200 Family PSoC 4 Architecture TRM, Document No. 001-85634

But the IRQ number of PSoC 4200M was changed as follows.

GS004484.png

PSoC 4100M/4200M Family PSoC 4 Architecture TRM, Document No. 001-95223

So, the IRQ number must be changed in the main.c file.

/*******************************************************************************

*            Constants

*******************************************************************************/

#define interruptNumWDT 7

Or, it is recommended to use the auto-generated ISR as follows.

//CY_ISR(ISR_WatchDog)

//{

//    /* Sets flag for printing the current count status of the Watchdog Timer */

//    currentStatus = 1u;

//   

//    /* Clear interrupts state and pending interrupts */

//    CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);

//    CyIntClearPending(interruptNumWDT);

//}

void Watchdog_Callback(void) {

    /* Sets flag for printing the current count status of the Watchdog Timer */

    currentStatus = 1u;

}

    /* Sets interrupt handler for WDT and enables interrupt number */

//    CyIntSetVector(interruptNumWDT, ISR_WatchDog);

//    CyIntEnable(interruptNumWDT);

    CySysWdtSetInterruptCallback(CY_SYS_WDT_COUNTER0, Watchdog_Callback);

There is no need to care about the interrupt vector and the interrupt flags.

I thought that something minor had changed.  The Code Example should be updated to include this change.

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Mike,

We have noticed this issue and will be taking necessary steps to make the correction.

Best Regards,
Vasanth

0 Likes