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
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)?
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
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.