MSP430 serial receive-RX problem

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi!

I am trying to get the TX/RX echo example program to work on an Olimex
Easyweb II MSP430 starter kit. I am able to receive character on the
host PC using HyperTerminal to monitor the serial connection (TX on
embedded microcontroller). However, it does not receive any characters
sent from the terminal program, and I am just about out of options on
how to debug this problem. Anyone that could provide any help? I post
my code (small changes from TI example to adapt to other oscillator
frequency).

Thanks, regards

/Nicemark


#include <msp430x14x.h>

void main(void)
{
  unsigned int i;
  WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
  P3SEL |= 0x30;                        // P3.4,5 = USART0 TXD/RXD
  P3DIR &= ~0x20;  // set bit 5 to low = input
  P3DIR |= 0x10;  // set bit 4 to high = output
  BCSCTL1 |= XTS;                       // ACLK = LFXT1 = HF XTAL

  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_3;                    // MCLK = LFXT1 (safe)
  ME1 |= UTXE0 + URXE0;                 // Enable USART0 TXD/RXD
  UCTL0 |= CHAR;                        // 8-bit character
  UTCTL0 |= SSEL0;                      // UCLK = ACLK
  UBR00 = 0x41;                         // 8Mhz/9600 = 0x341
  UBR10 = 0x03;                         //
  UMCTL0 = 0x00;                        // no modulation
  UCTL0 &= ~SWRST;                      // Initialize USART state
machine
  IE1 |= URXIE0;                        // Enable USART0 RX interrupt

  TXBUF0 = 'x';

  _BIS_SR(LPM0_bits + GIE);             // Enter LPM0 w/ interrupt
}

#pragma vector=UART0RX_VECTOR
__interrupt void usart0_rx (void)
{
  while (!(IFG1 & UTXIFG0));            // USART0 TX buffer ready?
  TXBUF0 = RXBUF0;                      // RXBUF0 to TXBUF0
}

Re: MSP430 serial receive-RX problem

Quoted text here. Click to load it

Without digging up my examples (I use MSP430 a lot, but I wrote the UART
code a long time ago), why not try it in stages:

(0) Is HyperTerminal broken? I had this recently when playing with an
ez80. I used TeraTerm instead, and all was fine.

(1) get rid of the interrupt. Loop transmitting a character in main().
Does the output appear?

(2) Once (1) works, wait to receive a character in main and echo it. Use
the scope to check that the character actually reaches the pin.

(3) Then put the lot back in interrupt. Make it flash an LED or an
output you can scope when it goes through the ISR.

Paul Burke


Re: MSP430 serial receive-RX problem
Quoted text here. Click to load it
I'd second that as a first step (!). HyperTerminal is not very happy unless
all the control lines are connected and even then it gets things wrong.
TeraTerm is much easier to use, has macros and doesn't pester you with
dialog boxes.

    Andrew



Re: MSP430 serial receive-RX problem

Quoted text here. Click to load it

No, not if you configure it for Flow Control = none.

Quoted text here. Click to load it

Agreed. Minicom even nicer.

--
- Mark ->
--

Re: MSP430 serial receive-RX problem
Thanks all for your replies. As is, my first sample code printed a
character 'x' in Hyperterminal, thus everything seemed fine in baud
rate settings, register settings and so on. Every other example I've
tried has worked like charm every time. But, reading your suggestions
led me to try with Hyperterminal once more, with flow control = none.
And what do you know, it worked!!

I'll try Tera Term next time! But a brief search for Tera Term led me
to think it wasn't supported by Win XP, but I've just hit another site
which seems to support TT Pro for Win XP.

Well, thanks for now.

Regards

/Nicemark



Quoted text here. Click to load it

Re: MSP430 serial receive-RX problem

Quoted text here. Click to load it

Tera Term is one of these rare programs which does everything the author
wanted it to do, and is (as far as I know) bug-free.  Thus it has not
changed in 5 years, simply because it does not need to be changed.  As far
as I have heard, it works fine in all 32-bit windows (and there is a win3.1
version too).  Since it is open source, a few others have made extensions
for ssh and webby stuff, but the serial port stuff is the same.




TeraTerm (was: MSP430 serial receive-RX problem)
Quoted text here. Click to load it
... snip ...
Quoted text here. Click to load it

I found I had a distribution from 1998 tucked away on my drive,
and it looks good.  Do you know offhand where the source is to be
found?  My only wishes so far are that it had a single page
printable helpfile/manual and that the 'monitor communications'
ability had been implemented.

--
 "This is a wonderful answer. It's off-topic, it's incorrect,
  and it doesn't answer the question."  --  Richard Heathfield

We've slightly trimmed the long signature. Click to see the full one.
Re: TeraTerm (was: MSP430 serial receive-RX problem)

Quoted text here. Click to load it

Google is your friend - the tera term pro home page is the first hit when
googling for "tera term pro":
http://hp.vector.co.jp/authors/VA002416/teraterm.html



Quoted text here. Click to load it



Site Timeline