This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x: uart hardware handshaking

Dear,

In the board-am335xevm.c  uart1_cts is configured as output rts as input.

{"uart1_ctsn.uart1_ctsn", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
{"uart1_rtsn.uart1_rtsn", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT},

In the datasheet is uart1_cts (ball D18, zcz package, pag 43) declared as input and uart1_rts as output?

D19 D17 UART1_RTSn uart1_rtsn 0 O Z H 7 VDDSHV6 / Yes 4 PU/PD LVCMOS

E17 D18 UART1_CTSn uart1_ctsn 0 I Z H 7 VDDSHV6 / Yes 4 PU/PD LVCMOS

What confuses me? From DTE (pc side) is cts an input why is it configured as output in the board file?

Assume cts is an input: if cts is high (connect to 3.3V) echo "hello" > /dev/ttyO1 shouldn't output any data. Setting cts high informs the AM335x not to transmit any data. 

Thx 

  • Hi Luc,
     
    I'm not sure that the  /dev/ttyOx driver uses hardware handshaking at all. At least UART0 doesn't need it when used as debug UART. On the EVM board UART1 is connected to the COM6 connector for Bluetooth communications, and again I'm not sure if handshaking is used. Otherwise, the datasheet is correct - CTSn is an input signal for the AM335X, and RTSn is output.
  • Did some experiments with uart 3 and used lcd_data10 and lcd_data11 as cts and rts (omap_mux_mode 6).

    When cts is configured as output, after boot the line is high. stty -F /dev/ttyO3 rctsrts or minicom set automatically the line low.

    So it seems that cts is an output? (according to software not the datasheet)

    Nevertheless, when rts configured as input and set high, the uart keeps transmitting data? It assume it should stop.

    Thx, Luc

  • Hello,

    In my project I have to control gprs modem which is on my uart5(ttyO5) and it must use rts cts signaling. I have set uart5 pin mux as below.(It was litle confusing as you know rts signal is output cts signal is input acording to datasheet but in kernel bord file is was set opposit directions anyway..)

        {"mii1_col.uart5_rxd", OMAP_MUX_MODE3 |AM33XX_PIN_INPUT_PULLUP},
        {"mii1_rxdv.uart5_txd", OMAP_MUX_MODE3 | AM33XX_PULL_ENBL},
       {"mmc0_dat1.uart5_ctsn", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT },
        {"mmc0_dat0.uart5_rtsn", OMAP_MUX_MODE2 | AM33XX_PIN_OUTPUT},

    my problem is at startup rts signal state is logic high but, when I open the ttyO5 rts is becoming low and I cant never set high later. Im using below unctions to set high this rts pin, but they dont work.

    int uart::setRTS()
    {

        int  serstat,sercmd = TIOCM_RTS;
        int rc = ioctl(fd, TIOCMBIS, &sercmd); // Set the RTS pin.
        // Read the RTS pin status.
        ioctl(fd, TIOCMGET, &serstat);
        if (serstat & TIOCM_RTS)
        printf("RTS pin is set.\n");
        else
        printf("RTS pin is reset.\n");
        return rc;

    }
    int uart::setRTS(int level)
    {
        int status;

        if (ioctl(fd, TIOCMGET, &status) == -1) {
            perror("setRTS(): TIOCMGET");
            return 0;
        }
        if (level)
            status |= TIOCM_RTS;
        else
            status &= ~TIOCM_RTS;
        if (ioctl(fd, TIOCMSET, &status) == -1) {
            perror("setRTS(): TIOCMSET");
            return 0;
        }
        return 1;
    }

    Any advice please

    Tahnks alot

    Emre

  • I know this is an old post, but have you guys figured this out?  I am setting up some additional UARTs and want to get this right (I'm not using flow control at the moment, but the pins are exposed).

    I checked the WL18xx Platform Integration Guide and it has conflicting examples:

    Pre-Device Tree (3.2 Kernel):

    {"uart1_ctsn.uart1_ctsn", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
    {"uart1_rtsn.uart1_rtsn", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT},

    Device Tree (3.14 Kernel, this is used in the am335x-evmsk.dts):

    0x178 (PIN_INPUT | MUX_MODE0)		/* uart1_ctsn.uart1_ctsn */
    0x17C (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart1_rtsn.uart1_rtsn */

    So, I'm guessing it works with the device tree settings, but very curious that they don't seem to agree on the RIGHT way to do it on the wiki.  Does this mean the CTS from the external device is actually connected to the CTS pin of the AM335x?  If so, that's confusing.