LPUART fail to receive the full message with status kStatus_LPUART_IdleLineDetected returned

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPUART fail to receive the full message with status kStatus_LPUART_IdleLineDetected returned

1,188 Views
felix1
Contributor IV

I use RT1050 LPUART to receive the message. The full string are 8 bytes, but I only receive the first 4 bytes and get the status kStatus_LPUART_IdleLineDetected returned by fsl_lpuart.c.

Can you give me some suggestions to fix it?

Labels (1)
Tags (1)
0 Kudos
4 Replies

1,176 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Felix,

I recommend you to take a look to our lpuart_interrupt_transfer example from the SDK. This example receives 8 characters then sends them out.

Regards,

Felipe

0 Kudos

1,168 Views
felix1
Contributor IV

Hi Felipe,

I am glad to receive your reply.

1) I am porting the freeModbus master mode (https://github.com/RT-Thread-packages/freemodbus) to RT1050 now, the modbus response is variable length, according to your suggestion SDK example evkbimxrt1050_lpuart_interrupt_transfer, do I need to modify 

#define ECHO_BUFFER_LENGTH 8 

to 1 to receive bytes one by one?

2) in the LPUART_UserCallback(), only add condition for status kStatus_LPUART_TxIdle and kStatus_LPUART_RxIdle, not need to add any other status condition?

3) I also read the application note AN12679SW for reference, it use DMA but  I just use LPUART interrupt, do I need to add function DEMO_LPUART_IRQHandler(void)?

0 Kudos

1,158 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Felix,

1. If you change the buffer then the bytes needed to receive before the modules send the data back will change.

2. That will depend on your application. I recommend you to debug the code and see if it satisfies your need. This is just a starting point.

3. If you are using interrupt then you absolutely need the IRQ handler. If you are basing your application on the example I mentioned then this is already handled by the LPUART_TransferCreateHandle.

Best regards,

Felipe

0 Kudos

1,140 Views
felix1
Contributor IV

Hi Felipe,

The LPUART Rx error is due to LPUART callback function take too much time, when I remove the debug messages in the LPUART callback function, the modbus RTU master side can receive more than 8 bytes now.

0 Kudos