imx6ull uart使用出现死机

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

imx6ull uart使用出现死机

3,036 Views
1070800554
Contributor I

在使用imx6ull的uart时,使用read和write函数进行数据交互时,运行一段时间后会出现死机,很突然,毫无提示。使用示波器监控电源,无波动发生,调试信息也无输出。主要对以下两种情况进行了测试:

1、使用libnodave库与S7-200PLC进行数据交互(读I区两个字节,向Q区写入两个字节,设置19200波特率,8位数据位,偶校验,1位停止位,无流控),十分钟左右就会出现死机;

2、为排除1中的libnodave库的问题,使用PC上的串口调试工具测试,将imx6ull的uart设为:19200波特率,8位数据位,偶校验,1位停止位,无流控,阻塞接受数据(10字节),并将收到的数据发出,也会出现死机,但机率较小。

对于上述两种情况,在有其他与uart不相关的进程运行时,更容易出现死机。

万望指导!

Labels (3)
0 Kudos
5 Replies

2,820 Views
1070800554
Contributor I

经进一步测试,发现上述死机问题与drivers/tty/serial/imx.c中的函数有关

/*
 * interrupts disabled on entry
 */
static void imx_start_tx(struct uart_port *port)
{
    struct imx_port *sport = (struct imx_port *)port;
    unsigned long temp;

    if (port->rs485.flags & SER_RS485_ENABLED) {
        temp = readl(port->membase + UCR2);
        if (port->rs485.flags & SER_RS485_RTS_ON_SEND)
            imx_port_rts_active(sport, &temp);
        else
            imx_port_rts_inactive(sport, &temp);
        if (!(port->rs485.flags & SER_RS485_RX_DURING_TX))
            temp &= ~UCR2_RXEN;
        writel(temp, port->membase + UCR2);

        /* enable transmitter and shifter empty irq */
        temp = readl(port->membase + UCR4);
        temp |= UCR4_TCEN;
        writel(temp, port->membase + UCR4);
    }

    if (!sport->dma_is_enabled) {
        temp = readl(sport->port.membase + UCR1);
        writel(temp | UCR1_TXMPTYEN, sport->port.membase + UCR1);
    }

    if (sport->dma_is_enabled) {
        if (sport->port.x_char) {
            /* We have X-char to send, so enable TX IRQ and
             * disable TX DMA to let TX interrupt to send X-char */
            temp = readl(sport->port.membase + UCR1);
            temp &= ~UCR1_TDMAEN;
            temp |= UCR1_TXMPTYEN;
            writel(temp, sport->port.membase + UCR1);
            return;
        }

        if (!uart_circ_empty(&port->state->xmit) &&
            !uart_tx_stopped(port))
            schedule_work(&sport->tsk_dma_tx);
        return;
    }
}

若是在选择SER_RS485_ENABLED后,将开启传输完成中断部分屏蔽,则不会出现死机,如下:

        /* enable transmitter and shifter empty irq */
        //temp = readl(port->membase + UCR4);
        //temp |= UCR4_TCEN;
        //writel(temp, port->membase + UCR4);

但是,将无 CTS 流控产生

0 Kudos

2,820 Views
1070800554
Contributor I

linux kernel版本4.14.98

0 Kudos

2,820 Views
jimmychan
NXP TechSupport
NXP TechSupport

From your test, you set "无流控". But you need the CTS? why?

0 Kudos

2,820 Views
1070800554
Contributor I

5a07e593d5d79f9006e62a88dd662cd.pngd580e911226cc9fc3ea05db867fbb94.png

0 Kudos

2,822 Views
1070800554
Contributor I

用于控制MAX485的读写,

现已将kernel更换至4.19.35,已无死机BUG,但使用uart时出现了新的BUG,与中断有关

0 Kudos