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.

MSP430FR2676: MSP430FR2676 crash when using loop delay time too long

Part Number: MSP430FR2676
Other Parts Discussed in Thread: CAPTIVATE-PGMR

Hi everyone,
I have a problem when using delay loop on MSPFR2676.
When I use a delay approxiamtly < 1500 ms, it runs okay. Otherwise, it will crash when runs to delay in while(1) loop. But when I run with a debug on css via CAPTIVATE-PGMR, it has no crash.
I had used both __delay_cycles and delay loop with timer (g_sysTime++ when update 1ms), it returns the same result.

void delay(uint32_t ms)
{
uint32_t lastTime = g_sysTime + ms;
while(g_sysTime < lastTime);
}
I think it relates to watchdog timeout, but I had stopped watchdog.
My code is very simple, and all my function I have used in all project is okay. 
I think it only relates to time delay too long, but I don't known why.
The simple code is shown below. All config when I create new project is default.
Can you give me some suggests about this problem? Or you can try it with your device!
Thanks!

  • Hi,

    You can try with a slower clock frequency like 1MHz.

    Or the best way is to use a timer to count the delay for you. You can refer to the timer example code to do that.

    Best regards,

    Cash Hao

  • Thanks. 1Mhz or 16Mhz give me the same crash result.
    But the problem I mentioned is not delay exactly (that can use timer to trigger, and I can do it easily).
    The problem I don't known why a loop more than 1500ms cause crash, and if it is in a debug process, it will not be crashed.
    The logic code isnot bad at any where.
    whether it relates to complier, config lowpower,optimize... or not.
    You can help me?

  • Hi,

    The differences between debugging and running freely I know is related to the clock synchronizing. While debugging, the compiler intervene the MCU clock. It doesn't crash in debugging might related to the MCU is kind of using the clock from the compiler.

    Best regards,

    Cash Hao

  • Finaly, what is the reason cause crash when mcu runs freely?
    I still donot known why, now.
    Please someone explains about it for me?
    Thanks!

**Attention** This is a public forum