Hello, All. Im having some problem about UART RX in MSP430F4152.
Briefly, as soon as it is turned on, It can not receive datas from other device by RS-485 within 120ms.
It is supposed to receive 4 characters, but within 120ms it only can receive just 1 character. Also I can see RS-485 Drive IC can get the datas all by an oscilloscope and it jumps in ISR only one time.
If I send the data to MSP430F4152 with 100ms delaying, so that totally 220ms after, it works! it can receive the data, 4 characters all.
I checked that SPI and UART TX works without ISR after turning on within 30ms, However why only RX has problem like this? Does UART RX take some time to be ready?
//ACLK = LFXT1 = 32768Hz, MCLK = SMCLK = DCO = (121+1) x 32768 x 2 = 7.99 Mhz
void Init_Clock(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer to prevent time out reset
SCFI0 |= FN_4; // x2 DCO freq, 8Mhz nominal DCO
SCFQCTL = 121; // (121+1) x 32768 x 2 = 7.99 Mhz
FLL_CTL0 |= DCOPLUS + XCAP18PF; // DCO+ set so freq= xtal x D x N+1
}
void Init_Uart(void)
{
UCA0CTL1 |= UCSSEL_2; // CLK = MCLK
UCA0BR0 = 0xA0; // 8M / 19200
UCA0BR1 = 0x01;
UCA0MCTL = UCBRS_6;
UCA0CTL1 &= ~UCSWRST; // Initialize USCI state machine
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
// SPI MODE
UCB0CTL1 |= UCSSEL_2 + UCSWRST; // **Put state machine in reset**
UCB0CTL0 |= UCSYNC+UCCKPH+UCMSB+UCMST; // 3-pin, 8-bit SPI master
UCB0BR0 = 0x01; // /4
UCB0BR1 = 0x00;
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
}
// Copy the data received to r_buf
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIA0RX_ISR(void)
{
uReceiver(&r_buf);
}