Jump to content

UART not working on Orange-Pi PC 2 with H5-CPU


lsmod

Recommended Posts

Hello,

 

after some time i am trying to work again on my Orange Project.

Now i want to connect an serial device on UART2 (PA0 / PA1).

 

The devices /dev/ttyS0 - S3 are existant, but no data is coming in over RXD.

 

I already read the thread here and tried to check the configuration.

 

I upgraded my armbian and i am now working with ARMBIAN 5.60 stable Debian GNU/Linux 9 (stretch) 4.14.70-sunxi64

So i hopefully found the configuration in /boot/dtb-4.14.70-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb

 

After decompiling i found

 

                        uart0@0 {
                                pins = "PA4", "PA5";
                                function = "uart0";
                                linux,phandle = <0x23>;
                                phandle = <0x23>;
                        };

                        uart1 {
                                pins = "PG6", "PG7";
                                function = "uart1";
                                linux,phandle = <0x24>;
                                phandle = <0x24>;
                        };

                        uart2 {
                                pins = "PA0", "PA1";
                                function = "uart2";
                                linux,phandle = <0x25>;
                                phandle = <0x25>;
                        };

                        uart3 {
                                pins = "PA13", "PA14";
                                function = "uart3";
                                linux,phandle = <0x55>;
                                phandle = <0x55>;
                        };

The pins should be correct but not for UART0, this should be "PC5", "PC6"

 

I have connected to UART2 and the Pins should work with PA0 and PA1.

Any idea why i get no data?

Link to comment
Share on other sites

1 hour ago, lsmod said:

The pins should be correct but not for UART0, this should be "PC5", "PC6"

Did you look at the wrong schematic, OPiPC2 UART0 is really PA4/PA5 and it is connected to the Serial Debug header, enabled by default.

 

1 hour ago, lsmod said:

I have connected to UART2 and the Pins should work with PA0 and PA1.

Yes, but all other UARTs are disabled by default, you need to enable them using DT overlays, or tweaking the main DT manually to have them with 'status = "okay"; ' for exemple for the UART2 node, in serial@1c28800.

 

Using DT overlays only requires to insert "overlays=uart2" into /boot/armbianEnv.txt and reboot ...

 

Link to comment
Share on other sites

Yes - i can find this files in the path /boot/dtb/allwinner/overlay

-rw-r--r-- 1 root root  506 Sep 19 12:10 sun50i-a64-uart1.dtbo
-rw-r--r-- 1 root root 1001 Sep 19 12:10 sun50i-a64-uart2.dtbo
-rw-r--r-- 1 root root  826 Sep 19 12:10 sun50i-a64-uart3.dtbo
-rw-r--r-- 1 root root 1001 Sep 19 12:10 sun50i-a64-uart4.dtbo

For other users: The files can be translated each with

dtc -I dtb sun50i-a64-uart1.dtbo -O dts -o sun50i-a64-uart1.dts

There are many definitions for the UART ...

 

 

On 11/7/2018 at 8:54 PM, martinayotte said:

Did you look at the wrong schematic, OPiPC2 UART0 is really PA4/PA5 and it is connected to the Serial Debug header, enabled by default.

 

 

Yes - i am really confused by the wrong schematics.

Is there anywhere an complete correct Pin-Assignment? :wacko:

 

I want to connect my serial device to Pin 8 and 10 of the GPIO.

I can see with an oscilloscope that there is data on Pin 10 of the GPIO which should be RXD of UART3 (PA14).

Is this assignment correct?

 

I added to /boot/armbianEnv.txt and rebooted: (P.S. reboot only works with an external root shell?)

overlays=uart3

 

But opening ttyS3 in cutecom or putty still does not show any incoming data. :(

 

Link to comment
Share on other sites

2 hours ago, lsmod said:

But opening ttyS3 in cutecom or putty still does not show any incoming data.

Check "dmesg" for details ...

I'm not sure, but possible that kernel assign /dev/ttySx in order of appearance, so if you have only UART0 and UART3, that it comes into /dev/ttyS0 and /dev/ttyS1 respectively, unless you enable all UARTs in overlays.

 

Link to comment
Share on other sites

Good idea!

 

It seems that the serial ports are added with the correct number:

[    0.682731] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.683890] console [ttyS0] disabled
[    0.704033] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 28, base_baud = 1500000) is a U6_16550A
[    0.704085] console [ttyS0] enabled
[    0.726793] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 29, base_baud = 1500000) is a U6_16550A

