Jump to content

NanoPi-NEO2 + sc16is750 can not find /dev/ttySC0


tangbinbin

Recommended Posts

Hi,

I want to expand my NanoPi-NEO2 more uart ports through I2C, so I make a choice to use a sc16is750 module( just like sparkfun sc16is750 ).

Below is all of my system information:

 

pi@nanopineo2:~$ uname -a

Linux nanopineo2 5.4.20-sunxi64 #20.02.1 SMP Mon Feb 17 02:37:37 CET 2020 aarch64 aarch64 aarch64 GNU/Linux

 

First step ,I edit a device tree overlay for the sc16is750 named sc16is750-i2c.dts as below:

pi@nanopineo2:/boot/overlay-user$ sudo nano sc16is750-i2c.dts
/dts-v1/;
/plugin/;

/ {
    compatible =  "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

    fragment@0 {
        /* This fragment is required only if using interrupts */
        target = <&pio>;
        __overlay__ {
            sc16is750_pin_irq: sc16is750_pin_irq {
                pins = "PA17";
                function = "irq";
                bias-pull-up;
            };
        };
    };

    fragment@1 {
        target = <&i2c1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            sc16is750: sc16is750@4d {
                compatible = "nxp,sc16is750";
                reg = <0x4d>;
                status = "okay";
                clocks = <&sc16is750_clk>;
                gpio-controller;
                #gpio-cells = <3>;
                /* Below are optional properties for supporting interrupts */
                interrupt-controller;
                #interrupt-cells = <3>;
                interrupt-parent = <&pio>;
                interrupts = <0 17 2>; /* PG11 IRQ_TYPE_EDGE_FALLING */
                pinctrl-names = "default";
                pinctrl-0 = <&sc16is750_pin_irq>;


                sc16is750_clk: sc16is750_clk {
                    compatible = "fixed-clock";
                    #clock-cells = <0>;
                    clock-frequency = <14745600>;
                };
            };
        };
    };


    __overrides__ {
        int_pin = <&sc16is750>,"interrupts:0";
        addr = <&sc16is750>,"reg:0";
    };

};

 

Second step, I add the sc16is750-i2c.dts to my /boot/overlay-usr as below:

pi@nanopineo2:/boot/overlay-user$ sudo armbian-add-overlay sc16is750-i2c.dts

Compiling the overlay
Copying the compiled overlay file to /boot/overlay-user/
Reboot is required to apply the changes

Afterthen, I checked sc16is750-i2c.dtbo as below:

pi@nanopineo2:/boot/overlay-user$ fdtdump sc16is750-i2c.dtbo

**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

/dts-v1/;
// magic:        0xd00dfeed
// totalsize:        0x5f8 (1528)
// off_dt_struct:    0x38
// off_dt_strings:    0x4d0
// off_mem_rsvmap:    0x28
// version:        17
// last_comp_version:    16
// boot_cpuid_phys:    0x0
// size_dt_strings:    0x128
// size_dt_struct:    0x498

/ {
    compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
    fragment@0 {
        target = <0xffffffff>;
        __overlay__ {
            sc16is750_pin_irq {
                pins = "PA17";
                function = "irq";
                bias-pull-up;
                phandle = <0x00000002>;
            };
        };
    };
    fragment@1 {
        target = <0xffffffff>;
        __overlay__ {
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            sc16is750@4d {
                compatible = "nxp,sc16is750";
                reg = <0x0000004d>;
                status = "okay";
                clocks = <0x00000001>;
                gpio-controller;
                #gpio-cells = <0x00000003>;
                interrupt-controller;
                #interrupt-cells = <0x00000003>;
                interrupt-parent = <0xffffffff>;
                interrupts = <0x00000000 0x00000011 0x00000002>;
                pinctrl-names = "default";
                pinctrl-0 = <0x00000002>;
                phandle = <0x00000003>;
                sc16is750_clk {
                    compatible = "fixed-clock";
                    #clock-cells = <0x00000000>;
                    clock-frequency = <0x00e10000>;
                    phandle = <0x00000001>;
                };
            };
        };
    };
    __symbols__ {
        sc16is750_pin_irq = "/fragment@0/__overlay__/sc16is750_pin_irq";
        sc16is750 = "/fragment@1/__overlay__/sc16is750@4d";
        sc16is750_clk = "/fragment@1/__overlay__/sc16is750@4d/sc16is750_clk";
    };
    __fixups__ {
        pio = "/fragment@0:target:0", "/fragment@1/__overlay__/sc16is750@4d:interrupt-parent:0";
        i2c1 = "/fragment@1:target:0";
    };
    __local_fixups__ {
        fragment@1 {
            __overlay__ {
                sc16is750@4d {
                    clocks = <0x00000000>;
                    pinctrl-0 = <0x00000000>;
                };
            };
        };
    };
};

 

After reboot, I check the tty devices:

pi@nanopineo2:~$ dmesg | grep tty
[    2.056137] printk: console [ttyS0] disabled
[    2.076722] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 26, base_baud = 1500000) is a U6_16550A
[    2.076773] printk: console [ttyS0] enabled
[    2.098045] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 27, base_baud = 1500000) is a U6_16550A
[    2.119044] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 28, base_baud = 1500000) is a U6_16550A
[    2.142198] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 29, base_baud = 1500000) is a U6_16550A
[    5.873610] serial serial0: tty port ttySC0 registered

 

Also, I have check the i2c:

pi@nanopineo2:~$ sudo i2cdetect -y 1
[sudo] password for pi:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         
my sc16is750 address:0x4d

 

Finally, I check the tty devices:

pi@nanopineo2:~$ ls -l /dev/ttyS*
crw------- 1 pi   tty     4, 64 Mar 23 03:21 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Mar 23 03:16 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Mar 23 03:16 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Mar 23 03:16 /dev/ttyS3

 

pi@nanopineo2:~$ cat /proc/tty/drivers
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster
unknown              /dev/ttySC    242 0-7 serial
g_serial             /dev/ttyGS    245 0-3 serial
serial               /dev/ttyS       4 64-67 serial
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console

 

So, My question is why I cannot find the /dev/ttySC0?

Anyone can give me some advice to resolve the problem.

Thanks.

 

 

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