Other Parts Discussed in Thread: MSP-EXP432E401Y
Hello,
I am developing Uart driver on MSP-EXP432E401Y Launchpad. I have made changes in the example code of Uartecho using freertos. Now I am able to service receive interrupt but my transmit interrupt doesn't get triggered. Below is the snippet I am working on. Please let me know if I am missing anything.
//*****************************************************************************
//
// The UART interrupt handler.
//
//*****************************************************************************
void UART0_IRQHandler(void)
{
uint32_t ui32Status = 0;
uint8_t ui8RxData = 0;
//
// Get the interrupt status.
//
ui32Status = MAP_UARTIntStatus(UART0_BASE, true);
if((ui32Status & UART_INT_RX || ui32Status & UART_INT_RT) && MAP_UARTCharsAvail(UART0_BASE))
{
//
// Clear the asserted interrupts.
//
MAP_UARTIntClear(UART0_BASE, UART_INT_RX);
//Read the data
ui8RxData = (unsigned char)MAP_UARTCharGetNonBlocking(UART0_BASE);
//global data structure to be added here
}
if(ui32Status & UART_INT_TX)
{
MAP_UARTIntClear(UART0_BASE, UART_INT_TX);
if(TxBuf.ui16NbCharToSend > 0)
{
MAP_UARTCharPutNonBlocking(UART0_BASE, TxBuf.ui8DatBuf[TxBuf.ui16NbCharToSend]);
TxBuf.ui16NbCharToSend--;
}
else
{
//MAX485 direction pin RX operation set
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0);
MAP_UARTIntDisable(UART0_BASE, UART_INT_TX);
}
}
}
void UART0_Init(uint32_t ui32baud)
{
UART_Handle uart;
UART_Params uartParams;
/* Call driver init functions */
UART_init();
/* Configure the LED pin as transceiver - PN1*/
GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = ui32baud;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
/* UART_open() failed */
while (1);
}
IntRegister(INT_UART0, UART0_IRQHandler);
MAP_IntEnable(INT_UART0);
MAP_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
}
//*****************************************************************************
//
// Send a string to the UART.
//
//*****************************************************************************
void UARTSend(const uint8_t *pui8Buffer, uint16_t ui16Count)
{
uint16_t ui16Cnt;
//Disable global interrupts
MAP_IntMasterDisable();
//MAX485 direction pin TX operation set
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 2);
for(ui16Cnt = 0;ui16Cnt < ui16Count; ui16Cnt++)
{
TxBuf.ui8DatBuf[ui16Cnt] = *pui8Buffer++;
}
TxBuf.ui16NbCharToSend = ui16Count;
//Enable Uart transmit interrupt
MAP_UARTIntEnable(UART0_BASE, UART_INT_TX);
//Enable processor interrupts
MAP_IntMasterEnable();
}