- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
}
}
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
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
PSoC 4100/4200 Family PSoC 4 Architecture TRM, Document No. 001-85634
But the IRQ number of PSoC 4200M was changed as follows.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
PSoC 4100/4200 Family PSoC 4 Architecture TRM, Document No. 001-85634
But the IRQ number of PSoC 4200M was changed as follows.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I thought that something minor had changed. The Code Example should be updated to include this change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mike,
We have noticed this issue and will be taking necessary steps to make the correction.
Best Regards,
Vasanth