This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am using the MSP430F5529 launchpad and I've tried both writing my own UART code as well as use examples I found the MSP430 Resources in CCS, however I can't seem to get a response through my terminal. I've used Real Term HTerminal and Putty, even tried a second computer and second launchpad. Could someone take a look at my code and point me in the right direction please?
#include <msp430.h>
#include <stdio.h>
/*
* Tests UART TX and RX
* main.c
*/
//FUNCTION PROTOTYPES
void OUTA_UART(unsigned int A);
unsigned int INA_UART(void);
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
unsigned int a;
//Initialize UART Control
UCSCTL4 |= SELA_2; // ACLK = REFOCLK = 32768 Hz
P3SEL |= BIT3 + BIT4; //Select P3.3 and P3.4
P3DIR |= 0x08; // P3.3 is TX output
UCA0CTL0 |= 0x20; // MSB first
UCA0CTL1 |= 0x41;
UCA0BR1 = 0;
UCA0BR0 = 3; //32768/9600
UCA0MCTL |= 0x06; // BRF = 0 BRS = 3
UCA0STAT = 0;
UCA0CTL1 &= ~UCSWRST;
_bis_SR_register(GIE);
_no_operation();
for(;;) {
a = INA_UART();
OUTA_UART(a);
}
return 0;
}
void OUTA_UART(unsigned int A) {
do {
}
while (!(UCA0IFG & UCTXIFG));
UCA0TXBUF = A;
}
unsigned int INA_UART (void) {
do {
}
while(!(UCA0IFG & UCRXIFG));
return (UCA0RXBUF);
}
You are using USCI_A0, which is the UART connected to the BoosterPack connector.
If you want to use the MSP430F5529's USB connection, you have to implement a CDC USB interface.
If you want to use the eZ-FET's application ("backchannel") UART, you have to use USCI_A1 instead.
Setting the GIE bit means that the USCI interrupt will fire as soon as UCTXIFG or UCRXIFG is set. Unfortunately you don't have an interrupt service routine, so that will hang or reset the MCU (depending on whether the compiler has included a trap ISR).
EDIT: Ignore me, UCA0IE is clear so the interrupts won't fire.
**Attention** This is a public forum