Part Number: MSP430FR6989
Dear,
For my project I am using the backchannel UART connection of my MSP430FR6989 with the ACLK (not the SMCLK). I followed the examples of the example software, however, I don't seem to get it to work.
My code is as follows:
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog
// Configure GPIO
P3SEL0 |= BIT4 + BIT5; // eUSCI_A1 UART
P3SEL1 &= ~(BIT4 + BIT5); // eUSCI_A1 UART
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// XT1 Setup
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
CSCTL4 &= ~LFXTOFF;
do
{
CSCTL5 &= ~LFXTOFFG; // Clear XT1 fault flag
SFRIFG1 &= ~OFIFG;
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
CSCTL0_H = 0; // Lock CS registers
// Configure USCI_A1 for UART mode
UCA1CTLW0 = UCSWRST; // Put eUSCI in reset
UCA1CTLW0 |= UCSSEL__ACLK; // CLK = ACLK
UCA1BR0 = 3; // 9600 baud
UCA1MCTLW |= 0x5300; // 32768/9600 - INT(32768/9600)=0.41
// UCBRSx value = 0x53 (See UG)
UCA1BR1 = 0;
UCA1CTL1 &= ~UCSWRST; // Initialize eUSCI
UCA1IE |= UCRXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3, interrupts enabled
__no_operation();
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) // 04/07/2020
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA1IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
while(!(UCA1IFG&UCTXIFG));
UCA1TXBUF = 0x55;
__no_operation();
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
}
}
Bit 4 and 5 of port 3 are being set correctly, I initialize the ACLK and connect it to UCA1, and the baud rate is calculated and put in. I also adjusted everything to use UCA1 and not UCA0. Howver it does not work.
With kind regards and thanks in advance,
Yannick