I am using an MSP430FR5849 part and trying to implement the Main Memory Bootloader described in document SLAA721C.
When I attempt to configure RXD & TXD lines for eUSCI_A mode (secondary function selected for bits 0 & 1 of Port 2), it causes the part to erase all main memory FRAM back to all 0xFF bytes.
I am setting up the clock system to use the DCO at 24Mhz, with SMCLK and MCLK both set to 3Mhz (DCO/8), in case this matters.
Below is the code I'm having trouble with:
// eUSCI_A0 held in reset and use SMCLK
UCA0CTLW0 = UCSWRST | UCSSEL_2;
// Select secondary (UART) function on Port 2 pins 0 & 1
P2SEL0 &= ~(BIT0 | BIT1);
P2SEL1 |= (BIT0 | BIT1);
// Set baud rate per conditionally compiled baud rate settings
UCA0BR0 = (UCBRx_VAL & 0xFF); // Set Low baudrate byte
UCA0BR1 = (UCBRx_VAL >> 8); // Set high baudrate byte
UCA0MCTLW = UCOS16_VAL | // Set modulation values
(UCBRSx_VAL << 1) |
(UCBRFx_VAL << 4);
When I execute the assignment to P2SEL1 to OR in BIT0 and BIT1, the part erases all FRAM memory. What am I doing wrong?