Interfacing NXP SC16IS750 over SPI

210 views
Skip to first unread message

atiqu...@gmail.com

unread,
Jun 17, 2020, 8:12:11 AM6/17/20
to BeagleBoard
Hi All,

I am trying to interface NXP SPI to UART chip with Beaglebone black. At the moment I amusing SPI 1 and breakout board from Sparkfun (https://www.sparkfun.com/products/retired/9981) .

I have enabled the driver for SC16IS7xx in the kerne

# CONFIG_SERIAL_SCCNXP is not set
CONFIG_SERIAL_SC16IS7XX_CORE=y
CONFIG_SERIAL_SC16IS7XX=y
# CONFIG_SERIAL_SC16IS7XX_I2C is not set
CONFIG_SERIAL_SC16IS7XX_SPI=y
# CONFIG_SERIAL_BCM63XX is not set

I don't see any message related to SPI or  above driver when kernel boot-up.

Kernel Version = Linux beaglebone 4.14.71-ti-r80 #1 SMP PREEMPT Tue Jun 16 22:25:59 AEST 2020 armv7l GNU/Linux

Current Device Tree for this particular chip is:

/*
 * Copyright (C) 2015 Robert Nelson <robert...@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

    /* identification */
    part-number = "BB-SPI1-SC16IS750";
    version = "00A0";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P9.31",    /* spi1_sclk, SPI1_SCLK */
        "P9.29",    /* spi1_d0, SPI1_MISO */
        "P9.30",    /* spi1_d1, SPI1_MOSI */
        "P9.28",    /* spi1_cs0, CS0 */
       
        /* the hardware ip uses */
        "spi1";

    /*
     * Free up the pins used by the cape from the pinmux helpers.
     */
    fragment@0 {
        target = <&ocp>;
        __overlay__ {
            P9_28_pinmux { status = "disabled"; };    /* spi1_cs0 */
            P9_30_pinmux { status = "disabled"; };    /* spi1_d1 */
            P9_29_pinmux { status = "disabled"; };    /* spi1_d0 */
            P9_31_pinmux { status = "disabled"; };    /* spi1_sclk */
        };
    };

    fragment@1 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            bb_spi1_pins: pinmux_bb_spi1_pins {
                pinctrl-single,pins = <
                    0x190 0x33    /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */
                    0x194 0x33    /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
                    0x198 0x13    /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
                    0x19c 0x13    /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
                >;
            };
        };
    };

    fragment@2 {
        target = <&spi1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&bb_spi1_pins>;
            ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 bits... */

            sc16is750: sc16is750@1 {
                compatible = "nxp,sc16is750";
                reg = <0>;
                clocks = <&clk20m>;
                interrupt-parent = <&gpio2>;
                interrupts = <8 2>; /* IRQ_TYPE_EDGE_FALLING */
                spi-max-frequency = <4000000>;
         
                clk20m:clk20m {
                    compatible = "fixed-clock";
                    #clock-cells = <0>;
                    clock-frequency = <14745600>;
                };
            };
        };
    };
};
 

Drew Fustini

unread,
Jun 17, 2020, 8:26:13 AM6/17/20
to Beagle Board
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/1fd3549d-0428-4337-a088-4e974ec68f29o%40googlegroups.com.

Please run this script and paste the output so we know exactly what is
installed and configured:
/opt/scripts/tools/version.sh

I believe the driver should already be in the kernel that Robert builds:

pdp7@x1:~/dev/beaglebone/ti-linux-kernel-dev$ git status
On branch ti-linux-4.14.y
Your branch is up to date with 'origin/ti-linux-4.14.y'.

nothing to commit, working tree clean
pdp7@x1:~/dev/beaglebone/ti-linux-kernel-dev$ git grep SC16IS7XX
patches/defconfig
patches/defconfig:CONFIG_SERIAL_SC16IS7XX_CORE=m
patches/defconfig:CONFIG_SERIAL_SC16IS7XX=m
patches/defconfig:CONFIG_SERIAL_SC16IS7XX_I2C=y
patches/defconfig:CONFIG_SERIAL_SC16IS7XX_SPI=y

-drew

Robert Nelson

unread,
Jun 17, 2020, 9:42:57 AM6/17/20
to Beagle Board, atiqu...@gmail.com
On Wed, Jun 17, 2020 at 7:12 AM <atiqu...@gmail.com> wrote:
>
> Hi All,
>
> I am trying to interface NXP SPI to UART chip with Beaglebone black. At the moment I amusing SPI 1 and breakout board from Sparkfun (https://www.sparkfun.com/products/retired/9981) .
>
> I have enabled the driver for SC16IS7xx in the kerne
>>
>>
> # CONFIG_SERIAL_SCCNXP is not set
> CONFIG_SERIAL_SC16IS7XX_CORE=y
> CONFIG_SERIAL_SC16IS7XX=y
> # CONFIG_SERIAL_SC16IS7XX_I2C is not set
> CONFIG_SERIAL_SC16IS7XX_SPI=y
> # CONFIG_SERIAL_BCM63XX is not set
>
> I don't see any message related to SPI or above driver when kernel boot-up.

You also need to disable CONFIG_SERIAL_DEV_CTRL_TTYPORT, as it breaks
CONFIG_SERIAL_SC16IS7XX

https://github.com/RobertCNelson/ti-linux-kernel-dev/commit/c8bf98fd9324e3973d5021eefcfa7a549869a578

Regards,

--
Robert Nelson
https://rcn-ee.com/

Atique Rehman

unread,
Jun 17, 2020, 7:32:34 PM6/17/20
to BeagleBoard
Here is output of the command '/opt/scripts/tools/version.sh':

git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335BNLT00C04815BBBK1FC3]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.71-ti-r80]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr0=/lib/firmware/BB-PWM1-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr1=/lib/firmware/BB-PWM2-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr2=/lib/firmware/BB-SPI1-SC16IS750-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr3=/lib/firmware/BB-UART1-COM1-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-UART2-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr5=/lib/firmware/BB-UART4-COM0-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr6=/lib/firmware/BB-UART5-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[disable_uboot_overlay_wireless=1]
uboot_overlay_options:[disable_uboot_overlay_adc=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20180928.0-0rcnee0~stretch+20180928]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[    1.024898] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.026126] gpio-of-helper ocp:cape-universal: ready
END

