Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hi,
We need the UART operation of MSP432, so I wrote the check function code before I add main function.
The function is that, when MSP432 receive data from UART, it will send out the data received.
When MSP432 received data, it can not transmit the data completely.
But if I add an break point at the code for transmitting under the debug mode, it can finish the operation completely.
Check with the code below, I set the break point at "EUSCI_A0->TXBUF = UART_Data[UART_State++];" of "void RX_Data_Operation(void)".
The same operation can run in MSP430 and MSP432E411Y-BGAEVM (MCLK=120MHz).
These are the settings of the project,
MCLK=48MHz, BR=9600, None Parity, One Stop bit.
These are my codes of setting,
void UART_Set(void)
{
P1SEL0 |= (RXD + TXD);
EUSCI_A0->CTLW0 |= EUSCI_A_CTLW0_SWRST; // Put eUSCI in reset
EUSCI_A0->CTLW0 = EUSCI_A_CTLW0_SWRST | // Remain eUSCI in reset
EUSCI_B_CTLW0_SSEL__SMCLK; // Configure eUSCI clock source for SMCLK
EUSCI_A0->BRW = 312;
EUSCI_A0->MCTLW = (8 << EUSCI_A_MCTLW_BRF_OFS) | EUSCI_A_MCTLW_OS16;
EUSCI_A0->CTLW0 &= ~EUSCI_A_CTLW0_SWRST; // Initialize eUSCI
EUSCI_A0->IFG &= ~EUSCI_A_IFG_RXIFG; // Clear eUSCI RX interrupt flag
EUSCI_A0->IE |= EUSCI_A_IE_RXIE; // Enable USCI_A0 RX interrupt
// Enable global interrupt
__enable_irq();
// Enable eUSCIA0 interrupt in NVIC module
NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31);
}
These are the receive functions,
void EUSCIA0_IRQHandler(void)
{
UART_Data[(UART_State & UART_State_Count)] = EUSCI_A0->RXBUF;
UART_State++;
if((UART_State & UART_State_Count) >= UART_Data[0])
UART_State = UART_State_Finish;
}
These are the transmit functions,
void RX_Data_Operation(void)
{
if((UART_State & UART_State_Finish)==UART_State_Finish)
{
UART_State=0;
//****************
//* TX Operation *
//****************
while(UART_State<UART_Data[0])
EUSCI_A0->TXBUF = UART_Data[UART_State++];
UART_State=0;
}
}
The following figure shows the terminal of UART setting.
The green words are data from PC to MSP432, and the blue ones are from MSP432.
The status of the first blue words (06 00) is MSP432 free run.(miss data)
The status of the second blue words (06 05 04 03 02 00) is MSP432 run under debug mode in CCS with break point.
How can I solve the problem?
BR,
Yu-Chuan Chen