Quantcast
Viewing all articles
Browse latest Browse all 262198

MSP430FG4618 UART does not receive nor transmit

Hi,

I am currently using an MSP430FG4618 in a project that needed serial communication. I created a project just to test the USART in the UART mode. I think I configured all the registers right, but it did not work. The code is the following: 

/*
* main.c
*/
#include <msp430fg4618.h>

void main(void) {

WDTCTL = WDTPW | WDTHOLD; // Stop watchdog time

P4SEL |= BIT0 + BIT1;
U1CTL |= SWRST;
U1CTL |= CHAR;
U1TCTL |= SSEL0;
U1MCTL = 0x03;
UBR01 = 0x6d;
UBR11 = 0;
ME2 |= UTXE1 + URXE1;
IE2 |= URXIE1 + UTXIE1;
U1CTL &= ~SWRST;

__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
__no_operation(); // For debugger

}

#pragma vector=USART1RX_VECTOR
__interrupt void usart1_rx (void)
{
while (!(IFG1 & UTXIFG1));
TXBUF1 = RXBUF1;
}

I am not using any external clock, only the internal clock. 

After a lot of tests I tried using some MSP430ware example code for this processor. All of them seemed to use an external crystal as clock source. I tried making the changes to use the internal clock only, but I couldn't make even the example code work.

What am I missing?


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>