I tried out the UART by echoing bytes from a terminal. Worked fine.
Then I picked off the bytes as they came in and stored them in an array.
Originally I tried an array size of 8192. This part has 16k of RAM and the UART test snip is around 600 bytes in flash.
I'm using the latest download of IAR Kickstart. With 8192, it compiled and loaded okay but the debug screen never
came out of initialization. I waited several minutes. It turns out that anything over 4674 for the array size causes that reaction.
#include "msp430x54x.h"
volatile char RCV_DATA;
volatile char XMIT_DATA;
volatile char BUFFER [4674]; // <========
volatile unsigned int CNT = 0;
const char UCR0IFG = 0x01; // Receiver full interrupt flag
const char UCT0IFG = 0x02; // Transmit buffer empty interrupt flag
const char P3TX = 0x10; // Pin on P3 used as xmit bit
void main(void)
{
// Set up the UART
P3DIR |= P3TX; // Set transmit pin to output
P3SEL |= 0x30; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // Select SMCLK as source, 8N1
UCA0BRW = 138; // 16MHz 115200 (see User's Guide)
UCA0MCTL |= UCBRS_7+UCBRF_0; // Modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RxD interrupt
__bis_SR_register(GIE); // enable interrupts
while (1)
{
__no_operation;
}
}