This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: How to Flash UART RX buffer

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am working on UART Rx and Tx using Halcogen generated code.

I am sending out 32 bytes of data every 100ms and also receiving 16 bytes of data occasionally and reply the receive status.

My Tx buffer is initialized with 32 bytes and Rx buffer is initialized with 16byte.

Receive event is triggered by interrupt with sciNotification. 

Every time after I read the data buffer when interrupt is triggered, I want to flash my Rx buffer so that the data will not stick from next frame if there is data loss in the first frame.

Example:

I set Rx Buffer size to 5 and I send out from other application "aa bb cc dd" with wrong length or "aa bb cc dd ee"  or 'ee' was lost somehow  and next frame "11 22 33 44 55" with correct length.

I will receive the interrupt after I received 5 bytes of data which is "aa bb cc dd 11" which was not the correct data. In this case I want to flush entire UART Rx buffer so that I can receive data afresh and the error will not propagate to consecutive frames.

However I couldn't find any function from Halcogen to flush the buffer, so I am flushing it by resetting UART channel by using sciEnterResetState currently.

The problem is that when I do this, my transmit data is lost sometime one byte or sometime two bytes.

Because of this, I have to flush the data after 100ms delay and my transmit data has to be blocked since I am resetting UART channel.

So I would like to check if anyone could suggest me how I can properly flush UART Rx Buffer without the need of resetting UART channel.

Thanks in advance.

This is my contents in Rx Interrupt

This is 10ms task content to process Rx data. This also include transmitting of the response message. 100ms cyclic Transmit is blocked during this time. However, acknowledgement data of 32 bytes is sent out.

This is my 100ms Tx task where I clear buffer by resetting.

This is my buffer clear function