Other Parts Discussed in Thread: CONTROLSUITE
I am trying to read strings of variable length into an array for processing.
The FIFO in the F28M35 is 16x8 but I can not read more than 8 bytes into the array. See attached modified example code (from ControlSuite) I have been playing around with below.
If I send 8 or less bytes the UART functions work fine. However, when sending more than 8 or, even more than 16, I can get to the end of the string but the array is overwritten. I only get the last 8 bytes.
I have inserted an interrupt counter which showed I get an interrupt every 8 bytes worth of data. So it seems the "UARTCharsAvail" function jumps out of the loop at 8 bytes even when more than 8 bytes is sent to the UART.
How do I make the UART read continuously (more than 8 bytes at a time), realize the data string is finished (store the array), and then wait for the next set ?
//*****************************************************************************
// The UART interrupt handler.
//*****************************************************************************
void
UARTIntHandler(void)
{
unsigned long ulStatus;
// IntDisable(INT_UART0);
f=0;
// Loop while there are characters in the receive FIFO.
while(UARTCharsAvail(UART0_BASE))
{
// Read the next character from the UART and write it back to the UART.
// 2018-01-17 Function changed to store character in "data1uart0" for examination.
//data1uart1 = UARTCharGetNonBlocking(UART0_BASE);
//for (i=0; i<8; i++)
MB_Rbuf[f] = (unsigned char) UARTCharGetNonBlocking(UART0_BASE);
f++;
}
bufnow=f;
// Get the interrupt status.
ulStatus = UARTIntStatus(UART0_BASE, true);
// Clear the asserted interrupts.
UARTIntClear(UART0_BASE, ulStatus);
UARTintCnt++;
// IntEnable(INT_UART0);
}
Thanks,
Mark C.