I can only open /dev/ttyS3.

All other ports will fail with "Unable to configure serial port"

 

When i enable all ports with

overlays=uart2
overlays=uart3
overlays=uart4

then i get none of the ports active and all fail to configure!

dmesg shows:

[    0.000000] Kernel command line: root=UUID=aa5e51f4-5867-45a3-a342-740ba0961be3 rootwait rootfstype=ext4 console=tty1 console=ttyS0,115200 panic=10 consoleblank=0 loglevel=1 ubootpart=1968c433-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=memory swapaccount=1

...

[    0.682140] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.683293] console [ttyS0] disabled
[    0.703433] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 28, base_baud = 1500000) is a U6_16550A
[    0.703483] console [ttyS0] enabled

The first kernel message is missing when only uart3 is active.

 

I returned to this configuration where only UART3 is configured in /boot/armbianEnv.txt

It is also possible to check the configuration of the serial port:

# stty -aF /dev/ttyS3
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 0; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

 

My last experiment was to change RXD and TXD to be sure that it is not connected wrong.

But of course it does not make a difference - data is not coming in!

 

Additional i send a file with cutecom over /dev/ttyS3, but i could see no signal on TXD with an oscillloscope.

 

I have no further idea ...

 

 

 

Link to comment
Share on other sites

On 11/10/2018 at 7:07 AM, lsmod said:

This is my current Pin-Assignment for the GPIO with all references:

I didn't thoroughly looked at those until now ...

According to OPiPC2 schematic (a bit different from OPiPC one) , the UART3 PA13/PA14 are located on pins 24/23, shared with SPI1, not at pins 8/10 like you mentioned in your grid !

Pins 8/10 are connected to PC5/PC6, which are plain GPIOs ...

Did you put the scope probe on proper pin ? BTW, best to verify UART is using a loopback wire between TX/RX, that way you will get "echo" of everything you type in picocom.

Link to comment
Share on other sites

Now i am very confused.

Where you find this information about Pins 23/24 ?

 

We already discussed this theme here and i have to find out that every Pinout is somehow wrong! :wacko:

Is there somewhere a correct one for an Orange Pi PC 2 ?

 

But your idea is good - i will make simple tests just to find any working UART ...

The scope probe was O.K., because i could see High-Level 3.3V and working signal of the serial device i want to connect.

 

 

 

 

Link to comment
Share on other sites

14 minutes ago, lsmod said:

Where you find this information about Pins 23/24 ?

http://linux-sunxi.org/images/c/cb/ORANGE_PI-PC2-V1_2_schematic.pdf

15 minutes ago, lsmod said:

The scope probe was O.K., because i could see High-Level 3.3V and working signal of the serial device i want to connect.

On pins 24 or on pin 8 ? I doubt you see any serial transmit on pins 8 PC5 ...

 

18 minutes ago, lsmod said:

Is there somewhere a correct one for an Orange Pi PC 2 ?

In the threads you post, it is clearly showing that pins 8/10 are not UART3 TX/RX but PC5/PC6 !

 

BTW, you can use UART1 instead, the TX/RX are located at pins 38/40 ...

Link to comment
Share on other sites

2 hours ago, lsmod said:

This schematic does not contain a clear and reliable Pinout.!

Look at page 15, for me, it is clear enough ...

2 hours ago, lsmod said:

This are serial Pins on an Raspberry - so why not on an Orange-Pi ?

It is on other OPi, such OPiPC and OPI+2E, but on some other, such this OPiPC2 and OPiPrime, they substituted them to PC5/PC6.

Link to comment
Share on other sites

14 hours ago, martinayotte said:

Look at page 15, for me, it is clear enough ...

It is on other OPi, such OPiPC and OPI+2E, but on some other, such this OPiPC2 and OPiPrime, they substituted them to PC5/PC6.

 

When it is clear enough - why there is UART0 on Pin 8/10 ?

UART0 is defined on PA4/PA5 in the configuration files ?

I already tested UART0 and it is not working too :(

 

grafik.png

 

I think i have to give up to get the UART working with Armbian on an Orange Pi PC 2 ...

Link to comment
Share on other sites

6 hours ago, lsmod said:

why there is UART0 on Pin 8/10 ?

I don't see any UART0 on pins 8/10, I only see PC5/PC6 ...

6 hours ago, lsmod said:

give up to get the UART working with Armbian

Did you tried UART1 and UART2, it is so simple to test with loopback wire that I've done it myself yesterday within 1 minute.

Link to comment
Share on other sites

19 hours ago, martinayotte said:

I don't see any UART0 on pins 8/10, I only see PC5/PC6 ...

 

I see in the manual that this should be UART3.

And i can see on page 6 in GPIO of the schematic that UART3 should be PA14/PA13.

That was the source.

 

 

Quote

Did you tried UART1 and UART2, it is so simple to test with loopback wire that I've done it myself yesterday within 1 minute.

 

It takes more than one minute for me. :)

