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.

MSP430 timer mode change without crystal

Howdy Everybody,

I have a project that I have been trying to get through.  It works great on a launchpad, I have been attempting to have it on its own board.  I have the pullup resistor on the reset pin, the cap on it and also the caps between VCC and ground.  I do not have the crystal.  I have been trying to modify the code to not use the crystal, as when I attempt to use the chip off the board I can not get it to work correctly. 

Delete crystal setup line

I thought I would need to enable the DCO, and I was going to use SMCLK and DIV8 I have tried many things with no luck. 

If I change it to TASSEL_2 / DIV8  it does nothing at all, it will load but do nothing. 

Thanks everybody for the help!  I thought there was a document that that had the timers explained in a more basic level, but I have not been able to locate it. 

 // Set up 32768Hz crystal
  BCSCTL3 |= XCAP_3;                              // select 12pF caps  <- DELETE LINE
     
// NEED TO INTALIZE THE DCO ??

  // initialize Timer0_A
  TA0CCR0 = ( 32768 / TICKS_PER_SECOND ) - 1;     // set up timer for 32Hz      <- CHANGE TO (125000 / TICKS_PER_SECOND) - 1 
  TA0CTL = TASSEL_1 + ID_0 + MC_1;                // configure and start timer  <- CHANGE TO TASSEL_2 + ID_3 + MC_1

  // enable interrupts
  TA0CCTL0 = CCIE;                                // enable timer CCR0 interrupts
  __enable_interrupt();                           // set GIE in SR
  LPM3;                                           // select low power mode 3
  while(1);
}


/**
* Timer interrupt called at 32Hz (TICKS_PER_SECOND)
*/
#pragma vector = TIMER0_A0_VECTOR
__interrupt void myTimerISR(void)

  • Does the code work on Launchpad?
    Just because Launchpad has a crystal your SMCLK version should still work as it ignores the aclk/crystal.
  • Someone else said it should just ignore the lack of crystal also.

    Yes it works on the launchpad.

    I have the reset and P1.3 pulled up with the ground caps, and the caps on VCC->GND just like the lanchpad per SLAU318 page 17 Launchpad users guide. I even tried swapping pins from P1.3 to P1.4 to see if I burned up the P1.3, but that did not work either. If I could find some of the protoboards to go over the launchpad I would probably just move to that just to get this done!

    Thanks!
  • does your cystal software version work on your crystal-less board with
    BCSCTL3 |= LFXT1S_2; // aclk = vloclk
  • IT WORKS IT WORKS IT WORKS!!!!!

    Thanks Tony!!!!!!

    Without that added code line it would work on my PCB when it was on the debugger.  As soon as you terminated the debug session it would not do anything.  

    With the added line of code it works everywhere now!  

    // initialize Timer0_A
      BCSCTL3 |= LFXT1S_2; // aclk = vloclk
      TA0CCR0 = ( 3276 / TICKS_PER_SECOND ) - 1;     // set up timer for 32Hz
      TA0CTL = TASSEL_1 + ID_0 + MC_1;                // configure and start timer

  • It will not be accurate though.
    vloclk is around 12Khz +-3 KHz, so a factory calibrated 1% 1MHz DCO to SMCLK is more accurate (but also uses more power)

  • This application will be just fine with the accuracy level of the VLOCLK .

    Its a added interface board for my gate opener at the house. If the driveway obstruction sensors are tripped due to fog, mist, heavy rain, snow.......you can push the remote button and hold, when it passes the time held it opens a normally closed relay that will bypass the obstruction sensor long enough to get the gate to close. It will save me the significant butt chewing from the wife when she is trying to wipe off the sensors in her work clothes in inclement weather.

**Attention** This is a public forum