> To unsubscribe from this group and stop receiving emails from it, send an email to beagl...@googlegroups.com.

Atique Rehman

unread,
Jun 17, 2020, 7:50:20 PM6/17/20
to BeagleBoard
Hi Robert,

Disabling the config CONFIG_SERIAL_SC16IS7XX worked for me.
Thanks for you help.

Regards,
Atique

Atique Rehman

unread,
Jun 17, 2020, 8:50:35 PM6/17/20
to BeagleBoard
Hi Robert,

Is my device dts configuration correct? As Now I can see ttySC0 and when I try to communicate with SC16IS750, I don't see any activity on interrupt line. Is this the correct way to configure interrupt line?

Regards,
Atique

On Wednesday, June 17, 2020 at 11:42:57 PM UTC+10, RobertCNelson wrote:

Atique Rehman

unread,
Jun 18, 2020, 1:27:10 AM6/18/20
to BeagleBoard
This device for SC16IS750 is working for me.

/*
 * Copyright (C) 2015 Robert Nelson <robert...@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>


/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

    /* identification */
    part-number = "BB-SPI1-SC16IS750";
    version = "00A0";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P9.31",    /* spi1_sclk, SPI1_SCLK */
        "P9.29",    /* spi1_d0, SPI1_MISO */
        "P9.30",    /* spi1_d1, SPI1_MOSI */
        "P9.28",    /* spi1_cs0, CS0 */
        "P8.43",    /* irq P8_43 (R13) gpmc_a0.gpio2[8] */

       
        /* the hardware ip uses */
        "spi1";
    /*
     * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
     */
    fragment@0 {
        target-path="/";
        __overlay__ {

            chosen {
                overlays {
                    BB-SPI1-SC16IS750-00A0 = __TIMESTAMP__;
                };
            };
        };

    };
   
    /*
     * Free up the pins used by the cape from the pinmux helpers.
     */
    fragment@1 {

        target = <&ocp>;
        __overlay__ {
            P9_28_pinmux { status = "disabled"; };    /* spi1_cs0 */
            P9_30_pinmux { status = "disabled"; };    /* spi1_d1 */
            P9_29_pinmux { status = "disabled"; };    /* spi1_d0 */
            P9_31_pinmux { status = "disabled"; };    /* spi1_sclk */
           
            P8_43_pinmux { status = "disabled"; };    /* irq P8_43 (R13) gpio2[8] */
        };
    };

    fragment@2 {
        target = <&am33xx_pinmux>;
        __overlay__ {
       
            bb_sc16is_pins: bb_sc16is_pins {
                pinctrl-single,pins = <
                    AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_INPUT_PULLDOWN, MUX_MODE7)    /* irq P8_43 lcd_data2.gpio2[8] */
                >;
            };
       
            bb_spi1_pins: pinmux_bb_spi1_pins {
                pinctrl-single,pins = <
                    AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT_PULLUP, MUX_MODE3) /* P9_31 spi1_sclk.spi1_sclk */
                    AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_INPUT_PULLUP, MUX_MODE3)   /* P9_29  spi1_d0.spi1_d0 */
                    AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR0, PIN_OUTPUT_PULLUP, MUX_MODE3)   /* P9_30 spi1_d1.spi1_d1 */
                    AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_OUTPUT_PULLUP, MUX_MODE3)  /* P9_28 spi1_cs0.spi1_cs0 */
                >;
            };
        };
    };

    fragment@3 {

        target = <&spi1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&bb_spi1_pins>;
            ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 bits... */

            sc16is750: sc16is750@0 {

                compatible = "nxp,sc16is750";
                reg = <0>;
                clocks = <&clk20m>;
                pinctrl-names = "default";
                pinctrl-0 = <&bb_sc16is_pins>;

               
                interrupt-parent = <&gpio2>;
                interrupts = <8 2>; /* IRQ_TYPE_EDGE_FALLING */
                spi-max-frequency = <4000000>;
                gpio-controller;
                #gpio-cells = <2>;


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


On Wednesday, June 17, 2020 at 11:42:57 PM UTC+10, RobertCNelson wrote:
Reply all
Reply to author
Forward
0 new messages