This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

eZdsp5535 Watchdog timer is not getting enabled after being reset once.

Other Parts Discussed in Thread: TMS320C5535

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

5125.main.c
//////////////////////////////////////////////////////////////////////////////
// * 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++);
	}
}
  
}

  • Hi,

     After CPU reset test code stops running and target will be disconnected. Did you observe this ?

    Regards

     Vasanth

     

     

     

     

  • Hi,

    Following the flow of my code:

    1. Start

    2. Turn on all LEDs of Ezdsp5535

    3. Initialize and configure the Watchdog Timer.

    4. Start the Watchdog Timer.

    5. Service the Watchdog Timer based on external input in an infinite loop.

    If the timer is not serviced in a particular time period, The DSP will be reset. What i observed is that. Once the DSP is reset 2nd step (Turning on all LEDs) is happening. Then control gets lost. If i stop the program from running in CCSv4, I can't see pointer any where in my program.

    Don't know whether target is getting disconnected. What could be the problem?

    Can't quite figure out what is happening.

    Thanks & Regards,

    Raghu K

  • Hi,

    When the counter expires, a hardware reset is generated. Looks like from your explanation the reset is occuring.

    After a hardware reset occurs, the watchdog timer is disabled and requires configuration again..

    Regards

     Vasanth

  • Dear sir,

    After the hardware reset has occurred, Will the control does not initialize and configure the WDT again? as per the program flow i have given in the earlier post.

    Please look into the code as well.

    What should be the program flow to initialize or configure the WDT after the hardware reset? Please provide any example code or flow if you have.

    Thanks & Regards,

    Raghu K 

  • Hi,

    Yes, after reset the WDT needs to be configured again. For configuration procedure refer to section 5.3.1 & 5.3.2 in SPRUH87D (C5535 TRM) document.

     

    Hope this clarifies.

     

    Regards

     Vasanth

  • Dear sir,

    My program was correctly only. It is working. When we connect ezdsp5535 to PC and supply firmware from CCSv4, the Watchdog Timer is not getting re-initialized after hardware reset. But when we disconnect ezdsp5535 from PC and provide firmware from SDcard, the code works perfectly. I am not sure what is the reason. During power-up or hardware reset, C5535 will look for firmware from different permanent memory sources (as listed in 2.2 of "Using the TMS320C5535/34/33/32 Bootloader" -SPRABL7B). I think when we connect to the PC and provide firmware from CCSv4, and after hardware reset, C5535 is not able to get the firmware from no source. I am not sure.

    Please provide your valuable opinion, and correct me if i am wrong. Where would the code go and reside when we say debug in CCSv4 ?

    Thanks & Regards,
    Raghu K
  • Hi,

    When your program resides in the SD card it will work, This is because, Once reset happen, the device boots from SD where your program resides and re-configures the watchdog, so watchdog counter gets enabled.

    But when you use CCS to run your program and when watchdog timer counter expires, a hardware reset is generated. Once reset happens, test code stops running and target will be disconnected. You need to restart the test program again.

    Hope this clarifies.

    Regards

     Vasanth