imx6 with android4.4.2 handle CTS_B for rs485

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

imx6 with android4.4.2 handle CTS_B for rs485

1,156 Views
liu_jialu
Contributor III

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;
}

Labels (3)
0 Kudos
Reply
4 Replies

882 Views
igorpadykov
NXP Employee
NXP Employee

Hi 家禄 刘 

please recheck if signal directions are used properly in application

using Table 86. UART I/O Configuration vs. Mode i.MX6DQ Datasheet

http://www.nxp.com/docs/en/data-sheet/IMX6DQCEC.pdf

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

0 Kudos
Reply

882 Views
liu_jialu
Contributor III

DCE mode

not DTE mode

0 Kudos
Reply

882 Views
igorpadykov
NXP Employee
NXP Employee

one can recheck uart settings given in sect.64.7 9-bit RS-485 Mode

i.MX6DQ Reference Manual
https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf

0 Kudos
Reply

882 Views
liu_jialu
Contributor III

thanks for reply. but it's not in 9-bit mode, it's in normal UART mode.

0 Kudos
Reply