Hi, I am using CCS, with the MSP430FR5739 Exp board. I did a few examples a while ago, including using the printf function to complete the 'hello world' tutorial. I tried using the example code (seen in thread http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/301422.aspx), found in the MSP430FR57XX code examples folder. From this I learnt that XT1 would constantly generate a fault flag, which prevents any of the examples being used as given.
I modified the example so as to remove the XT1, and replaced it with the DCO. From the UG, this gives a DCO frequency of 8 MHz, which is divided by 8 for the SMCLK, which I specify as the baud rate clock. I calculated manually and from the UG for BRCLK = 1 MHz; BAUD = 9600; Oversampling ON, BRx = 6, RFx = 8 and RSx = 0x20.
Nothing appears on my putty terminal. I enabled loopback mode and this sends/receives the same character. I have adjusting the BR, RF and RS to give various baud rates - I don't even get junk in putty.
Appreciate any help! ( I have tried putting back on previous code which performed the hello world and that doesn't work anymore, also tried energia - but opening the serial monitor causes energia to crash, but nothing through putty)
#include <msp430.h>
unsigned int i;
unsigned char RXData = 0;
unsigned char TXData = 0;
unsigned char check = 0;
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // stop watchdog
CSCTL0_H = 0xA5; // Unlock CS register
CSCTL1 |= 0x0006; // SET DCO to 8 MHz (DCOFSEL to 11b)
CSCTL2 = SELA_3 + SELS_3 + SELM_3; // set ACLK = DCO; SMCLK=DC0; MCLK = DCO;
CSCTL3 = DIVA_0 + DIVS__8 + DIVM_0; // set all dividers
CSCTL0_H = 0x01; // Lock Register
// Configure UART pins
P2SEL1 |= BIT0 + BIT1;
P2SEL0 &= ~(BIT0 + BIT1);
// Configure UART 0
UCA0CTL1 |= UCSWRST; // Unlock UART registers
UCA0CTLW0 |= 0x00C0; // Set UCSSELx to 11b (SMCLK)
UCA0BRW = 6;
UCA0MCTLW |= 0x2081; // RSx = 0x20h | RFx = 1000b | XXX | UC0S16 = 1
//UCA0STATW |= UCLISTEN; // Uncomment to enable loopback mode.
UCA0CTL1 &= ~UCSWRST; // release from reset
UCA0IE |= UCRXIE; // Enable RX interrupt
_enable_interrupts();
while(1){
if ((UCTXIFG)){ // If TXBUF is empty then send a new character
UCA0TXBUF = 't';
}
}
// Echo back RXed character, confirm TX buffer is ready first
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV,0x08))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
PJOUT |= PJOUT + 1;
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}