But i know what you mean - this days i simply don't have enough time for this problem and i always must "think me into the problem again".

 

Now i checked with and without a wire-loop on GIPO pins 38+40 that should be UART1.

I added to the configuration

overlays=uart1
overlays=uart2

UART1 can't be opened with a serial program.

 

UART2 can be opened, but there is no echo with a wire-loop.

It's the same when i short pin 11+13 with a wire-loop. No echo for UART2.

 

You see - the UART's of the H5 are dead and can't be used within Armbian!

There are no error messages within the serial programs or dmesg - simply dead.

 

It's a pity - when i want to have an serial port i must block one USB-port and plug in an PL2303 converter - that works. :(

Link to comment
Share on other sites

Hmm - this information comes late. :)

 

Additional i have to find out that an overlay assignment is already existant from the beginning!

This is the content of the original file armbianEnv.txt that is again in use:

verbosity=1
console=both
overlay_prefix=sun50i-h5
rootdev=UUID=aa5e51f4-5867-45a3-a342-740ba0961be3
rootfstype=ext4
overlays=analog-codec i2c0 i2c1 i2c2 pps-gpio pwm spi-add-cs1 spi-jedec-nor spi-spidev uart1 uart2 uart3 w1-gpio
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

The problem is that all UART's should have worked from the beginning!

 

Retest of the UART with a wire-loop now:

UART1 on GPIO pin 38/40 -> working loop!

UART2 on GPIO pin 11/13 -> working loop!

UART3 on GPIO pin 8/10 -> NOT working loop! -> then wrong pins will be a good explanation!

 

O.K. - now i know why my connection on pin 8/10 did not work from the beginning.

What is the meaning of TXD0 and RXD0 ?

 

dmesg now shows:

[    0.707241] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 28, base_baud = 1500000) is a U6_16550A
[    0.729886] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 29, base_baud = 1500000) is a U6_16550A
[    0.752520] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 30, base_baud = 1500000) is a U6_16550A

 

Link to comment
Share on other sites

My experiment to activate UART0 fails with

overlays=... uart0 uart1

and results only in an working UART1.

 

O.K. - then i have to connect my serial device on UART 1 and everything is fine.

Thank you for your help martinayotte!

 

Is it possible to use the UART pin's near the HDMI-connector?

Link to comment
Share on other sites

6 minutes ago, lsmod said:

Is it possible to use the UART pin's near the HDMI-connector?

This is the Kernel Serial Debug port, the UART0, which is already active, no need to have overlay for it, but all kernel logs are outputted there, so, not really usable unless your switch kernel to become silent.

28 minutes ago, lsmod said:

UART3 on GPIO pin 8/10 -> NOT working loop! -> then wrong pins will be a good explanation!

As I mentioned few times : the UART3 PA13/PA14 are located on pins 24/23.

Link to comment
Share on other sites

16 minutes ago, martinayotte said:

As I mentioned few times : the UART3 PA13/PA14 are located on pins 24/23.

 

But - why?

pin 23/24 is shown in the diagram as SPI1?

Is the reason that this pins are multi purpose?

Where did you find this secret?

grafik.png

Link to comment
Share on other sites

1 hour ago, lsmod said:

Is the reason that this pins are multi purpose?

Where did you find this secret?

PA13/PA14 are multi purpose, like most of GPIOs, either GPIOs, SPI pins, UART pins or Interrupt pins.

No secret at all, simply look at the schematic on page 6, search for UART3 pins, TX/RX are connected/shared to SPI1-CS/SPI1-CLK.

Link to comment
Share on other sites

2 hours ago, lsmod said:

Yes - but the organisation of this schematic diagram is horrible.

Not for me, I'm fluent with that way to show multiple purposes GPIOs, not only for AllWinner SoCs, but the same with plenty of other SoCs such STM or Rockchip.

 

2 hours ago, lsmod said:

A helpful table can be found on page 23 of the CPU description:

Right ! In the full version of the H5 Datasheet, the on with 705 pages, similar table can be found at page 294.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines