Other Parts Discussed in Thread: TRF7970A,
Hi,
I have a custom board based on MSP430F2370 and TRF7970A. The TRF7970A has a 13.56MHz crystal and SYS_CLK of TRF7970A is connected to XIN of MSP430F2370.
The TRF7970A SYS_CLK output is configured at 6.78MHz.
I'm trying to setup UART between MSP430F2370 and external controller and it is not working. Below is my code for Oscillator setup and Uart setup of MSP430F2370.
void MCU_OscSel(){
BCSCTL1 |= XTS + XT2OFF; // ACLK = LFXT1 HF XTAL
BCSCTL3 |= LFXT1S1; // 3 – 16MHz crystal or resonator
// the TRF796x sys_clk pin works as ocillator
// it is set to 6.78 MHz (= 13.56 MHz / 2) in Trf797xInitialSettings()
// turn external oscillator on
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (ii1 = 0xFF; ii1 > 0; ii1--) // Time delay for flag to set
{
}
} while ((IFG1 & OFIFG) == OFIFG); // OSCFault flag still set?
BCSCTL2 |= SELM1 + SELM0 + SELS; // MCLK = SMCLK = HF LFXT1 (safe)
}
void UART_setup(void) // uses USCI_A0
{
P3SEL |= BIT4 + BIT5; // P3.4, P3.5 - UART mode
P3DIR |= BIT4; // P3.4 - output direction
UCA0CTL1 |= UCSWRST; // disable UART
UCA0CTL0 = 0x00;
UCA0CTL1 |= UCSSEL_2 + UCSWRST; // Source from SMCLK, keep SW Reset
UCA0BR0 = 0x3A; // Baud Rate = 115200
UCA0BR1 = 0x00;
UCA0MCTL = 0;//UCBRS_2 + UCBRS0; // Modulation UCBRSx = 2
UCA0CTL1 &= ~UCSWRST; // Initialize USCI state machine
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
}
Regards,
Madhusudhan