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.

Cant' get UART to transmit correctly at 9600 BAUD when using an external 32Khz clock

Other Parts Discussed in Thread: MSP430F247

I have used the same code many times to set up the UART0 at 9600. when using a crystal tied to xin/xout. Now i'm using a MSP430F247 with an external 32Khz clock tied to XIN only. The UART receives data okay at 9600, but when I transmit I get all 0's or all ones?  I looked at P5.6(ACLK) and it is at 32KHZ. Am i missing something?.

I use this code to set up the UART.

BCSCTL3=XT2S_3+LFXT1S_3; //clock set up

P3SEL = 0x30; // all pins of PORT3 dio except 4,5 are usbtxrx
P3DIR = 0xF7; //ALL OUT EXCEPT P3.3,4,5 usb
P3OUT = 0xCE;



UCA0CTL1=01;//reset as puc
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32kHz/9600 = 3.41 use 3
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST;



  • But there is a transmission? And an incoming byte is recognized by the other side (computer)?
  • Thanks for the reply- Yes i receive bytes correctly into the MSP430 but when I transmit I do see data into the PC but it's all ones. I learned yesterday that sometimes it sends the right character about 1 in every 20-30 bytes when repeatedly sending the same character which makes me thing there's a timing issue with the Baud. My concern is that I have the clocks set up right for the external 32khz going into XIN. I've used this same code UART initialization many times as I said but always when using a 32K crystal tied to the micro.
  • When you see correct clock at the ACLK pin, then there's nothing wrong with the clock itself.

    What do you see at the TXD pin? (Output a series of 0x55 bytes to get a nice square wave.)

  • I got it to work, but not really sure what was wrong. it might have been a pullup too weak on the optocoupler that isolates the tx,rx from the USB bridge chip I'm using.

    Thanks for your help

  • Oh, OK, you did not say anything about an optocoupler. In that case yes, wrong dimensioned resistors and/or a bad (very slow) optocoupler can cause problems. Active parts like the 6N137 are well suited for things like that.

    Dennis

**Attention** This is a public forum