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.

CCS/TMS320F28379D: F28379D RESET WATCHDOG

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

I am working with watchdog RESET I am able to enable it but I am not able to set the prescaler.

It is giving me 14ms time period(checked using oscilloscope) with any prescaler selected on RESET pin(Pin-16 on launchpad).

This is my currenet code for watchdog 


setWatchdogMode(SYSCTL_WD_MODE_RESET);
setWatchdogPrescaler(SYSCTL_WD_PRESCALE_16);
serviceWatchdog();
enableWatchdog();

But when i use example from driverlib folder (Example name): watchdog_ex1_service

I am able set any prescaler I wish to yet it using the same code for enabling watchdog.

I have changed the mode from interrupt to reset in example and also tried all prescaler(ALL PRESCALER WORKING IN EXAMPLE.).

PLEASE EXPLAIN THIS TO ME AND SUGGEST ME SOME GOOD SOLUTION FOR THIS.

  • The SCSR and WDCR registers are EALLOW protected. The first two lines of your code are interacting with these registers. Possibly you have not enabled access. Try:

    EALLOW;
    setWatchdogMode(SYSCTL_WD_MODE_RESET);
    setWatchdogPrescaler(SYSCTL_WD_PRESCALE_16);
    EDIS;
    serviceWatchdog();
    enableWatchdog();

    Observe the code inside the serviceWatchdog() and enableWatchdog() that EALLOW access has been enabled.

    Regards,

    Richard
  • Hii,
    In my code the functions are EALLOW enabled inside their defination.
    This is my initWatchdog Function :

    void InitWatchdog(SysCtl_WDMode mode,SysCtl_WDPrescaler prescaler)
    {
    disableWatchdog();
    setWatchdogMode(mode);
    setWatchdogPrescaler(prescaler);
    serviceWatchdog();
    enableWatchdog();
    }
    But after next power on reset board restarts with wdps : 000(least prescaler) value disregarding the watchdog setting i have written to it.
    Here I am disabling the watchdog for the reason if it is previously enabled by some other Init funtion.
  • Correct, this is the designed behaviour. On reset, the watchdog is enabled and WDPS is zero (i.e. watchdog timer clocked at slowest rate - see the reset values in the WDCR register description on p. 223 of the TRM). This obliges the user to reset or configure the watchdog after each reset. There's no way to change that.

    Regards,

    Richard
  • Hello Richard,
    I am initializing the watchdog in my code with initWatchdog() function ,
    Is it what you meant by "This obliges the user to reset or configure the watchdog after each reset. There's no way to change that."
    After powering how can i retain the previously saved settings.I am using this (2837x_FLASH_lnk_cpu1.cmd ) linker file.
  • Hello Ashish,

    On reset the device registers are automatically initialized in hardware with the values shown in the reference guide.  User code plays no part in this.  For the WDCR register, all the bits are set to zero (see the attachment).  Any register values loaded previously will be lost on reset, so your code needs to re-initialize the watchdog after each reset or power-up.

    Can you give me a little background on why this is a concern? 

    Regards,

    Richard

    WDCR reset.pdf

  • I want to have a desired prescaler selected,which i am initializing in the initWatchdog() function.So why i am not able to retain those settings after next power up?
    I am flashing the program and i still get error 0x3fe493 and then on next time powering up the board it starts watchdog with minimum prescaler values.
  • Hi Ashish,

    After WD reset, most of the register in device get reset to their default state. This default state is mentioned in the device TRM (see below the snapshot).

    Default value of the WD prescaler is 0x0 hence after reset when application re-start the value will be 0x0 unless SW  write to this field again. If you want new value to take effect from starting of your application then you need to move the code which initialize the WD prescaler into "xxxx_CodeStartBranch.asm".

    Hope this helps.

    Regards,

    Vivek Singh

  • In my codestartbranch.asm file
    In Given below line WD_DISABLE was somehow set to 0 and when i changed it back to 1 it is working properly.

    WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0.