AnsweredAssumed Answered

my uart lost data while receiving data with platform IMX6Q

Question asked by 如新 顾 on Jul 29, 2015
Latest reply on Apr 11, 2016 by Emlo xu

Dear all,

       when I test the UART port, I found it lost data while receiving data. the test process is like this:

1. On PC side I send 100 bytes from the UART port.

2. On IMX6Q side, I start a test process to test UART, This process will read data with block state, when it receives

    data, it just print the data. from the printed data I found some data lost.

3. I try to add some log in function imx_rxint() in file imx.c, the added log is like this:

static irqreturn_t imx_rxint(int irq, void *dev_id)

{

  struct imx_port *sport = dev_id;

  unsigned int rx,flg,ignored = 0;

  struct tty_struct *tty = sport->port.state->port.tty;

  unsigned long flags, temp;

 

 

  spin_lock_irqsave(&sport->port.lock,flags);

 

 

  while (readl(sport->port.membase + USR2) & USR2_RDR) {

  flg = TTY_NORMAL;

  sport->port.icount.rx++;

 

 

  rx = readl(sport->port.membase + URXD0);

 

 

  temp = readl(sport->port.membase + USR2);

  if (temp & USR2_BRCD) {

  writel(USR2_BRCD, sport->port.membase + USR2);

  if (uart_handle_break(&sport->port))

  continue;

  }

 

 

  if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))

  continue;

 

 

  if (unlikely(rx & URXD_ERR)) {

  if (rx & URXD_BRK)

  sport->port.icount.brk++;

  else if (rx & URXD_PRERR)

  sport->port.icount.parity++;

  else if (rx & URXD_FRMERR)

  sport->port.icount.frame++;

  if (rx & URXD_OVRRUN)

  sport->port.icount.overrun++;

 

 

  if (rx & sport->port.ignore_status_mask) {

  if (++ignored > 100)

  goto out;

  continue;

  }

 

 

  rx &= sport->port.read_status_mask;

 

 

  if (rx & URXD_BRK)

  flg = TTY_BREAK;

  else if (rx & URXD_PRERR)

  flg = TTY_PARITY;

  else if (rx & URXD_FRMERR)

  flg = TTY_FRAME;

  if (rx & URXD_OVRRUN)

  flg = TTY_OVERRUN;

 

 

#ifdef SUPPORT_SYSRQ

  sport->port.sysrq = 0;

#endif

  }

 

 

  /*add by aaron, 2015.7.29*/

  if(sport->port.line == 1)

  {

  pr_err("[AARON] ttymxc1 :%d, %d", rx, sport->port.icount.rx);

  }

  /*end by aaron*/

 

  tty_insert_flip_char(tty, rx, flg);

  }

 

 

out:

  spin_unlock_irqrestore(&sport->port.lock,flags);

  tty_flip_buffer_push(tty);

  return IRQ_HANDLED;

}

 

from the log , I found it also not receive the whole data. which means data was lost at this driver layer.

since The amount of data transfered is not so much, why this happened? if some configuration error?

 

Please help me.  It critical to me

 

Thanks!

Outcomes