Dear sir,
We were trying to program the eZdsp5535 Watchdog timer. I have attached the code we have executed. Watchdog timer is not getting enabled second time around after getting hardware resetted. Please look into the code and suggest us the solution. How do we make the watchdog timer to work after hardware resetted by watchdog timer first time around.
thanks & regards,
raghu
////////////////////////////////////////////////////////////////////////////// // * File name: main.c // * // * Description: Main function. // * // * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ // * Copyright (C) 2011 Spectrum Digital, Incorporated // * // * // * Redistribution and use in source and binary forms, with or without // * modification, are permitted provided that the following conditions // * are met: // * // * Redistributions of source code must retain the above copyright // * notice, this list of conditions and the following disclaimer. // * // * Redistributions in binary form must reproduce the above copyright // * notice, this list of conditions and the following disclaimer in the // * documentation and/or other materials provided with the // * distribution. // * // * Neither the name of Texas Instruments Incorporated nor the names of // * its contributors may be used to endorse or promote products derived // * from this software without specific prior written permission. // * // * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // * ////////////////////////////////////////////////////////////////////////////// // Set GPIO11 as input /* To make GPIO11 as input port which accepts signals from push button and makes the LED on */ #include "csl_gpio.h" #include "csl_intc.h" #include "stdio.h" #include "csl_general.h" #include "ezdsp5535.h" #include "ezdsp5535_gpio.h" #include "ezdsp5535_led.h" #include "csl_wdt.h" #include "csl_general.h" /* Watchdog timer Object structure */ CSL_WdtObj wdtObj; int TestFail = (int)-1; void StopTest() { //SW_BREAKPOINT; return; } /* * * main( ) * */ void main( void ) { CSL_Status status; CSL_WdtHandle hWdt = NULL; WDTIM_Config hwConfig,getConfig; Uint32 counter; Uint32 time; Uint16 delay; Uint16 N; Uint16 d; Uint16 Result; long i,x=0; /* Initialize BSL, GPIO iniialization, LED initialization */ EZDSP5535_init( ); EZDSP5535_GPIO_init( ); EZDSP5535_LED_init( ); // GPIO initialization CSL_FINST(CSL_SYSCTRL_REGS->EBSR, SYS_EBSR_SP1MODE, MODE1); // GPIO as input port EZDSP5535_GPIO_setDirection( 11, 0 ); for(i=0;i<4;i++) { EZDSP5535_LED_on( i ); } for(i=0;i<1000000;i++); for(i=0;i<4;i++) { EZDSP5535_LED_off( i ); } /* Open the WDTIM module */ hWdt = (CSL_WdtObj *)WDTIM_open(WDT_INST_0, &wdtObj, &status); if(NULL == hWdt) { printf("WDTIM: Open for the watchdog Failed\n"); } else { printf("WDTIM: Open for the watchdog Passed\n"); } hwConfig.counter = 0xFFFF; hwConfig.prescale = 0xFFFF; /* Configure the watch dog timer */ status = WDTIM_config(hWdt, &hwConfig); if(CSL_SOK != status) { printf("WDTIM: Config for the watchdog Failed\n"); } else { printf("WDTIM: Config for the watchdog Passed\n"); } /* Start the watch dog timer */ status = WDTIM_start(hWdt); if(CSL_SOK != status) { printf("WDTIM: Start for the watchdog Failed\n"); } else { printf("WDTIM: Start for the watchdog Passed\n"); } status = WDTIM_getCnt(hWdt, &time); printf("WDTIM: Get Count for the watchdog is %ld:\n", time); for (delay = 0; delay < 10; delay++); while(1) { x = EZDSP5535_GPIO_getInput(11); if(x == 1) { EZDSP5535_LED_on( 0 ); WDTIM_service(hWdt); printf("\nWDT Service - %ld\n",counter); /* Get the timer count */ status = WDTIM_getCnt(hWdt, &time); if(CSL_SOK != status) { printf("WDTIM: Get Count for the watchdog Failed\n"); } else { printf("Watchdog Count is: %ld\n", time); } for(i=0;i<10000;i++); } else { status = WDTIM_getCnt(hWdt, &time); if(CSL_SOK != status) { printf("WDTIM: Get Count for the watchdog Failed\n"); } else { printf("Watchdog Count is: %ld\n", time); } EZDSP5535_LED_off( 0 ); for(i=0;i<10000;i++); } } }