Electronic – Calibration and trapping the CPU

calibrationmsp430

The following code is meant for MSP430. Can somebody help me what is the purpose of trapping the CPU? How will the program proceed if the CPU is trapped there?

Running the CPU of DCO and the crystal.

We want the MCLK sourced from DCO and ACLK to be sourced from VLO or 32KHz crystal. 
The ACLK is sourced from LFXT1 by default.   

#include <msp430g2553.h>

//This small set of code takes care of an inconsistency between g2553 and g2231. It should be present.

#ifndef TIMER0_A1_VECTOR
#define TIMER0_A1_VECTOR TIMERA1_VECTOR
#define TIMER0_A0_VECTOR TIMERA0_VECTOR
#endif

void main(void)
{
 //code goes here

WDTCTL = WDTPW + WDTHOLD;  //disables the watchdog timer by sending the  password (WDTPW) and hold command (WDTHOLD)

  //calibration starts here..           
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)  //trapping the CPU                          
{  
  while(1);  // If cal constants erased, trap CPU!!
} 

 .//rest of the code for calibration...
 .
 .

Best Answer

The comment makes it pretty clear: If the calibration constants have been erased (either one is equal to 0xFF), there's no point in continuing. The constants will need to be reprogrammed before the chip can do anything useful.