Hi,
I am trying to implement MODBUS protocol in S32K14s using MBDT. Since the MODBUS server response packet varies in size depending on the client request, how can I configure the LPUART_Receive and LPUART_RxTx_ISR blocks to be able to receive these variable size packets?
If I configured the LPUART_Receive block to receive the fix size packet, for example, 8 byte, I could receive the 8 byte response packet without any issue. But, if i configured the size to be variable, I could not receive the correct data and sometime there is data at all.
I have attached the model in this thread.
Please kindly advice.
Thanks.
Hello,
I think you can use a software approach to this problem. You can use delimiters in the message you send over uart and to read characters into a string one by one.
For example, if you want to send voltage, current and fault status over uart, you can format the message like this "voltage:10;current:1;fault:0" (using the ; as a delimiter). Then you can break the message like this:
Let me know if this approach helps you.