Hello,

I don't thick that HyperTerminal is the problem.
It can be a hardware problem.
Try to find out if it is the receiving or sending of the bytes that is the problem.

Start sending some byte (e.g. ā€˜e’), when starting the software. You test the sending of bytes.

Use an oscilloscope to check if the flanks of the RS232 signal are straight, or is there a RC-curve?
Is the time of de send-byte the same as the received-byte?
If not you wave a problem with the baud rate.

Can it be that the signal is inverted in hardware?
Is the RS232 signal between 5..12 Volt and -5..-12 Volt.?


Wat happens if you send the inverted of a ā€˜e’ (= 65h = 0110 0101 )
=> (1001 1010 = 9Ah)

Robert




Mindaugas Karciauskas wrote:
Hi,

I have a problem using USART in asynchronous recieve mode. I guess the problem is very simple, but I cannot debug it anyway. Could anybody help me to find out what's going on? Thank you in advance.

The problem:
MSP should echo a symbol. But when I send a symbol to MSP from HyperTerminal, for example 'e' (= 65h ), the software reads the buffer RXBUF0 and sends it back through TXBUF0. However I don't get back 65h but D9h instead. Or if I send 6Ch I get back FBh and so on.

It is definately not the HyperTerminal which sends the wrong code, we've checked it. And baud rates are OK too, since when I hardcode MSP to send some definate symbol, for example the same 'e' (= 65h ), I recieve it corectly, i.e 'e' (= 65h ).

My code actually is almost the same as the example "fet140_uart05_09600.c". Here it is:

#include <msp430x16x.h>
#include <signal.h>

void InitPins();

int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
InitPins(); // Pins' initialization
U0CTL = SWRST; // SWRST=1
U0CTL |= CHAR; // 8-bit character
U0TCTL |= SSEL0; // UCLK = ACLK
U0BR0 = 0x03; // 32k/9600 - 3.41
U0BR1 = 0x00; //
U0MCTL = 0x4A; // Modulation
ME1 |= UTXE0 + URXE0; // Enabled USART0 TXD/RXD
U0CTL &= ~SWRST; // Initialize USART state machine SWRST=0
IE1 |= URXIE0; // Enable USART0 RX interrupt
_EINT(); // Interrupts enabled

while (1);
}
//-------------------------------------------------------------------------------
interrupt (UART0RX_VECTOR) usart0_rx (void)
{
while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready?
TXBUF0 = RXBUF0; // read and transmit a symbol
}
//-------------------------------------------------------------------------------
void InitPins()
{
...
P3SEL = 0x30; //P3.4 and P3.5 used in USART0/UART mode
P3DIR = 0xDF; //P3.5/receive data in = IN
...
}


Reply via email to