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/MSP430FR5729: code get stuck in crystal do while loop

Part Number: MSP430FR5729

Tool/software: TI C/C++ Compiler

hello Sir,

             please help me to slove the problem, i my pcb i am using msp430fr5729 controller in that i have used 8 mhz clock and for that i had made changes in CSCTL register as shown below, my problem is that in my some pcb my code get stuck in  "do..while"  loop which is given below but in some pcb it does not stuck there and was working fine. The ratio for working out of not working is 7/10 works and 3/10 fail. i just want to what is the problem?, the same code loaded in all 10 pcb out of which in 3 it was stuck in do while loop, does there will be problem in crystal or in controller, please help me to slove this.

CSCTL0_H = 0xA5; // clock 8MHZ
CSCTL1 |= DCOFSEL0 + DCOFSEL1; // Set max. DCO setting
CSCTL2 = SELA_3 + SELS_3 + SELM_3; // set ACLK = XT1; MCLK = DCO
CSCTL3 = DIVA_0 + DIVS_0 + DIVM_0; // set all dividers

// Clear XT1 fault flag
}while (SFRIFG1&OFIFG); // Test oscillator fault flag

  • How exactly did you connecte the crystal? Show the schematic and the board.
  • please check this schematic and suggest me if any change.

  • Hello kinjal,

    Please refer to SLAA322 for proper 32 kHz crystal oscillator PCB design. VCORE capacitance must be 470 nF and capacitance of the VCC pins must exceed 4.7 uF in accordance with the Recommended Operating Conditions in Section 5.3 of the Datasheet.

  • hello sir,

                  thank you for your suggestion i will try this, but i have one more query is that if in my code i remove this crystal  "do...while loop"  then my code does not get stuck any where, so if i remove this loop from my code then will it effect to the output of my controller ?

  • If you remove the loop, the crystal will not be used at all.

    You have to fix the actual problem that prevents the crystal from starting.
  • Hello Sir,
    i agree with this but i get confused that when i remove this crystal do...while loop then my code other functionality works properly so what will be the reason for this, also my other query is out of my 10 hardware(PCB) i get this kind of problem in 3 hardware(PCB ) only, in rest of 7 PCB my code does not get stuck in this loop, so for this kind of behavior what will be the reason for it.

  • Kinjal,

    for what do you use the ACLK?

    If you remove the do ... while loop the oscillator fault flags will be cleared which means you ACLK is not running from XT1 but from VLO as described in user's guide chapter "CS Module Fail-Safe Operation". In this case you have a different frequency on your ALCK which might not have a big impact to your system. So if you do not really require the accuracy of a 32 kHz crystal use VLO direclty to safe power and external components.

    If you require the 32 kHz with crystal accruacy you have to find out where the XT1 faults come from. This could due to damaged crystal, worng LFO layout, contaminations, wrong cap settings,...

    I recommend to check ALCK with a scope to see how the signal is looking like.