EmbeddedRelated.com
Forums

start up delay in ACLK (LFXT1)

Started by Rahul Bajaj February 22, 2008
Hello all,

I am using MSP130F169 and trying to calculate delay time when the
32,768 Hz crystal is switched off and when it is switched on again
till it acquires normal frequency (startup delay of LFXT1 whihc is
sorce of ACLK).

I am sourcing MCLK from DCO and then go into a timer interrupt where
I wrote following code:

#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A0( void )
{
P4DIR = 1;
TACTL &= ~TAIFG;
static int i = 0;
if( i == 0)
{
_BIS_SR(OSCOFF); //here I dwitch of LFXT1
i++;
P4OUT ^= 1; //I use this as trigger for my oscilloscope
}

_BIC_SR_IRQ(LPM4_bits); //When triggered, I switch on LFXT1
//and measure time difference b/w last &
//this instruction
}
To my surprise, I can not see any startup delay although it should
take few ms at least.

Can someone tell me, how I can do it?

Thanks and kind regards,
Rahul

Beginning Microcontrollers with the MSP430

Why not try something simple?

For example:
void main( void )
{
WDTCTL = WDTPW + WDTHOLD;
P4OUT = 1;
P4DIR = 1;
while (1)
{
P4OUT = 0;
__bis_SR_register(OSCOFF);
__delay_cycles(1000000);

P4OUT = 1;
__bic_SR_register(OSCOFF);
__delay_cycles(2000000);
}
}
--- In m..., "Rahul Bajaj" wrote:
>
> Hello all,
>
> I am using MSP130F169 and trying to calculate delay time when the
> 32,768 Hz crystal is switched off and when it is switched on again
> till it acquires normal frequency (startup delay of LFXT1 whihc is
> sorce of ACLK).
>
> I am sourcing MCLK from DCO and then go into a timer interrupt where
> I wrote following code:
>
> #pragma vector=TIMERA0_VECTOR
> __interrupt void Timer_A0( void )
> {
> P4DIR = 1;
> TACTL &= ~TAIFG;
> static int i = 0;
> if( i == 0)
> {
> _BIS_SR(OSCOFF); //here I dwitch of LFXT1
> i++;
> P4OUT ^= 1; //I use this as trigger for my oscilloscope
> }
>
> _BIC_SR_IRQ(LPM4_bits); //When triggered, I switch on LFXT1
> //and measure time difference b/w last &
> //this instruction
> }
> To my surprise, I can not see any startup delay although it should
> take few ms at least.
>
> Can someone tell me, how I can do it?
>
> Thanks and kind regards,
> Rahul
>
Thank you old_cow_yellow. That was simple, effective and helpful :-)

--- In m..., "old_cow_yellow"
wrote:
>
> Why not try something simple?
>
> For example:
> void main( void )
> {
> WDTCTL = WDTPW + WDTHOLD;
> P4OUT = 1;
> P4DIR = 1;
> while (1)
> {
> P4OUT = 0;
> __bis_SR_register(OSCOFF);
> __delay_cycles(1000000);
>
> P4OUT = 1;
> __bic_SR_register(OSCOFF);
> __delay_cycles(2000000);
> }
> }
> --- In m..., "Rahul Bajaj" wrote:
> >
> > Hello all,
> >
> > I am using MSP130F169 and trying to calculate delay time when
the
> > 32,768 Hz crystal is switched off and when it is switched on
again
> > till it acquires normal frequency (startup delay of LFXT1 whihc
is
> > sorce of ACLK).
> >
> > I am sourcing MCLK from DCO and then go into a timer interrupt
where
> > I wrote following code:
> >
> > #pragma vector=TIMERA0_VECTOR
> > __interrupt void Timer_A0( void )
> > {
> > P4DIR = 1;
> > TACTL &= ~TAIFG;
> > static int i = 0;
> > if( i == 0)
> > {
> > _BIS_SR(OSCOFF); //here I dwitch of LFXT1
> > i++;
> > P4OUT ^= 1; //I use this as trigger for my
oscilloscope
> > }
> >
> > _BIC_SR_IRQ(LPM4_bits); //When triggered, I switch on LFXT1
> > //and measure time difference b/w last
&
> > //this instruction
> > }
> >
> >
> > To my surprise, I can not see any startup delay although it
should
> > take few ms at least.
> >
> > Can someone tell me, how I can do it?
> >
> > Thanks and kind regards,
> > Rahul
>