LPUART clarification

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPUART clarification

跳至解决方案
3,401 次查看
thiagopalmieri
Contributor III

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);

标签 (1)
标记 (2)
1 解答
1,957 次查看
EarlOrlando
Senior Contributor II

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. */

在原帖中查看解决方案

4 回复数
1,957 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Thiago,

What's the version of your SDK ?

What's is the maximum number ?

BR

Alice

0 项奖励
回复
1,957 次查看
thiagopalmieri
Contributor III

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.

0 项奖励
回复
1,958 次查看
EarlOrlando
Senior Contributor II

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. */

1,957 次查看
thiagopalmieri
Contributor III

Thanks Earl Oelando,

That did the trick !

0 项奖励
回复