Part Number: MSP430FR5994
Other Parts Discussed in Thread: MSP-EXP430FR5994
Hi,
I have a problem with MSP430 FR5994
I want to use UCA 1 to handle UART but my code doesn't work
The same program works for UCA2 and UCA3 but it doesn't for UCA1
UCA1:
void UART_init (void) {
// Configure GPIO
P2SEL1 & = ~ (BIT5 | BIT6);
P2SEL0 | = (BIT5 | BIT6);
// Configure USCI_A3 for UART mode
UCA1CTLW0 = UCSWRST; // Put eUSCI in reset
UCA1CTLW0 | = UCSSEL__SMCLK; // CLK = SMCLK
UCA1BRW = 8; // 1000000/115200 = 8.68
UCA1MCTLW = 0xD600; // 1000000/115200 - INT (1000000/115200) = 0.68
// UCBRSx value = 0xD6 (See UG)
UCA1CTLW0 & = ~ UCSWRST; // release from reset
UCA1IE | = UCRXIE; // Enable USCI_A1 RX interrupt
}
void UART_sendChar (char character) {
while (! (UCA1IFG & UCTXIFG));
UCA1TXBUF = character;
}
UCA2: (it works)(Of course, there are other transmission parameters here, but with the ones mentioned above from UCA1 it also works)
void UART_init(void){
// Configure GPIO for USCI_A2 UART
P5SEL1 &= ~(BIT4 | BIT5);
P5SEL0 |= (BIT4 | BIT5); // USCI_A2 UART operation
// Configure USCI_A2 for SDI12
UCA2CTLW0 |= UCSWRST; // Put eUSCI in reset
UCA2CTLW0 = 0xD081; // CLK = SMCLK, Data = 7Bit, Parity = Even
UCA2BRW = (1000000ul / 1200) + 1; // Baud Rate = 1200
UCA2MCTLW = 0xD600;
UCA2CTLW0 &= ~UCSWRST; // release from reset
}
void SDI12_sendChar(char character){
while(!(UCA2IFG & UCTXIFG));
UCA2TXBUF = character;
}
of course UCA2 and UCA3 uses other pin configuration.
I tried this code on the eval board: MSP-EXP430FR5994 but also on the PCB, which I made myself with (64PIN) MSP430FR5994IPM. I have problem with UCA1 UART on both
Cheers,
Przemysław Zielony