Other Parts Discussed in Thread: MSP430FR5962
Hello,
I am using MSP430f4152 with 4MHz external crystal.
The clock, timer, and gpio functions are working correctly.
Also, I am using software I2C for the MLX90614 temperature sensor.
It is fine also.
But, I encounter an issue with UART.
When I execute the UART procedure, The MCU is halted.
The followings are my UART setting and UART procedure.
<UART init>
void init_USCI(void)
{
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 26; // High Frequency Mode, Over sampling(UCOS16 = 1)
UCA0BR1 = 0;
UCA0MCTL |= UCBRF_1 + UCOS16; // UCBRFx = 1, UCOS16 = 1
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
}
<UART sending procedure>
void UCA0_chout(unsigned char tx_ch)
{
while(!(IFG2&UCA0TXIFG));
UCA0TXBUF = tx_ch;
}
void UCA0_strout_length(UBYTE *tx_str, UBYTE length)
{
UBYTE I;
for(i=0; i<length; i++) {
UCA0_chout(*(tx_str+i));
}
}
Please help me out.
Thanks,