Hello Team,
I tried different possibilities, but in the USART interrupt handler I am able to receive only receive only 17bytes.
This is my interrupt handler code, please let me know if I am missing anything,
#define BUFF_SIZE 256
uint8_t rx_buffer[BUFF_SIZE];
void Test_USART2_IRQHandler(void)
{
uint8_t data;
while ((0x1F<<USART_FIFOSTAT_RXLVL_SHIFT) & (USART_IF2->FIFOSTAT))
{
data = USART_ReadByte(USART_IF2);
if (((rxHeadIndex + 1) % BUFFER_SIZE) != rxTailIndex)
{
rxBuffer[rxHeadIndex] = data;
rxHeadIndex++;
rxHeadIndex %= BUFFER_SIZE;
}
}
USART_DisableInterrupts( USART_IF2, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable );
SDK_ISR_EXIT_BARRIER;
}
// Processing the received data in another task, and enabling interrupts after copying the complete data.
With this I am receiving this data,
Received -> 1
Received -> 2
Received -> 3
Received -> 4
Received -> 5
Received -> 6
Received -> 7
Received -> 8
Received -> 9
Received -> 10
Received -> 11
Received -> 12
Received -> 13
Received -> 14
Received -> 15
Received -> 16
Received -> 17
In the same interrupt handler code, If I include these lines, after USART_ReadByte,
// Check for the RX FIFO Overflow error and if exist, clear that error
if ((USART_IF2->FIFOSTAT & USART_FIFOSTAT_RXERR_MASK))
{
PRINTF("RX FIFO Overflow error, so clearing it\r\n");
USART_IF2->FIFOSTAT |= USART_FIFOSTAT_RXERR_MASK;
}
I am receiving this data,
Received -> 1
RX FIFO Overflow error, so clearing it
Received -> 2
Received -> 3
Received -> 4
Received -> 5
Received -> 6
Received -> 7
Received -> 8
Received -> 9
Received -> 10
Received -> 11
Received -> 12
Received -> 13
Received -> 14
Received -> 15
Received -> 16
Received -> 17
But the other device is sending 30bytes to LPC55S69.
Can you please let me know, where the other bytes lost and why those are not received fully?
Regards,
San