EmbeddedRelated.com
Forums

UART Response Problem

Started by matthewolsthoorn March 6, 2007
Much appreciated, good to be "exonerated" :-)
I hope the scepticism I received might be reconsidered !

I actually owe you a good apology....
I looked through the thread again and noticed this :

> This couple of lines I added to try and get the TX pin to send anything.
> This of course didn't work.

I thought you were referring to my suggestion about the P3DIR.
I now realise that you were referring to the - obviously - test loop you
put in to _directly_ send data to TXD.
This makes sense now : "This of course didn't work".

I should have known really, because you referred to "lines" - not "line"
(which would then refer to setting TXD in P3DIR).
Again, I apologise for the mix-up !!!!

Anyway, glad to hear it's working now - and that my assertion has been confirmed.
I still have a F149 tray of chips that need P3DIR set, that's why I just leave the P3DIR line in,
just in case different rev is used.

If others want to go their own way, that's their prerogative I guess......

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of matthewolsthoorn
Sent: Sunday, 11 March 2007 2:08 AM
To: m...
Subject: [msp430] Re: UART Response Problem

Just an update. I've Tried setting the port 3 directions like
suggested and it seems to be working now. Thanks for the help guys.
I used the same code as posted earlier. Just changes the Port3 directions.

--- In m..., "matthewolsthoorn"
wrote:
>
> Hi,
>
> I've been trying to setup the UART on my MSP430f149 using the sample
> code given. I haven't had much luck. I'm not sure exactly what's going
> on. The code I used is exactly the C example code provided by TI shown
> below. However, the interrupt never gets called. (I've send data
> directly into the receive pin). I tried to just pass data into the
> transmit pin but nothing ever shows up on the pin (I used an
> oscilloscope).
>
> Is there some setup that I need to set other than these software parts?
> Are there any other pins that need to be used?
>
> This is what I've done:
> Powered the Micro
> Places a 8Mhz oscillator
> Observed the transmit pin for any activity
>
> So far I've not managed to get it to work. What did I miss?
> #include void main(void)
> {
> volatile unsigned int i;
> WDTCTL = WDTPW + WDTHOLD; // Stop WDT
> P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD
>
> BCSCTL1 &= ~XT2OFF; // XT2on
>
> do
> {
> IFG1 &= ~OFIFG; // Clear OSCFault flag
> for (i = 0xFF; i > 0; i--); // Time for flag to set
> }
> while ((IFG1 & OFIFG)); // OSCFault flag still set?
>
> BCSCTL2 |= SELM_2 + SELS; // MCLK = SMCLK = XT2 (safe)
> ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD
> UCTL0 |= CHAR; // 8-bit character
> UTCTL0 |= SSEL1; // UCLK = SMCLK
> UBR00 = 0x45; // 8MHz 115200
> UBR10 = 0x00; // 8MHz 115200
> UMCTL0 = 0x00; // 8MHz 115200 modulation
> UCTL0 &= ~SWRST; // Initialize USART state
> machine
> IE1 |= URXIE0; // Enable USART0 RX
interrupt
>
> _BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
>
> while (1)
> {
> TXBUF0 |=0xF0;
> }
> }
>
> #pragma vector=UART0RX_VECTOR
> __interrupt void usart0_rx (void)
> {
> while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready?
> TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0
> }
>

Yahoo! Groups Links

Beginning Microcontrollers with the MSP430