Using MSP430FR5969 Launchpad, TI-RTOS 2.12 and CCS 6.1.
I'm having issues with the TI-RTOS UART driver causing an interrupt that it doesn't handle when I use UART_read().
Interrupt 48 USCI_A0_VECTOR -- handles UART reading and writing, but it _should_ be caught "under the hood" by the UART driver functions.
On a UART write, I fixed it by using UART_writePolling, which does not use interrupts.
However, UART_readPolling polls forever even though I know there is input (I checked with a scope).
Inserting a delay before the read didn't help.
Trimmed code:
///// UART_init() was called in main()
UART_Params_init(&uartParams); /// INIT
uartParams.writeDataMode = UART_DATA_BINARY; // Data processing off
uartParams.readDataMode = UART_DATA_BINARY; // ""
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 9600;
uartParams.readTimeout = 500; // ms
uartParams.writeTimeout = 500; // ms
uartParams.stopBits = UART_STOP_ONE;
uartParams.parityType = UART_PAR_NONE;
uartParams.dataLength = UART_LEN_8;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
errorFxn();
}
nRet = UART_writePolling(uart, packet, numBytes); /// WRITE
if (nRet == UART_ERROR) {
errorFxn();
}
else if (nRet != numBytes) { // not all data was written
errorFxn();
}
nRet = UART_read(uart, sysstateResponsePacket, SYSSTATE_RESPONSE_SIZE); /// READ (gets stuck in interrupt here)
if (nRet == UART_ERROR) {
errorFxn();
}
else if (nRet != SYSSTATE_RESPONSE_SIZE) { // not all data was read
errorFxn();
}
/////
When I pause execution with debugger, it's stuck in a while loop stub in HwiFuncs.c:
/////
#pragma vector = 48;
__interrupt Void ti_sysbios_family_msp430_Hwi48(Void)
{
while(1){}; // <=== stuck here
}
/////
I managed to catch the interrupt by registering an HWI with the RTOS config.
However, the interrupt keeps occurring forever.
/////
__interrupt void null_USCI_ISR(void)
{
UCA0IE &= ~(UCTXCPTIE & UCSTTIE & UCTXIE & UCRXIE); // (try to) disable all uart interrupts
}
/////
How do I successfully read with this driver?