AnsweredAssumed Answered

imx6 with android4.4.2 handle CTS_B for rs485

Question asked by 家禄 刘 on Jun 15, 2018
Latest reply on Jun 17, 2018 by 家禄 刘

imx6q run kk4.4.2_1.0.0-ga on my custom board.

 

set /dev/ttymxc2 to rs485 mode from user space with the attached file, but the CTS_B pin still be high, what's the reason, please give a hand, thanks.

 

when i run set_rs485 in command line(cross-compiled from attached file set_rs485.c), use oscilloscope detect a fall edge on UART3_CTS_B, but at once the pin back to high again, what's others operates UCR2_CTS else?

 

static int imx_rs485_config(struct uart_port *port,
                            struct serial_rs485 *rs485conf)
{
        struct imx_port *sport = (struct imx_port *)port;

 

        /* unimplemented */
        rs485conf->delay_rts_before_send = 0;
        rs485conf->delay_rts_after_send = 0;
        rs485conf->flags |= SER_RS485_RX_DURING_TX;

 

        /* RTS is required to control the transmitter */
        if (!sport->have_rtscts)
                rs485conf->flags &= ~SER_RS485_ENABLED;

 

        if (rs485conf->flags & SER_RS485_ENABLED) {
                unsigned long temp;

 

                /* disable transmitter */
                temp = readl(sport->port.membase + UCR2);
                temp &= ~UCR2_CTSC;
                if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND)
                        temp &= ~UCR2_CTS;

               else
                        temp |= UCR2_CTS;
                writel(temp, sport->port.membase + UCR2);
        }

 

        port->rs485 = *rs485conf;

 

        return 0;
}

Attachments

Outcomes