Page 1 of 1

Problem using UART2 (/dev/tty2)

Posted: Fri Aug 04, 2017 7:16 am
by Antonyab
Hello,

I am using a NanoPi NEO with the image file "nanopi-neo-core-qte-sd4g.img.zip". I want to use both UART :
* UART1: TX (Pin 8) and RX (Pin 10)
* UART2: TX (Pin 11) and RX (Pin 22)

First of all i enabled all the serial ports using "sudo npi-config". I chose "Advanced Options" then "Serial" and i enable all the serial ports.
To test the serial communication, i used minicom. UART1(/dev/ttyS1) worked properly but UART2(/dev/ttyS2) is not working.
What could be the cause of the problem?

Thanks in advance for four answers.

Re: Problem using UART2 (/dev/tty2)

Posted: Tue Sep 26, 2017 10:41 am
by robi772
Hi,
Have any success with the UART2? For me same not working the /dev/ttyS2 RX pin, the TX is working normaly.
Robi

Re: Problem using UART2 (/dev/tty2)

Posted: Thu Sep 28, 2017 2:02 pm
by skri_pach
Problem is still unsolved.
After enabling ttyS2 via npi-config we can see ttyS2 all reasonable configuration is /proc and /sys - perfect, but still not working :)

P.S. It's 100% software problem. ttyS2 is woking with kernel 3.4 and not with kernel 4.11.2 on the same hardware.

Re: Problem using UART2 (/dev/tty2)

Posted: Sat Nov 18, 2017 2:41 pm
by santaslow
I'm having the same problem here. UART2 works fine with 3.x kernel, but with 4.11.12 the GPIO pins seem to be misconfigured.
This is what they look like:
root@NanoPi-NEO2:~# gpio readall
+-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 8 | GPIOA12 | ALT5 | 0 | 3 || 4 | | | 5V | | |
| 11 | 9 | GPIOA11 | ALT5 | 0 | 5 || 6 | | | 0v | | |
| 203 | 7 | GPIOG11 | OUT | 1 | 7 || 8 | 0 | ALT5 | GPIOG6 | 15 | 198 |
| | | 0v | | | 9 || 10 | 0 | ALT5 | GPIOG7 | 16 | 199 |
| 0 | 0 | GPIOA0 | ALT5 | 0 | 11 || 12 | 1 | OUT | GPIOA6 | 1 | 6 |
| 2 | 2 | GPIOA2 | OFF | 0 | 13 || 14 | | | 0v | | |
| 3 | 3 | GPIOA3 | OFF | 0 | 15 || 16 | 0 | OFF | GPIOG8 | 4 | 200 |
| | | 3.3v | | | 17 || 18 | 0 | ALT2 | GPIOG9 | 5 | 201 |
| 64 | 12 | GPIOC0 | ALT4 | 0 | 19 || 20 | | | 0v | | |
| 65 | 13 | GPIOC1 | ALT4 | 0 | 21 || 22 | 1 | OUT | GPIOA1 | 6 | 1 |
| 66 | 14 | GPIOC2 | ALT4 | 0 | 23 || 24 | 1 | OUT | GPIOC3 | 10 | 67 |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+


You can clearly see that GPIOA1 is configured as OUT when it should be ALT5.
What's interesting is that the TX pin for UART2 (GPIOA0) is configured properly as ALT5.
Unfortunately, in my case the 3.x kernel is not a valid workaround as it doesn't contain the rtc-ds1307 module and I need that too.
If I understand correctly, I need to re-compile my dtb file in order to change the pin configurations. Is this correct or is there an easier option that I'm missing?
I recently purchased several npi2 boards with the hope of migrating a project to using npi2, but for that to work I need 2 UARTs and a working rtc. I would really hate to have to migrate it to yet another board for such a small issue.

Thanks in advance for any ideas on how to fix this!

Re: Problem using UART2 (/dev/tty2)

Posted: Fri Dec 01, 2017 1:29 pm
by lesto
same problem here.

i also found "gpio readall" not using ALT5...

but notice how all the other pin not used are OFF, while RX is OUT..

So i used npi-config and disabled ALL the other interfaces (I2C and SPI, PWM and I2C area lready disabled) and bam!

IT WORK :mrgreen:

