Power & Source of Big Ideas

Device /dev/ttyS2 not working (Nanopi Neo Air)

Moderators: chensy, FATechsupport

Hi!,

Im trying to use the UART 2 in the new image of the NanoPi neo but i have this problem:

Code: Select all

 echo hello > /dev/ttyS2
bash: echo: write error: Input/output error


I have used the /dev/ttyS1 and it works fine.

I already tried to export the GPIO manually (echo 0 > /sys/class/gpio export) and assign the as output (TX) and input (RX) but that didn't worked.

It works fine on the previous kernel (3.something)

The current kernel is the

Code: Select all

uname -a
Linux NanoPi-NEO-Air 4.11.2 #19 SMP Sat May 27 10:23:19 CST 2017 armv7l armv7l armv7l GNU/Linux
You can try running sudo npi-config.

In that program you will find Advanced Options -> Serial -> serial2 Enable/Disable

By default it is disabled, so this may be causing your error.
MrUnreliable wrote:
You can try running sudo npi-config.

In that program you will find Advanced Options -> Serial -> serial2 Enable/Disable

By default it is disabled, so this may be causing your error.


Thanks!, I tried it but it did not work (for testing i downloaded minicom, did a shortcut between TX and RX of UART 2 to get an echo but it did not work.

Analyzing the npi-config program i ended up in this file: /boot/sun8i-h3-nanopi-neo-air.dtb, that is the one that define if a module is on or off (and some other black magic).

The thing i found curious is that when i read the whole file

Code: Select all

fdtdump /boot/sun8i-h3-nanopi-neo-air.dtb
i found some differences between the other serials (0, 1 and 3) and the Serial2:

Code: Select all

...
uart0@0 {
                pins = "PA4", "PA5";
                function = "uart0";
                linux,phandle = <0x00000017>;
                phandle = <0x00000017>;
            };
            uart1 {
                pins = "PG6", "PG7";
                function = "uart1";
                linux,phandle = <0x00000018>;
                phandle = <0x00000018>;
            };
            uart1_rts_cts {
                pins = "PG8", "PG9";
                function = "uart1";
            };
            uart2 {
                pins = "PA0", "PA1";
                function = "uart2";
            };
            uart3 {
                pins = "PA13", "PA14";
                function = "uart3";
                linux,phandle = <0x00000019>;
                phandle = <0x00000019>;
            };
            uart3_rts_cts {
                pins = "PA15", "PA16";
                function = "uart3";
                linux,phandle = <0x0000001a>;
                phandle = <0x0000001a>;
            };

...


the serial 2 doesn't have the linux phandle parameter. Also in other part of the file, this appear:

Code: Select all

...
serial@01c28000 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28000 0x000000b7>;
            interrupts = <0x00000000 0x00000004 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000006 0x000000c2>;
            resets = <0x00000006 0x00000290>;
            dmas = <0x00000012 0x00000003 0x78000000 0x6f6b6179>;
            dma-names = "rx", "tx";
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <0x00000017>;
        };
        serial@01c28400 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28400 0x000000b7>;
            interrupts = <0x00000000 0x00000004 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000006 0x000000c2>;
            resets = <0x00000006 0x00000290>;
            dmas = <0x00000012 0x00000003 0x78000000 0x6f6b6179>;
            dma-names = "rx", "tx";
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <0x00000018>;
        };
        serial@01c28800 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28800 0x000000b7>;
            interrupts = <0x00000000 0x00000004 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000006 0x000000c2>;
            resets = <0x00000006 0x00000290>;
            dmas = <0x00000012 0x00000003 0x78000000 0x6f6b6179>;
            dma-names = "rx", "tx";
            status = "okay";
        };
        serial@01c28c00 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28c00 0x000000b7>;
            interrupts = <0x00000000 0x00000004 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000006 0x000000c2>;
            resets = <0x00000006 0x00000290>;
            dmas = <0x00000012 0x00000003 0x78000000 0x6f6b6179>;
            dma-names = "rx", "tx";
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <0x00000019 0x69326340>;
        };

...


Assuming that serial@01c28800 is the serial 2, it lacks some of the parameters the other one does have.

Tried to add it myself with fdtput, but returned that it was a bad path

Code: Select all

fdtput --type s /boot/sun8i-h3-nanopi-neo-air.dtb serial@01c28800  pinctrl-names "default"
Error at 'serial@01c28800': FDT_ERR_BADPATH
Having the same issue. Besides npi-config can't change serial port enabled/disabled status with message "Unsupported with Linux-4.11.2". Did you find solution? (nanopi-neo_debian-nas-jessie_4.11.2_20170525.img)
May be instead of serial@01c28800 - serial2 ?

Who is online

In total there are 32 users online :: 0 registered, 0 hidden and 32 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 32 guests