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.

Watchdog period in TMS320F28377S

Other Parts Discussed in Thread: CONTROLSUITE

Hello guys.

I'm newbie on TI's MCU, in the forum and with the english.

I started with LAUNCHXL-F28377S and my question is how do I know about the reset/interrupt interval for the watchdog?

The Technical Reference Manual says on page 111 that the clock source is INTOSC1. This is a 10MHz oscillator and passes through a 512 prescaler. Then, the watchdog input frequency is 10 MHz / 512 = 19531,25 Hz. Am I right?

Besides the 512 fixed prescaler, there's another one controlled by the WDCR(WDPS(2:0)) bit, which can be 1, 2, 4, 8, 16, 32 or 64.

So, assuming that the WDPS bit is set to 64, the 8-bit Watchdog Counter input will be: (10 MHz / 512)/64 = ~305 Hz and the time period is ~3,2 ms. To overflow the counter, it takes 3,2 ms * 256 = ~835 ms.

What am I doing wrong? Because this value is not coincident with the actual values.

Thanks.

  • Hi,

    Your understanding about the maximum time for WD counter to overflow to reset the device is correct. What's the time you are observing? 

    Please share the code you are using for WD configuration.

    Regards,

    Vivek Singh

  • Vivek Singh, thanks for the reply.

    The complete code is bellow and is taken from a tutorial, which uses the timer0 interrupts as exercise.
    Except for the function Gpio_select(), all others are functions provided by TI.
    I use the ConfigCpuTimer(&CpuTimer0, 200, 440000) to set the timer0 period. The limit is 440 ms. If put 450 ms, occurs Watchdog reset.
    As you can see, I set the watchdog prescaler to maximum by writing WdRegs.WDCR.all = 0x00AF. So, by the calculations, I have ~ 830 ms and should not occur a restart.
    So what am I doing wrong?
    I'm using Code Composer Studio 6.1.2.00015, Compiler Version TI v15.12.1.LTS.

    //#include "F2837xS_device.h"     // F2837xS Headerfile Include File
    #include "F28x_Project.h"     // Device Headerfile and Examples Include File
    
    // Prototype statements for functions found within this file.
    void Gpio_select(void);
    
    __interrupt void cpu_timer0_isr(void);
    
    //###########################################################################
    //						main code									
    //###########################################################################
    void main(void)
    {
    	int counter=0;		// binary counter for digital output
    
    	InitSysCtrl();	 	// Basic Core Initialization
    
    	DINT;				// Disable all interrupts
    	
    	Gpio_select();		// GPIO9,GPIO11,GPIO34 and GPIO49 as output (LEDs @ peripheral explorer)
    
    	InitPieCtrl();
    
    	InitPieVectTable();
    
    	EALLOW;  // This is needed to write to EALLOW protected registers
    	PieVectTable.TIMER0_INT = &cpu_timer0_isr;
    	WdRegs.WDCR.all = 0x00AF;							// Enable watchdog
    	EDIS;    // This is needed to disable write to EALLOW protected registers
    
    	InitCpuTimers();
    
    	ConfigCpuTimer(&CpuTimer0, 200, 400000);
    
    	PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    	IER |= 1;
    
        // Enable global Interrupts and higher priority real-time debug events:
        EINT;  // Enable Global interrupt INTM
        ERTM;  // Enable Global realtime interrupt DBGM
    
    	CpuTimer0Regs.TCR.bit.TSS = 0;
    
    	while(1)
    	{    
    	  		counter++;
    	  		if ((counter&0x1) == 1) GpioDataRegs.GPASET.bit.GPIO12 = 1;
    	  		else  GpioDataRegs.GPACLEAR.bit.GPIO12 = 1;
    	  		if ((counter&0x2) == 2) GpioDataRegs.GPASET.bit.GPIO13 = 1;
    	  		else  GpioDataRegs.GPACLEAR.bit.GPIO13 = 1;
    	  		if ((counter&0x4) == 4) GpioDataRegs.GPASET.bit.GPIO14 = 1;
    	  		else  GpioDataRegs.GPACLEAR.bit.GPIO14 = 1;
    	  		if ((counter&0x8) == 8) GpioDataRegs.GPASET.bit.GPIO15 = 1;
    	  		else  GpioDataRegs.GPACLEAR.bit.GPIO15 = 1;
    
    	  		EALLOW;
    			WdRegs.WDKEY.bit.WDKEY = 0x55;
    			EDIS;
    
    	  		while(CpuTimer0.InterruptCount==0)
    	  		{
    	  		}
    	  		CpuTimer0.InterruptCount=0;
    
    
    			// place your code to analyze counter here 
    			// if bit 0 of counter = 1, set GPIO9 to 1
    			// if bit 1 of counter = 1, set GPIO11 to 1 
    			// if bit 2 of counter = 1, set GPIO34 to 1
    			// if bit 3 of counter = 1, set GPIO49 to 1 
    	}
    } 
    
    __interrupt void cpu_timer0_isr(void)
    {
    	EALLOW;
    	WdRegs.WDKEY.bit.WDKEY = 0xAA;
    	EDIS;
    	CpuTimer0.InterruptCount++;
    	PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }
    
    void Gpio_select(void)
    {
    	EALLOW;
    
    	// Set up all multiplex register to digital I/O.
    	GpioCtrlRegs.GPAGMUX1.all = 0x0;
    	GpioCtrlRegs.GPAGMUX2.all = 0x0;
    	GpioCtrlRegs.GPBGMUX1.all = 0x0;
    	GpioCtrlRegs.GPBGMUX2.all = 0x0;
    	GpioCtrlRegs.GPCGMUX1.all = 0x0;
    	GpioCtrlRegs.GPCGMUX2.all = 0x0;
    	GpioCtrlRegs.GPDGMUX1.all = 0x0;
    	GpioCtrlRegs.GPDGMUX2.all = 0x0;
    	GpioCtrlRegs.GPEGMUX1.all = 0x0;
    	GpioCtrlRegs.GPEGMUX2.all = 0x0;
    	GpioCtrlRegs.GPFGMUX1.all = 0x0;
    
    	GpioCtrlRegs.GPAMUX1.all = 0x0;
    	GpioCtrlRegs.GPAMUX2.all = 0x0;
    	GpioCtrlRegs.GPBMUX1.all = 0x0;
    	GpioCtrlRegs.GPBMUX2.all = 0x0;
    	GpioCtrlRegs.GPCMUX1.all = 0x0;
    	GpioCtrlRegs.GPCMUX2.all = 0x0;
    	GpioCtrlRegs.GPDMUX1.all = 0x0;
    	GpioCtrlRegs.GPDMUX2.all = 0x0;
    	GpioCtrlRegs.GPEMUX1.all = 0x0;
    	GpioCtrlRegs.GPEMUX2.all = 0x0;
    	GpioCtrlRegs.GPFMUX1.all = 0x0;
    
    	// Set up GPADIR: lines GPIO12, GPIO13, GPIO14 e GPIO15  to output and all other lines to input.
    	GpioCtrlRegs.GPADIR.all = 0x0000F000;
    	//GpioCtrlRegs.GPADIR.bit.GPIO12 = 1;   // GPIO12 = output
    	//GpioCtrlRegs.GPADIR.bit.GPIO13 = 1;   // GPIO13 = output
    	//GpioCtrlRegs.GPADIR.bit.GPIO14 = 1;   // GPIO14 = output
    	//GpioCtrlRegs.GPADIR.bit.GPIO15 = 1;   // GPIO15 = output
    
    
    	EDIS;
    
    }   
    //===========================================================================
    // End of SourceCode.
    //===========================================================================
    

  • I found out what's wrong.

    I did a Step In inside the InitSysCtrl() function and the part that sets the clock speed is:

        // Initialize the PLL control: PLLCR and CLKINDIV
        // F28_PLLCR and F28_CLKINDIV are defined in F2837xS_Examples.h
        // Note: The internal oscillator CANNOT be used as the PLL source if the
        // PLLSYSCLK is configured to frequencies above 194 MHz.
    #ifdef _LAUNCHXL_F28377S
        InitSysPll(XTAL_OSC,IMULT_40,FMULT_0,PLLCLK_BY_2); 		//PLLSYSCLK = (XTAL_OSC) * (IMULT + FMULT) / (PLLSYSCLKDIV)
    #else
        InitSysPll(XTAL_OSC,IMULT_20,FMULT_0,PLLCLK_BY_2); 		//PLLSYSCLK = (XTAL_OSC) * (IMULT + FMULT) / (PLLSYSCLKDIV)
    #endif

    Step by step, I saw that the processor speed is being set to 100 MHz and not 200 MHz as imagined. So, after correct the ConfigCpuTimer function passing the correct, argument, did work.

    Thanks anyway for readiness, but I'll leave a second question: How and where do I define that is _LAUNCHXL_F28377S, to set 200 MHz?

  • Jose,

    Great !!

    You can add this symbol in your project property. Example in "controlSUITE\development_kits\LAUNCHXL-F28377S\LaunchPadDemo", it's already added but if you are using the example from device_support folder then you need to add it.

    Right click on the project in CCS project explorer and then click on "Properties". This will pop-up another window. Click on Build -> Advanced Options -> Predefined Symbols.

    Here you can add the "_LAUNCHXL_F28377S" (like shown below).

    Hope this helps.

    Regards,

    Vivek Singh

  • Vivek Singh, thanks a lot!!
    Did work!