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.

Compiler/MSP430F425A: MSP Reboot When Do SD16 for Many Times

Part Number: MSP430F425A

Tool/software: TI C/C++ Compiler

Dear all,

I have work on a new project that needs SD16 to convert analog data to digital data.

In order to get the data with the lowest tolerance scope, I do SD16 for many times and get average.

In the process, I define a temporarily variable with the format unsigned long, and the variable is used or saving the result of SD16MEM.

After the process is finished, I get the average of the temporarily variable into times of getting SD16.

My trouble is that if the times(define as SD16_Check_Time in the code) is higher the 40, MSP will reboot in the process of SD16.

What is the reason that cause the status?

If I still need a lot of times to do this operation, how can I solve the problem?

This is the code I use for get SD16,

#define SD16_Check_Time 30
void Get_SD16_Data(void)
{
unsigned long temp_AD_Value;
unsigned int temp_SD16;
unsigned short loop;

temp_AD_Value=0;
for(loop=0;loop<SD16_Check_Time;loop++)
{
SD16CCTL0 = SD16SNGL + SD16SC;// Set bit to start conversion
while ((SD16CCTL0 & SD16IFG)==0);// Poll interrupt flag for CH0
temp_SD16=SD16MEM0;// Save CH0 results (clears IFG)
temp_AD_Value += temp_SD16;
}
AD_Value=temp_AD_Value/SD16_Check_Time;
}

Sincerely,

Yu-Chuan, Chen

  • Hello,

    I think what is happening here is that you do not turn off the watchdog timer or do not service the watchdog in time. By default, the watchdog timer is on for a part and needs to be serviced or turn off if not used.
  • Hi JH,

    I have turned off the watchdog in the beginning of the program.
    If the watchdog is not turned off, it will also reboot automatically, right?
    But if the times of doing SD16 operation is decrease, it would not reboot.

    Sincerely,
    Yu-Chuan, Chen
  • Hello Yu,

    Do you do the following to turn off the WDT?

     WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

    If so, then we do not have to worry about the WDT here. I would then suggestion making an NMI ISR and enabling the ACCVIE interrupt to see if you are getting a  Flash violation of some sort. 

    I'm not seeing anything in particular that could be causing your issue with the code you have provided, but it is not the full code. 

    Also, when posting code to the forum, please use the </> button in order to post code in the formatter. That way it is formatted for easier viewing. I've modified your post to reflect this as a courtesy. 

  • Hi JH

    I will use break point to check the status.
    And what flag should I notice?
    I can send the code if necessary.

    Sincerely,
    Yu-Chuan Chen
  • Hello,

    Please see Chapter 2 within the family user guide of your part for more information on what interrupts to check.
  • Hi JH

    Thanks for your kind attention.
    I will check it and if there is any trouble, I will create a new post.

    Sincerely,
    Yu-Chuan Chen

**Attention** This is a public forum