You cannot switch directly to SMCLK after turning on XT2. You must wait in a
loop testing the oscillator flag. Even after this flag indicates the
oscillator is running, you must wait some time as the osc is still
"bouncing" around in level as it stabilises.

The following I posted several days ago. It is not optimal, but it does seem
to get around most HF oscillator problems in an MSP430F149. (in fact, the
code is fairly messy)



// attach HF crystal (8.000MHz) to XT2IN/OUT
        BCSCTL1 &= ~XT2OFF ;  // enable xtl2

do                   //wait in loop until crystal is stable
{
            IFG1 &= ~OFIFG;
} while(OFIFG & IFG1);

// But, the osc has only indicated that it is running, instability is still
possible in fact, seen it all the time in prototypes! so ...

NeedHFXTAL:

        for (TimeFix = 0; TimeFix < 2048; TimeFix++)  // osc bit indicated ok, 
now
give another few thousand cycles to stabilise
        {
            IFG1 &= ~OFIFG;  // continuously reset the osc fault flag
        }

        if ( (IFG1 & OFIFG) ) goto NeedHFXTAL; // osc fault flag is still set

        BCSCTL2 = SELM_2 | DIVM_0 | SELS | DIVS_0;   // This is 0x88, MCLK & 
SMCLK
to XTL2


The only problem with the above is that failure of the HF oscillator will
cause the code above to freeze in an infinite loop. Maybe a loop count
should be added, and beyond a certain amount of tries, some fault flag
should be set.







Cheers
Harry




-----Original Message-----
From: [email protected]
[mailto:[email protected]]on Behalf Of helick
Sent: Thursday, June 19, 2003 4:29 AM
To: [email protected]
Subject: [Mspgcc-users] Re: MSP430F149 & RF RS232 help...

Oi Pedro,

Obrigado por responder.

Don't worry about the previous code I posted, I mis-read something and
ACLK should not have been used since I don't have an external clock
source, it's SMCLK now...
The problem I am having now is that I cannot detect any signals coming out
of
TXBUF0.  I plugged it in a logic analyser and nothing comes out.

Bellow is my setup() function.  I don't quite know what might be wrong, my
prof. looked over it and didn't find anything wrong either, hopefully you
can.

Thank you in advance.

-helio

---code bellow------

void setup (void)
{
    //port/pin setup for the specialCOMM
    P3DIR |= BIT4;
    P3SEL |= BIT4;              // Select pins to alternate function

    //clock setup
    BCSCTL1 = 0x04;
    BCSCTL2 |= 0x88;

    //INITIALIZE serial port 0
    UCTL0 = CHAR | SWRST;       // 8 bit chars - leave in reset mode
    UTCTL0 = 0x20;          // uclk = smclk
    UBR10 = 0x01;               // 3.6864MHz/9600bps = 384 = 0x180
    UBR00 = 0x80;
    UMCTL0 = 0x00;
    ME1 |= UTXE0;               // Enable Tx0
    UCTL0 = CHAR;               // 8 bit chars - take out of reset

    IE1 |= UTXIE0;              //enable Tx0 interrupt

    eint();
}




On Mon, 16 Jun 2003 09:39:25 -0300, Pedro Zorzenon Neto wrote:

> Hi helick,
>
>   Some radio require CTS/RTS control pins of RS232. Can you send us a
> link to SS900 radio datasheet?
>
>   What is the oscilator you are using in MSP430? external cristal? what
> is the frequency? You could try to lower the baud rate to 300bps just
> for testing purposes.
>
>   Hope this helps,
>    Pedro
>
> On Sat, Jun 14, 2003 at 05:18:36PM -0400, helick wrote:
>> Hi all,
>>
>> I am having a little problem.
>> I am using my msp430f149 to go out and get some data out of my solar car
>> and transmit it out using a RF data radio which understands rs232.
>> The program in this message illustrates how I am trying to acomplish
this.
>>  I created a dummy char array filled with 'a' chars, then I just try to
>> send it out.  The problem I am having is that the radio does not even
>> twitch.  I know they are working because I have connected them to a
couple
>> machines and they talked.
>> I did get the ckt working, so I am pretty sure it's a problem with my
code.
>>
>> Anyways, here is what I am using:
>> - Newlink SS-900 radio (set to 9600bps)
>> - max3233eepp rs232 transceiver
>>
>> I am thinking that maybe I've set my clk/baud incorrectly for
>> 9600bps...
>>
>> I appreciate any help.
>> -helio
>
> --- cut the code ---
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: eBay
> Great deals on office technology -- on eBay now! Click here:
> http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users


Reply via email to