Searial ports on A20 Debian

Started by forOliTri, March 09, 2015, 12:49:30 PM

Previous topic - Next topic

forOliTri

Judging by hardware manufacturer who created a COM port add on card, Olimex A20 exposes 4 serial ports, which are:
UART3
UART4
UART6
UART7

UART3 is connected on ports PG06(TX) and PG07(RX),
UART4 is connected on ports PG10(TX) and PG11(RX),
the actual ports for UART6 and 7 are unknown however i used this page http://linux-sunxi.org/A20/PIO to find the options available.

On debian system UART3 is ttyS3, UART4 - ttyS4 and so on.

The problem is, i can't seem to make serial ports work. In linux i do
cat < /dev/ttyS3
and
echo "Hello" > /dev/ttyS7
The two ports are physicaly connected using a null modem cable, but i get no results. If i sent the text i get nothing on ttyS3. It doesn't work if i reverse it and echo into the ttyS3.

What am i doing wrong? Why can't i get an output?

dmesg | grep uart
[    0.638858] [uart]: used uart info.: 0xff
[    0.643548] [uart]: serial probe 0 irq 33 mapbase 0x01c28000
[    0.669883] sunxi-uart.0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a U6_16550A
[    1.439988] [uart]: serial probe 1 irq 34 mapbase 0x01c28400
[    1.471847] sunxi-uart.1: ttyS1 at MMIO 0x1c28400 (irq = 34) is a U6_16550A
[    1.483676] [uart]: serial probe 2 irq 35 mapbase 0x01c28800
[    1.515494] sunxi-uart.2: ttyS2 at MMIO 0x1c28800 (irq = 35) is a U6_16550A
[    1.527300] [uart]: serial probe 3 irq 36 mapbase 0x01c28c00
[    1.559218] sunxi-uart.3: ttyS3 at MMIO 0x1c28c00 (irq = 36) is a U6_16550A
[    1.571207] [uart]: serial probe 4 irq 49 mapbase 0x01c29000
[    1.603212] sunxi-uart.4: ttyS4 at MMIO 0x1c29000 (irq = 49) is a U6_16550A
[    1.615107] [uart]: serial probe 5 irq 50 mapbase 0x01c29400
[    1.647058] sunxi-uart.5: ttyS5 at MMIO 0x1c29400 (irq = 50) is a U6_16550A
[    1.658912] [uart]: serial probe 6 irq 51 mapbase 0x01c29800
[    1.690753] sunxi-uart.6: ttyS6 at MMIO 0x1c29800 (irq = 51) is a U6_16550A
[    1.702576] [uart]: serial probe 7 irq 52 mapbase 0x01c29c00
[    1.734388] sunxi-uart.7: ttyS7 at MMIO 0x1c29c00 (irq = 52) is a U6_16550A

Lurch

Are they even turned on in the script.bin file used during boot?
Check the script.fex file (or convert script.bin to .fex and check.
They may be off to avoid pin conflicts.

forOliTri

They are turned on
[uart_para3]
uart_used = 1

And the rest of UART is also turned on.

I have also checked the ports, and they are not taken by anything else.
e.g. uart_tx = port:PG06<4><1><default><default>
The PG06 is also used by csi1_para, however csi is turned off.
It is also used by mmc1_para, but this one is turned off as well.

The other two places where PG06 is mentioned are gpio_para and gpio_init.

Should i remove ports from gpio sections?

stulluk

Hi, I am having the same issue on a different A20 board. In my case, I am trying to enable UART3 ( PG06 and PG07 ). I tested with kernel 3.4.79 and 3.4.103 ( latest one in sunxi git )

My UART0 ( PB22 and PB23 ) and UART2 ( PI18 and PI19 ) are working fine under debian wheezy. Here is what I have:


dmesg | grep tty       
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait loglevel=0 panic=1 quiet
[    0.723497] sunxi-uart.0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a U6_16550A
[    0.739389] console [ttyS0] enabled
[    0.770474] sunxi-uart.2: ttyS1 at MMIO 0x1c28800 (irq = 35) is a U6_16550A
[    0.801537] sunxi-uart.5: ttyS2 at MMIO 0x1c29400 (irq = 50) is a U6_16550A
[    0.832549] sunxi-uart.7: ttyS3 at MMIO 0x1c29c00 (irq = 52) is a U6_16550A




However, for UART3, here is my FEX:

[uart_para5]
uart_used = 1
uart_port = 5
uart_type = 2
uart_tx = port:PG06<4><1><default><default>
uart_rx = port:PG07<4><1><default><default>


When I test UART3 RX/TX (PG06 PG07) under android, they are working perfectly. The difference between android and linux is here:


<6>[    0.541386] sw_serial.0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a SW
<6>[    0.547170] console [ttyS0] enabled
<6>[    0.547708] sw_serial.2: ttyS2 at MMIO 0x1c28800 (irq = 35) is a SW
<6>[    0.547923] sw_serial.5: ttyS5 at MMIO 0x1c29400 (irq = 50) is a SW
<6>[    0.548174] sw_serial.7: ttyS7 at MMIO 0x1c29c00 (irq = 52) is a SW



So, what is a SW_SERIAL then?? What is difference between 16550A and SW_serial ?

Note: I tested configuring PG06 and PG07 as GPIO output pins, and I can pull them high/low manually using gpio sysfs.

Did anybody managed to set PG06 or PG07 as UART3 under debian ?


stulluk

SOLVED !!!

The issue in my fex file was, I put UART3 in [uart_para5] !!!

It seems script.bin parsing mechanism didn't like it.

After changes, here is the portion of my fex file for PG06 - PG07:


[uart_para3]
uart_used = 1
uart_port = 3
uart_type = 2
uart_tx = port:PG06<4><1><default><default>
uart_rx = port:PG07<4><1><default><default>



And also, I had to change parameters of my new UART as follows:


stty -F /dev/ttyS2 115200 ixoff iutf8 -icrnl -icanon -iexten -echo


What I did was just to see the settings of my ttyS0 ( debug port ) by using "stty -F /dev/ttyS0 -a" and compare/apply to /dev/ttyS2.

So, forget about I all wrote above, it works fine now. 

dave-at-axon

Thanks for posting how you got it working for others to see too.

I have Android with 5 serial ports on the A20 with a mix of RS485 and RS232 and they work great once you know you need to modify the FEX file. :)