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.

FreeRTOS on MSP430 after watchdog reset

Other Parts Discussed in Thread: MSP430F1611

Hello,

After the long search to solve my problem, i have not found any valid solution.

  • Explanation:

I use FreeRTOS on MSP430f1611 and make some test with the watchdog reset:

Init watchdog - WDTCTL = (WDTPW + WDTSSEL + WDTTMSEL);

But after reset the FreeRTOS does not restart...

int main(void)
 {
int b, i;
unsigned long int j=0;

//vTaskEndScheduler();
msp430_clearWatchdog();
msp430_initWatchdog();
msp430_stopWatchdog();

BLINKING_LED2_init();
BLINKING_LED2_turnOn();
BLINKING_LED3_init();
BLINKING_LED3_turnOff();

_BIC_SR(GIE);
_BIS_SR(GIE);

j=0;
while(j<66666)
{
j++;
}

BLINKING_LED2_turnOff();
BLINKING_LED3_turnOn();

j=0;
while(j<66666)
{
j++;
}

msp430_initClocks();

msp430_initWatchdog();
IE1 |= WDTIE;

vTaskStartScheduler();
return 0; // Will never get here
}
It seems to bug after _BIS_SR(GIE); and the flaf ACCVIFG is set but i don't understand why :( 

I will be really glad a little help, 
And would like to apologize for my English
Thanks
  • teh watchdog causes only a PUC (power-up-condition). This does not reset all hardware to power-on defaults. Especially the timer modules are unaffected - just the GIE bit is clear. If the software is aware of this, it can recover from a watchdog reset and not even lose the timing.
    But if RTOS has configured the timers for thread scheduling, and you set GIE and therefore enable the timer ISR, the RTOS timer ISR will get called while RTOS isn't initialized at all. And crashes.

    Which register bits are affected by PUC and which are only by a POR or BOR is found in the register descriptions in the users guide. See the end of the preface chapter (behind this boring FCC warning and 'about this document' stuff.) for notation conventions.

  • Thank you for explanations :)

    Do you think I can generate a POR with whatchdog ISR or I have to manually reset all the register?

  • Alexei Dick said:
    Do you think I can generate a POR with whatchdog ISR or I have to manually reset all the register?

    If RTOS is written properly, it won't enable GIE before everything is initialized. So simply don't do it yourself before initializing RTOS.

    If it is a problem, well, I fear you'll then have to reset the registers manually - or at least reset the IE bits. I guess, it is limited to the timer.

    And no, the 1611 has no way to trigger a POR by software. This is new to the 5x family devices.

    What you can do is to cause POR when your startup code detects a WDT reset (WDTIFG is set when the program starts, so this is one of the register bits that aren't reset by a PUC). This can be done by connecting the RST pin with an unused GPIO pin. The software will then set the GPIO pin to output and pull it low. This causes a BOR/POR (which in turn will immediately set the GPIO pin back to High-Z input, ending the reset) and initializes everything.



**Attention** This is a public forum