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/MSP430FR5959: watchdog implementation

Part Number: MSP430FR5959

Tool/software: Code Composer Studio

dear sir,

we are using msp430fr5959 controller and i want to implement watchdog function on our existing code in such a way that if my code gets stuck somewhere then watchdog occur and it will start execute from beginning but selected variables should not be reset. it should retain the value. So that end user doesn't know about watchdog implementation.

So how can i implement this on my code..?

  • Hello Anushka,

    For initializing the WDT, there are some code examples availabe here: dev.ti.com/.../node

    I think the best way to preserve the variables through a reset, is to use #pragma NOINIT. This will place the variable in the .TI.noinit group which will be in FRAM. This variable will be assumed to have no initialized value at reset (but will typically be cleared when the device is re-flashed.) This will allow you to preserve that variables value.

    There is also some more discussion on this topic in this thread: e2e.ti.com/.../507393

    Thanks,
    JD
  • hello JD ,

     

    Suppose I preserve variable on no init section (#pragma NOINIT) then at every power on variable have what value?

    Ex –

    Case 1(power ON reset)

                   suppose I have a one variable which has default value 10 and its value is keep on changing during process . if I put this variable in no init section then at power on what will I get ? its default value 10 or last process value?

    Case 2 (watchdog reset)

                   if watchdog occur and restart then what will I get ? its default value or its last process value .

    I only want a variable to be preserve value when watchdog occurs(like case 2) not every time when power is turn on.(case 1).

  • Hey Anushka,

    A No-Init variable is not initialized. IE: It has no default value at declaration.

    You can create a function in your firmware that looks at the Reset source and decide to initalize these variable to a known value or leave them as unknown/their previous value.

    This is common when wakeing up from x.5 sleep modes, as these modes wake via a reset. If you look at the LPM4.5 examples on the link above, you will see an example on how to branch on reset source.

    Thanks,
    JD
  • hello sir 

    As you have mention preserve variable in to no init section in FRAM , so what will be the maximum size(bytes) that we can store variables into no init section ?  Datasheet suggested FRAM size(64kb) = Program + Data + Storage  which is bit confusing. 

    i have used upto 80bytes and its works fine but what will be the maximum size ? 

  • Hey Anushka,

    There is no specific maximum size. The Device does have 64kB of FRAM, which is a unified memory. This entire 64kB is split up and shared between your actual program size, your variables, and the amount of data storage. So, it really depends on the size of your program, etc. The larger your program, the less remaining FRAM you'll have to store data.

    Thanks,
    JD
  • hello JD ,

    watchdog reset is not generated on my code even if i am commenting the 1st line of my code
    i.e
    WDTCTL = WDTPW + WDTHOLD;

    by commenting this line,after expiration of the selected time interval it should triggering PUC but in my code it is not occurred.
    so what wrong in my code?
  • Hey Anushka,

    How are you checking that it hasn't happened? Are you connected and debugging? It's possible that while debugging, this feature has been disabled.

    If you free run or just program and then reset the board without the debugger it should reset. You probably should toggle and LED/GPIO to let you know externally.

    Let me know if you still don't see the WDT reseting.

    Thanks,
    JD
  • hello JD,

    thank you for your guidance. i was checked it with debugger. After program and reset it works..

**Attention** This is a public forum