Help!! UART using USCI_A0 with MSP430FG4618

マイコン(主にTI)ソフトウエア日英掲示板
Discussions about microcontroller (mostly TI) software (english - japanese)

Help!! UART using USCI_A0 with MSP430FG4618

Postby vincent fung » Mon Aug 30, 2010 7:58 pm

Hello,

This is my first time using msp430 series. I am using the MSP430FG4618 experimenter's board and I would like to have RS232 communication. After developing my own program, it doesn't work. Therefore, I tried with the TI sample code.

With the sample code from msp430xG46x_uscia0_uart_9600.c developed by TI, I still cannot transmit signal through RS232 via terminal. I don't know whether the setting in the program has something wrong or the hardware.

Can anyone give me help? I have tried to debug and the program can actually run into the interrupt.

#include "msp430xG46x.h"

void main(void)
{
volatile unsigned int i;

WDTCTL = WDTPW+WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP18PF; // Configure load caps

P5OUT&=~BIT1;
P5DIR|=BIT1;
P2SEL = BIT4|BIT5; // P2.4,5 = USCI_A0 RXD/TXD

UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32k/9600 - 3.41
UCA0BR1 = 0x00;
UCA0MCTL = 0x06; // Modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE+UCA0TXIE; // Enable USCI_A0 RX interrupt

_BIS_SR(GIE);
while(1);
}

// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIA0RX_ISR (void)
{
P5OUT^=BIT1;
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
}

#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCIA0TX_ISR (void)
{
}
vincent fung
 
Posts: 1
Joined: Mon Aug 30, 2010 7:53 pm

Re: Help!! UART using USCI_A0 with MSP430FG4618

Postby pascal » Tue Aug 31, 2010 5:49 pm

Hello!

Welcome to this forum!
I didn't read your program in detail, but I have downloaded msp430xG46x_uscia0_uart_9600.c
and it is not the same as yours.

Are you sure that your ACLK is running?
In the original code, there was an oscillator fault check loop that has been removed in your code.
If the oscillator does not work, it might cause some malfunction.

Now why do you set a while loop? (while(1)) after setting low power mode. Basically you set
the system to low power mode, but you force it to loop forever…

Also set the LPM0 bits together with GIE.

I would advice that at first, you make sure that the code you use fits the board, and that
you don't modify anything. If it does not work as is, then it means that the problem
is somewhere else (i.e. not in the code but in the hardware or in the PC connection).

Pascal
pascal
Site Admin
 
Posts: 231
Joined: Sun Mar 04, 2007 11:47 am


Return to Microcontroller software

Who is online

Users browsing this forum: No registered users and 1 guest

cron