Part Number: MSP430F6459
Hello Experts,
I am trying to configure UART for RS485 on MSP430F6459TPZR. The clock is 20Mhz and baudrate is 115200.
I have used the following code:
======================
P2SEL |= ( BIT4 + BIT5 ); // new UART PINs: P2.4,5 = UCA1 TXD/RXD
UCA0CTL1 = (uint8_t)UCSWRST;
UCA0CTL0 = (uint8_t)0; // 8-bit, no parity, 1 stop
UCA0CTL1 |= (uint8_t)UCSSEL__SMCLK;
UCA0BR0 = (uint8_t)0xA;
UCA0BR1 = 0;
UCA0STAT = 0x00;
UCA0IE = 0x00;
UCA0MCTL = (uint8_t)0xAD; //(uint8_t)(13 << 4) | (0xAD << 1) | UCOS16; //UCBRF_13 + 0xAD + UCOS16; //SUCBRF_13 + UCOS16; //UCBRS2 + UCBRS0; // See Table
UCA0CTL1 &= (uint8_t)~UCSWRST;
===============================
I certainly have a challenge to configure UCA0MCTL , as I cant figure out how to store UCBRSx value (0xAD) in it because from my unerstanding it should consume only 3 bits in the UCA0MCTL register.
Not sure if there is any error in other registers as well. I would really appreciate your help in this regard
Thanks,
Kavita