A20-OLinuXino-MICRO UART2 RTS

Started by lordportux, February 19, 2015, 11:47:21 PM

Previous topic - Next topic

lordportux

Hello all,

I'm trying to use the UART2 (RX/TX/RTS/CTS) on UEXT2 connector, so I have enabled it in script.fex:

[uart_para2]
uart_used = 1
uart_port = 2
uart_type = 4
uart_tx = port:PI18<3><1><default><default>
uart_rx = port:PI19<3><1><default><default>
uart_rts = port:PI16<3><1><default><default>
uart_cts = port:PI17<3><1><default><default>


and disabled the SPI2 module:

[spi1_para]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PI16<2><default><default><default>
spi_sclk = port:PI17<2><default><default><default>
spi_mosi = port:PI18<2><default><default><default>
spi_miso = port:PI19<2><default><default><default>


Now I can open the UART2 as /dev/ttyS1. The problem is when I try to use the flow control, only the CTS input works. I have checked the RTS output with the oscilloscope and never changed its state.

When I check the serial driver status, I can see:

cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:U6_16550A mmio:0x01C28000 irq:33 tx:7175 rx:243 RTS|DTR
1: uart:U6_16550A mmio:0x01C28800 irq:35 tx:0 rx:0 CTS
2: uart:U6_16550A mmio:0x01C29800 irq:51 tx:0 rx:0
3: uart:U6_16550A mmio:0x01C29C00 irq:52 tx:0 rx:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0


Only appears the CTS input for /dev/ttyS1. What happened with the RTS signal? why it is not working in PI16 pin?

Can someone suggest a solution?

Thanks in advance!

dave-at-axon

I don't think that the device has hardware RTS control so this has to be done by the driver.

Have you checked if the UART driver actually tries to set the RTS line?

lordportux

#2
Quote from: dave-at-axon on February 20, 2015, 07:59:32 AM
I don't think that the device has hardware RTS control so this has to be done by the driver.

Have you checked if the UART driver actually tries to set the RTS line?


Hello,

A20 has 8 internal uarts:
uart0,4,5,6,7  2 wires (TX,RX)
uart1          8 wires (TX,RX,RTS,CTS,DTR,DSR,DCD,RI)
uart2/3        4 wires (TX,RX,RTS,CTS)

if you check the A20 User Manual (https://github.com/OLIMEX/OLINUXINO/blob/master/HARDWARE/A20-PDFs/A20%20User%20Manual%202013-03-22.pdf) you can see it has Uart Modem Control Registers (UART_MCR), here we can enable the auto flow control (by hardware).

I don't know how to check if the driver tries to set the RTS line, I think the driver doesn't detect the RTS line and  manually checks the CTS status, or RTS is not properly mapped to PI16. How I can check this?


lordportux

PI16_select (PI_CFG2 register): 0 input, 1 output, 2 spi1_cs0, 3 uart2_rts, 4 reserved, 5 reserved, 6 eint28, 7 reserved

Checking the real-time value of the PI16 function selector:


# /opt/sunxi-tools/pio -m PI16
PI16<3><1><1>


PI16_select=3, so it's properly configured as uart2_rts.