Other Parts Discussed in Thread: MSP-EXP432E401Y
Hi,
I'm developing on an MSP-EXP432E401Y dev board, for the MSP432E401. I'm trying to get a simple UART working, but I can't seem to get the ISR to fire. I've run the uart_echo demo from the SimpleLink SDK, and that works as expected, but my code doesn't. The project is based on the empty example in the SDK, and I've compared the starting files in my project with the ones in uart_echo, and the important stuff is the same. If I copy the uart_echo.c file into my project, and adjust it to run on UART5 (and exclude my own main.c), the demo code works as expected - the ISR is firing to echo the received characters back as expected.
I'm using DriverLib, SimpleLink v4.20.00.12. My code looks like this:
#include <stdint.h>
#include <stdbool.h>
#include "ti/devices/msp432e4/driverlib/driverlib.h"
#define UART_BUF_SIZE 32
volatile unsigned char uartBuf[UART_BUF_SIZE] = "System Test\n";
volatile unsigned char uartHead = 12, uartTail = 0, uartCount = 12;
void UART5_IRQHandler(void)
{
uint32_t ui32Status = UARTIntStatus(UART5_BASE, true);
UARTIntClear(UART5_BASE, ui32Status);
if ((ui32Status & UART_INT_TX) && uartCount)
{
UARTCharPutNonBlocking(UART5_BASE, uartBuf[uartTail]);
uartTail = (uartTail + 1) % UART_BUF_SIZE;
uartCount--;
}
}
int main(void)
{
uint32_t SysClock;
// running from PLL at 120 MHz
SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
// enable main interrupts
IntMasterEnable();
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinConfigure(GPIO_PC6_U5RX);
GPIOPinConfigure(GPIO_PC7_U5TX);
GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
UARTConfigSetExpClk(UART5_BASE, SysClock, 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
IntEnable(INT_UART5);
UARTIntEnable(UART5_BASE, UART_INT_RX | UART_INT_RT | UART_INT_TX);
// start TX
uartTail = 1;
uartCount--;
UARTCharPutNonBlocking(UART5_BASE, uartBuf[0]);
while (1)
{
}
}
With a terminal attached to PC5 and PC7, I can see the first character, but no more. Debugging, the UART5 ISR is never hit - it seems like the TX interrupt never fires. I've followed the example, and the documentation, and I'm not sure what I'm missing here - can anyone suggest the really obvious thing I'm doing wrong, please?