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.

MSP430F2001 external crystal

Hi there,

I would like to make sure that this code is enabling the external 32.768kHz watch crystal and also I would like to know how to enable the internal 6pF load capacitors for the crystal. I'm a hardware engineer so I will pass on the info to my software engineer. Thanks!

Andy.

 

void main(void)
{
  BCSCTL1 |= XCAP_1;                        // ACLK/2
  WDTCTL = WDT_ADLY_16; //250               // WDT 1s/4 interval timer
  IE1 |= WDTIE;                             // Enable WDT interrupt
 
  P1DIR = 0xF8;                             // All P1.x outputs
  P1OUT = 0;                                // All P1.x reset
  P2DIR = 0xFF;                             // All P2.x outputs
  P2OUT = 0;                                // All P2.x reset
 
  P1OUT |= 0x08;
 
  // initilize variables
  #if MY_DEBUG
  i_error = 0;
  led_on_mask = 0x08;
  mode = TEST_MODE;

  #else
  i_error = 0;
  led_on_mask = 0;
  mode = 0;
  #endif
 
  cnt_watering_hour = 0;
  cnt_watering = 0;
  upper_limit_hour[0] = 4;
  upper_limit_hour[1] = 6;
  upper_limit_hour[2] = 12;
 

  while(1)

  • The BOR/POR automatically enables the internal 6pF load capacitors for the crystal.

    The line: " BCSCTL1 |= XCAP_1;                        // ACLK/2" does not make any sense.to me

    The line: " P2DIR = 0xFF;                             // All P2.x outputs" seems incorrect too, I think BIT6 should be 0

  • Hi,

    To add to OCY's post, see page 301 of the 2xx User's Guide, which gives bit settings for all internal cap values.

  • Hi Brandon,

    I can't find the information in the datasheet where it says what the default value for the BCSCTL3 (load capacitance) register is. The crystal I'm using has a specified load capacitance of 12.5pF in the datasheet. Can you please point me to this information so that I can verify I have the correct load capacitance selected?

    The problem i'm seeing is that the processor doesn't always start up when i power on the board. I've narrowed it down to either the Vcc ramp rate affecting the reset behaviour or the crystal not starting. The supply comes up in about 50-100us. The startup seems to become more reliable the slower I make the supply ramp up.

    Any advice much appreciated.

    Andy.

  • Andy said:

    I can't find the information in the datasheet where it says what the default value for the BCSCTL3 (load capacitance) register is. The crystal I'm using has a specified load capacitance of 12.5pF in the datasheet. Can you please point me to this information so that I can verify I have the correct load capacitance selected?

    Section 5.3 of the MSP430x2xx Family User's Guide (SLAU144) has the reset value of the BCSCTL3 in Table 5-1.  This value is 0x05.  Furthermore, the register definition for BCSCTL3 has the reset value of each bit field under the illustration.  A XCAPx=01b equates to 6pF.

     

**Attention** This is a public forum