Code: Select all

 +-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |     |
 |  12 |   8 |  GPIOA12 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |     |
 |  11 |   9 |  GPIOA11 |  OFF | 0 |  5 || 6  |   |      | 0v       |     |     |
 | 203 |   7 |  GPIOG11 |  OFF | 0 |  7 || 8  | 0 | ALT5 | GPIOG6   | 15  | 198 |
 |     |     |       0v |      |   |  9 || 10 | 0 | ALT5 | GPIOG7   | 16  | 199 |
 |   0 |   0 |   GPIOA0 | ALT5 | 0 | 11 || 12 | 0 | OFF  | GPIOA6   | 1   | 6   |
 |   2 |   2 |   GPIOA2 |  OFF | 0 | 13 || 14 |   |      | 0v       |     |     |
 |   3 |   3 |   GPIOA3 |  OFF | 0 | 15 || 16 | 0 | OFF  | GPIOG8   | 4   | 200 |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | OFF  | GPIOG9   | 5   | 201 |
 |  64 |  12 |   GPIOC0 |  OFF | 0 | 19 || 20 |   |      | 0v       |     |     |
 |  65 |  13 |   GPIOC1 |  OFF | 0 | 21 || 22 | 0 | ALT5 | GPIOA1   | 6   | 1   |
 |  66 |  14 |   GPIOC2 |  OFF | 0 | 23 || 24 | 0 | OFF  | GPIOC3   | 10  | 67  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+

 +-----+----NanoPi-NEO2 Debug UART-+----+
 | BCM | wPi |   Name   | Mode | V | Ph |
 +-----+-----+----------+------+---+----+
 |   4 |  17 |   GPIOA4 | ALT5 | 0 | 37 |
 |   5 |  18 |   GPIOA5 | ALT5 | 0 | 38 |
 +-----+-----+----------+------+---+----+
pi@NanoPi-NEO2:~$

Re: Problem using UART2 (/dev/tty2)

Posted: Sat Dec 02, 2017 9:51 am
by santaslow
Thanks, lesto!

In case anyone's wondering, it's SPI0 that's causing the conflict. Switching it off allows UART2 to work properly.

Re: Problem using UART2 (/dev/tty2)

Posted: Mon Dec 04, 2017 2:09 am
by dhlt25
santaslow wrote:
Thanks, lesto!

In case anyone's wondering, it's SPI0 that's causing the conflict. Switching it off allows UART2 to work properly.

wow, thank you. This is causing me a lot of headache in the past few days haha.

Re: Problem using UART2 (/dev/tty2)

Posted: Sun Sep 29, 2019 11:00 am
by rva
2 years after : IS this problem still existing ?
Linux NanoPi-NEO-Core 4.14.52 #90 SMP Thu Oct 25 18:26:40 CST 2018 armv7l armv7l armv7l GNU/Linux

[ 0.487302] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 44, base_baud = 1500000) is a U6_16550A
[ 1.285390] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 45, base_baud = 1500000) is a U6_16550A
[ 1.316960] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 46, base_baud = 1500000) is a U6_16550A

I CAN NOT MAKE UART2 work and I need I2C for my project , I have disabled SPI and others (PWM,I2S) via npi-config rebooted.

I have tried with a serial sensor that is working flawlessly on other boards : it cant communicate with the nanoPI via /dev/ttyS2

I have tried to connect TX and RX via a cable (PIN22 to PIN11) and a simple picom test shows that the UART2 is not working : I have no echo of what I type



+-----+-----+----------+------+---+-NanoPi-NEO-Core--+------+----------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 12 | 8 | GPIOA12 | ALT5 | 0 | 3 || 4 | | | 5v | | |
| 11 | 9 | GPIOA11 | ALT5 | 0 | 5 || 6 | | | 0v | | |
| 203 | 7 | GPIOG11 | OFF | 0 | 7 || 8 | 0 | ALT5 | GPIOG6 | 15 | 198 |
| | | 0v | | | 9 || 10 | 0 | ALT5 | GPIOG7 | 16 | 199 |
| 0 | 0 | GPIOA0 | ALT5 | 0 | 11 || 12 | 0 | OFF | GPIOA6 | 1 | 6 |
| 2 | 2 | GPIOA2 | OFF | 0 | 13 || 14 | | | 0v | | |
| 3 | 3 | GPIOA3 | OFF | 0 | 15 || 16 | 0 | OFF | GPIOG8 | 4 | 200 |
| | | 3.3v | | | 17 || 18 | 0 | OFF | GPIOG9 | 5 | 201 |
| 64 | 12 | GPIOC0 | OFF | 0 | 19 || 20 | | | 0v | | |
| 65 | 13 | GPIOC1 | OFF | 0 | 21 || 22 | 0 | ALT5 | GPIOA1 | 6 | 1 |
| 66 | 14 | GPIOC2 | OFF | 0 | 23 || 24 | 0 | OFF | GPIOC3 | 10 | 67 |