MKE1xF512VLH16 lpuart RX interrupt

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

MKE1xF512VLH16 lpuart RX interrupt

757 Views
shar2021
Contributor I

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

 

0 Kudos
3 Replies

737 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi shar2021,

Check the IDLE of "48.3.1.7 LPUART Status (STAT)".

48.3.1.7 LPUART Status (STAT) IDLE.png

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

0 Kudos

734 Views
shar2021
Contributor I

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  

0 Kudos

694 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Sorry for the delay!
Have you test the twrke18f_lpuart_edma_rb_transfer?

twrke18f_lpuart_edma_rb_transfer.png

Tags (1)
0 Kudos