LPC4353 USART3 receive variable number of chars

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

LPC4353 USART3 receive variable number of chars

Jump to solution
472 Views
skysky
Contributor III

lpc4353 usart3 used as UART slave,and receive master's frame data-Binary.but Master send the number of data is variable,and also any time and any number.LPC4353 need receive a whole frame,the parse the frame.

So,whethe has a good way to receive the whole frame data?

0 Kudos
1 Solution
355 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sky sky,

     Actually, this is a communication question.

    The universal method is defined a user serial communication protocol, it normally contains: Header byte, lengh byte, data frame.

  Take an example: 0xA5 0X5A 0X02 0X01 0X02

 0xA5 0X5A  is the head byte

  0X02  is the data length need to receive

  0X01 0X02 is the detail data.

  So, as a UART slave, your LPC4353 can receive the data all the time, when it receives 0XA5 0X5A, it means the new frame is beginning,  the next byte is the data byte length, after receive the data length byte, the following just need to receive the according length data, other data will be discarded.

    The above thought is the normal usage, just for your reference.

Wish it helps you!

If you still have question, please contact me!

    


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

2 Replies
356 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sky sky,

     Actually, this is a communication question.

    The universal method is defined a user serial communication protocol, it normally contains: Header byte, lengh byte, data frame.

  Take an example: 0xA5 0X5A 0X02 0X01 0X02

 0xA5 0X5A  is the head byte

  0X02  is the data length need to receive

  0X01 0X02 is the detail data.

  So, as a UART slave, your LPC4353 can receive the data all the time, when it receives 0XA5 0X5A, it means the new frame is beginning,  the next byte is the data byte length, after receive the data length byte, the following just need to receive the according length data, other data will be discarded.

    The above thought is the normal usage, just for your reference.

Wish it helps you!

If you still have question, please contact me!

    


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

355 Views
skysky
Contributor III

thanks your answer.

my intention is that first receive the whole frame into ringbuff.then parse the received frame.

So i need know when the frame has been received completely.

Now i used the USART's BI(Break Interrupt).And the uart Master set the usart BREAK after the frame has been sent

0 Kudos