Hi, Anil,
Regarding your question, I suppose you use the KSDK2.0 for Kl27, if you use the LPUART_TransferReceiveNonBlockin() function, the LPUART uses interrupt mechanism to transfer data.
You can refer to the example:
C:\KSDK2.0_KL27\boards\frdmkl27z\driver_examples\lpuart\interrupt_transfer\kds
In the code, if you hope the callback() is called after 500 bytes have been received, you can change the example:
receiveXfer.data = g_rxBuffer;
receiveXfer.dataSize = 500; //ECHO_BUFFER_LENGTH; Rong modified
while (1)
{
/* If RX is idle and g_rxBuffer is empty, start to read data to g_rxBuffer. */
if ((!rxOnGoing) && rxBufferEmpty)
{
rxOnGoing = true;
LPUART_TransferReceiveNonBlocking(DEMO_LPUART, &g_lpuartHandle, &receiveXfer, NULL);
}
The receiveXfer.dataSize specifies the received number of bytes, after the number of bytes has been received, the callback function LPUART_UserCallback() is called.
Hope it can help you
BR
XiangJun Rong