MSP430 serial receive-RX problem

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

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 }

Reply to
Nicemark
Loading thread data ...

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

Reply to
Paul Burke

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

Reply to
Andrew Jackson

"Andrew Jackson" wrote in news: snipped-for-privacy@eclipse.net.uk:

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

Agreed. Minicom even nicer.

--
- Mark ->
--
Reply to
Mark A. Odell

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

Reply to
Nicemark

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.

Reply to
David Brown

... snip ...

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

 "I support the Red Sox and any team that beats the Yankees"
Reply to
CBFalconer

Google is your friend - the tera term pro home page is the first hit when googling for "tera term pro":

formatting link

Reply to
David Brown

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.