imx6q Uart receive data error "RX FIFO overrun"

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

imx6q Uart receive data error "RX FIFO overrun"

3,189 Views
1282497337
Contributor II

Hi,community

We use imx6q UART port to communicate and receive information from other device using RS485,The device will always send data, we have configured ttymxc3 to work at 576000 ,then I used imx6 UART to receive the data, when device always connect to the imx6 UART, it's can receive data well.

but when I cut it down afterwards link it again, I will got the error message from kernel 

imx-uart 21f0000.serial: Rx FIFO overrun

imx-uart 21f0000.serial: Rx FIFO overrun

imx-uart 21f0000.serial: Rx FIFO overrun

imx-uart 21f0000.serial: Rx FIFO overrun

...........................

Once I got the error I cannot receive data anymore,unless kill the application and open it again.

I used the Oscilloscope to measure the UART port (near the imx6 chip )waveform there is no problem , I got the signal and the signal is okey. we test all UART port and the error  it's same !

We have using 3.14.52 kernel,the board is imx6q-sabresd

Really appreciate any help!

Thanks very much

Alee

Labels (1)
0 Kudos
3 Replies

2,592 Views
igorpadykov
NXP Employee
NXP Employee

Hi AL

one can try to reset uart using sect.64.10.2 Software reset i.MX6DQ Reference
Manual and if sdma was used, try to not use sdma.
https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf

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

0 Kudos

2,592 Views
1282497337
Contributor II

Hi igor

As you know I used the sdma to transmit data,then for test i disable sdma and it can solve such problem (if i got FIFO overrun UART will continue receive data), unfortunately another peoblem arises that when I send data about 10000 Byte pre second use baud rate 115200 ,thread kworker occupy CPU about 15 present, I used baud rate 115200 * 10 and send data about 500000 Byte/sec kworker  occupy CPU over 85%. its cause many other problem ,

Could you give me some advise if i want to use sdma how to solve the problem that fifo overrun and cannot receive data anymore .

Looking forward to your suggestions!

thanks 

ALee

0 Kudos

2,592 Views
1282497337
Contributor II

Hi community

maybe I addressed this problem,but not sure.Blowe is my solution:

I'm using kernel 3.14.52 and I found the source code kernel/driver/tty/serial/imx.c will got the DMA transmit status but do not deal with it.

Imx.c (drivers\tty\serial)

static void dma_rx_callback(void *data)
{
          struct imx_port *sport = data;
          struct dma_chan *chan = sport->dma_chan_rx;
          struct tty_struct *tty = sport->port.state->port.tty;
          struct dma_tx_state state;
          enum dma_status status;
          unsigned int count;

          /* If we have finish the reading. we will not accept any more data. */
          if (tty->closing) {
                    imx_rx_dma_done(sport);
                    return;
          }

          status = dmaengine_tx_status(chan, (dma_cookie_t)0, &state); // to get DMA status but not care this return value "status"?

+        if(DMA_ERROR == status){

+               dmaengine_terminate_all(chan);

+               dmaengine_resume(chan);

+         }

          count = RX_BUF_SIZE - state.residue;
          sport->rx_buf.buf_info[sport->rx_buf.cur_idx].filled = true;
          sport->rx_buf.buf_info[sport->rx_buf.cur_idx].rx_bytes = count;
          sport->rx_buf.cur_idx++;
          sport->rx_buf.cur_idx %= IMX_RXBD_NUM;
          dev_dbg(sport->port.dev, "We get %d bytes.\n", count);

          if (sport->rx_buf.cur_idx == sport->rx_buf.last_completed_idx)
                    dev_err(sport->port.dev, "overwrite!\n");

          if (count)
                    dma_rx_work(sport);
}

The DMA status defined 

 Dmaengine.h (include\linux)

enum dma_status {
         DMA_COMPLETE,
         DMA_IN_PROGRESS,
         DMA_PAUSED,
         DMA_ERROR,
};

Under normal circumstances this "status == 1" this mean is DMA_IN_PROGRESS ,but sometimes I will got "status == 3", the DMA error occurred . then i can't receive  data from this serial port anymore  unless I closs  this uart and open it again.

now it's will continue receive data when i get "status == 3" DMA error .

0 Kudos