Reply by V Barker March 11, 20042004-03-11
Chris,  

Your tips worked! I'm going to take your advice and install a HF clock
on the board for more accuracy.

Thanks for helping out an ME trying to be an embedded systems
programmer.

-Valerie 
Chris Liechti <cliechti@gmx.net> wrote in message news:<Xns94A917A5C5586cliechtigmxnet@62.2.16.4>...
> vbark66@yahoo.com (V Barker) wrote in > news:a5aff881.0403101653.7dd0d9ad@posting.google.com: > > I'm having trouble doing a simple character transmission on the > > MSP430F149 UART. I'm using SoftBaugh's ES149 eval board w/ICC430 > > compiler. The board has a 32768 Hz clock. I've verifed that it runs > > through the program. When I probe at pin UTXD0 with an oscope, all I > > see is a high signal. Can anyone help? > > high is good, thats idle. > > > #include <msp430x14x.h> > > > > void main() { > > > > // avert Watchdog reset > > WDTCTL = WDTPW + WDTHOLD; > > > > //UART init > > BCSCTL1 = 0; // ACLK = LFXT1 = HF XTAL > > BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe) > > UCTL0 = 0x11; // 8-bit character, set SWRST > > why dont you use the bit names here too, makes it easier to read the > code... > > > UTCTL0 = SSEL0; // UCLK = ACLK > > you should not clear TXEPT here. when you write software that checks if the > flag is set before writing a character, it will never work... > > > UBR00 = 0x00; // 9600 baud ACLK = 32768 Hz > > UBR10 = 0x03; // Values from table > > UMCTL0 = 0x4A; // Modulation > > you wont be happy with these settings, you'll get up to 17% error for the > bit times with is much larger than allowed. typicaly you should stay below > 2% > > you can use this form to calcualte baudrate settings and errors: > http://mspgcc.sourceforge.net/baudrate.html > > if you want to keep the watch crystal, then you need to implement the FLL > and use a higher clock frequency on SMCLK to drive the UART. > > > ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD > > P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD > > P3DIR |= 0x10; // P3.4 output direction > > i usualy use the BIT* defines from the msp header files, like > P3SEL |= BIT4|BIT5; > that way you can make shorter comments ;-) > > > // infinite transmit loop > > while(1) > > { > > while ((IFG1 & UTXIFG0) == 0); // USART0 TX buffer ready? > > TXBUF0 = 0x59; // output 'V' on TXBUF0 > > i usualy poll TXEPT in UTCTL0 > > > } > > > } > > chris
Reply by Chris Liechti March 10, 20042004-03-10
vbark66@yahoo.com (V Barker) wrote in 
news:a5aff881.0403101653.7dd0d9ad@posting.google.com:
> I'm having trouble doing a simple character transmission on the > MSP430F149 UART. I'm using SoftBaugh's ES149 eval board w/ICC430 > compiler. The board has a 32768 Hz clock. I've verifed that it runs > through the program. When I probe at pin UTXD0 with an oscope, all I > see is a high signal. Can anyone help?
high is good, thats idle.
> #include <msp430x14x.h> > > void main() { > > // avert Watchdog reset > WDTCTL = WDTPW + WDTHOLD; > > //UART init > BCSCTL1 = 0; // ACLK = LFXT1 = HF XTAL > BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe) > UCTL0 = 0x11; // 8-bit character, set SWRST
why dont you use the bit names here too, makes it easier to read the code...
> UTCTL0 = SSEL0; // UCLK = ACLK
you should not clear TXEPT here. when you write software that checks if the flag is set before writing a character, it will never work...
> UBR00 = 0x00; // 9600 baud ACLK = 32768 Hz > UBR10 = 0x03; // Values from table > UMCTL0 = 0x4A; // Modulation
you wont be happy with these settings, you'll get up to 17% error for the bit times with is much larger than allowed. typicaly you should stay below 2% you can use this form to calcualte baudrate settings and errors: http://mspgcc.sourceforge.net/baudrate.html if you want to keep the watch crystal, then you need to implement the FLL and use a higher clock frequency on SMCLK to drive the UART.
> ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD > P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD > P3DIR |= 0x10; // P3.4 output direction
i usualy use the BIT* defines from the msp header files, like P3SEL |= BIT4|BIT5; that way you can make shorter comments ;-)
> // infinite transmit loop > while(1) > { > while ((IFG1 & UTXIFG0) == 0); // USART0 TX buffer ready? > TXBUF0 = 0x59; // output 'V' on TXBUF0
i usualy poll TXEPT in UTCTL0
> } > > }
chris -- GCC for MSP430: http://mspgcc.sf.net Chris <cliechti@gmx.net>
Reply by V Barker March 10, 20042004-03-10
Hi,

I'm having trouble doing a simple character transmission on the
MSP430F149 UART.  I'm using SoftBaugh's ES149 eval board w/ICC430
compiler.  The board has a 32768 Hz clock. I've verifed that it runs
through the program.  When I probe at pin UTXD0 with an oscope, all I
see is a high signal.  Can anyone help?

Thanks,

Valerie


#include <msp430x14x.h>

void main() { 

      // avert Watchdog reset 
  WDTCTL = WDTPW + WDTHOLD; 

   //UART init
  BCSCTL1 = 0;                          // ACLK = LFXT1 = HF XTAL
  BCSCTL2 |= SELM1+SELM0;               // MCLK = LFXT1 (safe)
  UCTL0 = 0x11;                  	// 8-bit character, set SWRST
  UTCTL0 = SSEL0;                       // UCLK = ACLK
  UBR00 = 0x00;                         // 9600 baud ACLK = 32768 Hz
  UBR10 = 0x03;                         // Values from table
  UMCTL0 = 0x4A;                        // Modulation
  ME1 |= UTXE0 + URXE0;                 // Enable USART0 TXD/RXD
  P3SEL |= 0x30;                        // P3.4,5 = USART0 TXD/RXD
  P3DIR |= 0x10;                        // P3.4 output direction
  
// infinite transmit loop
  while(1)
 {
  while ((IFG1 & UTXIFG0) == 0);        // USART0 TX buffer ready?
  TXBUF0 = 0x59;                      // output 'V' on TXBUF0   
  }
  
}