AnsweredAssumed Answered

CAN over SPI

Question asked by Bastian Neumann on Jul 18, 2018
Latest reply on Jul 19, 2018 by Carlos_Musich

Hi

 

I am using im8mq-evk board to test out a SPI to CAN converter. Namely the MCP2515 chip. I connected to ECSPI1 Signals with disconnecting the stuff on the evk board.

 

I removed all other uses of the pins from DTS file and added the pin configuration to iomuxc

        pinctrl_ecspi1: ecspi1grp {
            fsl,pins = <
                MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI        0x10b0
                MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO        0x10b0
                MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK        0x10b0
            >;
        };

 

        pinctrl_ecspi1_cs: ecspi1grp_cs {
            fsl,pins = <
                MX8MQ_IOMUXC_ECSPI1_SS0_ECSPI1_SS0        0x10b0
            >;
        };

 

        pinctrl_ecspi1irq: ecspi1irqgrp {
            fsl,pins = <
                MX8MQ_IOMUXC_UART3_TXD_GPIO5_IO27        0x4000056
            >;
        };

I also added DTS node for the clock of the chip and for ECSPI1

/ {

...

        clocks {
        can0_osc: clock@7 {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <8000000>;
        };
    };

}

 

&ecspi1 {

    fsl,spi-num-chipselects = <1>;
    cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;
    status = "okay";

    can0: mcp2515@0 {

        #address-cells = <1>;
        #size-cells = <0>;
            reg = <0>;
            compatible = "microchip,mcp2515";
        spi-max-frequency = <10000000>;
            clocks = <&can0_osc>;
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_ecspi1irq>;
            interrupt-parent = <&gpio5>;
            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
    };

 

};

For the kernel I added builtin support for mcp251x devices.

After booting up I do not get a clock signal on SCLK pin. I do not get any recognized devices on SPI bus. But I can see that device support is available.

root@imx8mqevk:~# ls /sys/bus/spi/drivers
ds3234  m25p80  mcp251x  mmc_spi  mtd_dataflash  spidev
root@imx8mqevk:~# ls /sys/bus/spi/devices/
root@imx8mqevk:~#

Outcomes