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.

MSP430FR5962: WD restart/use of predefine

Part Number: MSP430FR5962

I am using CCS v12.2.0, TI v21.6.1.LTS compiler.

The firmware needs to decide on when to issue a software restart. There are some project configurations that don’t need to use this restart and I have a project predefine for this choice. One project library decides on the restart:

#if !defined (WDtoBMS_MFG_BOARD_TEST)
        if (fault){
             setVMBBRestart(1);
        }
#endif

There is a header file with this inline function definition in one of the project libraries:

inline void setVMBBRestart(uint8_t input){
    VMBB_doRestart = (input == 1) ? 1:0;
    return;
}

In the main loop:

while (1)
    {
        if  ((isVMBBRestart() == 1)){
             WDTCTL = 0xDEAD;
         }
…..
}

Without the check on the predefine, this restart works as expected. But I cannot get the restart to take effect with the predefine check. Is there a better way to issue a software reset? Or a better way to not compile sections of firmware for certain project configurations?

Priya

  • Hi Priya,

    Without the check on the predefine, this restart works as expected. But I cannot get the restart to take effect with the predefine check. Is there a better way to issue a software reset? Or a better way to not compile sections of firmware for certain project configurations?

    When you say it doesn't work are you saying that if you remove the #if !define and just always include your check of fault it resets properly, or that the PUC from the WDCTL password violation is just never occurring?

    Use of #ifdef and #ifndef or their equivalents is pretty standard practice when writing code that has to work across multiple platforms, so I don't think you should move away from that method. What you are doing with it also looks correct to me based on just what you shared. Where are you defining WDtoBMS_MFG_BOARD_TEST in your code/project? 

    For another method of issuing software reset you could also write the PMMSWBOR/POR bits in the PMMCTL0 register if you wanted a higher level reset than a PUC.

    Best Regards,
    Brandon Fisher

  • Thank you for your reply. The WDtoBMS_MFG_BOARD_TEST is a predefine symbol to the project libraries that use it. I came to realize the sequence of the tests done will remove the need for the use of this predefine around the assignment to the restart. So things will work as needed.

**Attention** This is a public forum