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.

clear SCI Rx buffer

Hello 

i am using RM57Lx.

i need to flush or clear SCI Rx buffer before receiving new data packet.

can anybody help ?

  • Hello:

    Why do you need to clear the buffer? Are you having any problem? Every time a new frame is received, the data is pushed from the receiver shift register to the receiver data buffer.

    Regards,

    Enrique
  • Hello Enrique,
    i have a device which is streaming data on serial and if i interrupt the device it stalls for some time and again start to stream data.
    so my problem is when i interrupt the device then i know the next data is fresh data and fixed length of data packet will be transmitted and i read it using DMA to read n bytes from serial but if i don't clear the buffer then the buffer might have previous packet data still when i interrupt the device and then DMA reads few old bytes from the buffer as well.
    so after interrupting the device i would like to clear serial buffer and start fresh DMA transaction.
  • Hello Rohit,

      Sorry that I'm not clear in your application usage. It seems like you receive some packet in the Hercules SCI. The SCI generates an interrupt to the CPU. In the interrupt ISR, you try to use the DMA to read the data from the SCI buffer. I'm not sure if this is the correct description. If not, could you clarify?

      If the SCI receives some data, why wouldn't you have the SCI generate DMA request to DMA directly. DMA responding to the request will transfer the data in the SCI buffer to the CPU system memory. Once the transfer is complete it will interrupt the CPU to process the data.

     There is one app note that talks about using Hercules SCI with DMA which might be helpful to you. See below liink.

    http://www.ti.com/lit/an/spna213/spna213.pdf

      Can you also tell me the device you are using?