hardikharpal
Posts: 4
Joined: Tue Jun 13, 2017 10:06 am

SC16IS752 Interfacing Issue

Tue Apr 24, 2018 3:43 am

Hi,

I am Interfacing SC16IS752(Custom Board) on SPI0 of raspberry pi.I have latest stretch lite version as on 24-April-2018.
I created dts file and generated dtbo file copied it to /boot/overlay. Also edited /boot/config.txt to load overlay.

Code: Select all

/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

        [email protected] {
        target = <&spidev0>;
        __overlay__ {
            status = "disabled";
        };
    };

        [email protected] {
                target = <&gpio>;
                __overlay__ {
                        spi0_pins: spi0_pins {
                                brcm,pins = <9 10 11>;
                                brcm,function = <4>; /* alt 0 */
                        };

                        spi0_cs_pins: spi0_cs_pins {
                                brcm,pins = <8>;
                                brcm,function = <1>; /* output */
                        };
                };
        };

        [email protected] {
        target = <&spi0>;
        frag1: __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            pinctrl-names = "default";
            pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
            cs-gpios = <&gpio 8 1>;
            status = "okay";

            sc16is752: [email protected] {
                compatible = "nxp,sc16is752";
                reg = <0>; /* CE0 */
                clocks = <&sc16is752_clk>;
                interrupt-parent = <&gpio>;
                interrupts = <24 2>; /* IRQ_TYPE_EDGE_FALLING */
                gpio-controller;
                #gpio-cells = <2>;
                spi-max-frequency = <4000000>;

                sc16is752_clk: sc16is752_clk {
                   compatible = "fixed-clock";
                   #clock-cells = <0>;
                   clock-frequency = <14745600>;
                };
            };
        };
        };
        
        [email protected] {
                target = <&aux>;
                __overlay__ {
                        status = "okay";
                };
        };

    __overrides__ {
      int_pin = <&sc16is752>,"interrupts:0";
    };
};
My problem is when open port on minicom . IRQ pin remains low for all time and UART communication not working.
Getting below message on dmesg .

[1293.489435] sc16is7xx spi0.0: ttySC0: Unexpected interrupt: 8
[ 1293.490328] sc16is7xx spi0.0: ttySC0: Unexpected interrupt: 0
[ 1293.490460] sc16is7xx spi0.0: ttySC0: Unexpected interrupt: 0
Getting bellow output for

Code: Select all

sudo vcdbg log msg 
002047.676: dtparam: spi=on
002062.027: brfs: File read: 1630 bytes
002075.726: brfs: File read: /mfs/sd/overlays/sc16is752-spi0.dtbo
002097.865: Loaded overlay 'sc16is752-spi0'
So I tried with SC16IS750(SparkFun Breakout Board ) which has one UART channel. I have connected to same pins on raspberry pi and made changes(just replaced sc16is752 with sc16is750) to dts file and generated dtbo file copied to /boot/overlay and edited /boot/config.txt to load overlay.
And It works perfectly able to send data and receive data.

Am I missing something ? Any Hint will be Helpful.

Thank you.
Last edited by hardikharpal on Wed Apr 25, 2018 3:14 am, edited 1 time in total.

hardikharpal
Posts: 4
Joined: Tue Jun 13, 2017 10:06 am

Re: SC16IS752 Interfacing Issue

Tue Apr 24, 2018 12:01 pm

Hi,

I read here https://raw.githubusercontent.com/janzt ... c16is7xx.c in that sc16is7xx_startup() one comment is there
/* ama 2016-12: fixed error message "unexpected interrupt: 8" in dmesg by added mdelay(1)
* without delay, after enabling the interrupts in IER, set_baud/set_termios is immediatly called,
* enables enhanced register ("config mode") with LCR = 0xBF and the first interrupt occurs at
* the same time, resulting in reading the IIR interrupt status register in the wrong mode.
* This problematic time window, from enabling the interrupts to handling them, is about 100µs, so a
* delay of 1000µs=1ms was choosen
*/
mdelay(1);
But in case of raspberry pi driver for SC16IS7XX https://github.com/raspberrypi/linux/bl ... c16is7xx.c the delay is no there.

Do you think this is the cause of my issue?

Thanks and Regards,
Hardik Harpal

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 1 guest