Just a quick clarification....
From the SDK, the rxSize is described as the number of bytes to receive. Shouldn't it be the maximum number of bytes to receive???
* @param instance LPUART instance number
* @param rxBuff buffer containing 8-bit read data chars received
* @param rxSize the number of bytes to receive
* @return An error code or kStatus_LPUART_Success
*/
lpuart_status_t LPUART_DRV_ReceiveData(uint32_t instance, uint8_t * rxBuff, uint32_t rxSize);
Solved! Go to Solution.
Hello Thiago,
This function uses a non-blocking method so it needs another function (LPUART_DRV_GetReceiveStatus) that could inform to the application if the reception has been finished. The reception is considered as finished when the amount of data received is the same as the parameter rxSize in the function LPUART_DRV_ReceiveData so that parameter must be the total of the bytes that you are expecting. If you don't know the total amount of bytes that you will receive you need to implement your own handler through the rxCallback which is installed through the function LPUART_DRV_InstallRxCallback.
I recommend you to take a look into the function LPUART_DRV_IRQHandler (inside the file fsl_lpuart_driver.c) to see how the driver manages the receptions.
Best regards,
Earl Orlando.
/* If this post answers your question please click over the Correct Answer button. */
Hello Thiago,
What's the version of your SDK ?
What's is the maximum number ?
BR
Alice
Hello Alice,
I'm using KDS 3.0 + SDK 1.2 + KL43.
My point is, I am expecting some bytes on the LPUART RX, but the number of bytes is variable, however I know it will not exceed a given value, e.g 127, or my buffer has a given size that should not be exceeded.
The way it is written, makes me believe that I need to know excatcly the number of bytes before using LPUART_DRV_ReceiveData. Is that true?
The reason I am asking this is because I am experiencing some problems to fetch RX data from LPUART.
It is probably my fault, but I am trying to identify what am I doing wrong.
Hello Thiago,
This function uses a non-blocking method so it needs another function (LPUART_DRV_GetReceiveStatus) that could inform to the application if the reception has been finished. The reception is considered as finished when the amount of data received is the same as the parameter rxSize in the function LPUART_DRV_ReceiveData so that parameter must be the total of the bytes that you are expecting. If you don't know the total amount of bytes that you will receive you need to implement your own handler through the rxCallback which is installed through the function LPUART_DRV_InstallRxCallback.
I recommend you to take a look into the function LPUART_DRV_IRQHandler (inside the file fsl_lpuart_driver.c) to see how the driver manages the receptions.
Best regards,
Earl Orlando.
/* If this post answers your question please click over the Correct Answer button. */
Thanks Earl Oelando,
That did the trick !