Hello,
I have to implement a callback function for RX. I have a variable command which will be sent from terminal. For eg , in this data block can be 1 byte or 200 bytes and rest are fixed.
STX , Address, SEQ Number, DataBlock(n), ETX, CRC.
I am using Ring buffer method.
For now i am using the sample example of twrke18f_lpuart_interrupt_rb_transfer. The buffer is fixed to 8 , so it receives only 8 bytes.
sendXfer.data = g_txBuffer;
sendXfer.dataSize = ECHO_BUFFER_SIZE;
receiveXfer.data = g_rxBuffer;
receiveXfer.dataSize = ECHO_BUFFER_SIZE;
I do get a complete data
02 0x31 0x31 Z 0x03 0xCRC
I can not get variable frame ,For my example how do i trigger call back when ETX is received without depending on the size as above.
Attaching code files.
Please help with expert guidance
Hi shar2021,
Check the IDLE of "48.3.1.7 LPUART Status (STAT)".
You can enable the Idle Line Interrupt by ILIE of 48.3.1.8 LPUART Control (CTRL).
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hello @Robin_Shen ,
Thanks for response. I have question, Can ring buffer concept be used for variable length packet? I tried the interrupt mode too instead of ring buffer, I was unable to receive variable length packets.
Do you have any example for variable length frame?
Thanks