Skip to contentSkip to conversation

tcan4x5x on a Raspberry Pi

DISCUSSION FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu) 3 participants 4 messages Jul 29, 2019 – Aug 9, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

I am currently working on a project where I am trying to use the tcan4550 chip with a Raspberry PI 3B. I am struggling to create a working device tree overlay file for the Raspberry Pi. Has anyone here tried this already? I would appreciate any help.

Thanks,
Konstantin

#1 lore raw

Konstantin

Quoted 5 lines · FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)

Hi all,

I am currently working on a project where I am trying to use the tcan4550 chip with a Raspberry PI 3B. I am struggling to create a working device tree overlay file for the Raspberry Pi. Has anyone here tried this already? I would appreciate any help.

Are you using the driver from net-next?

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tree/drivers/net/can/m_can

DT documentation here

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tree/Documentation/devicetree/bindings/net/can/tcan4x5x.txt

I did the development on a BeagleBone Black.

Dan

Quoted 3 lines

Thanks,
Konstantin

#2 lore raw
Quoted 6 lines

Konstantin

Quoted 3 lines · FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)

Hi all,

Quoted 7 lines
Quoted 3 lines

I am currently working on a project where I am trying to use the tcan4550 chip with a Raspberry PI 3B. I am struggling to create a working device tree overlay file for the Raspberry Pi. Has anyone here tried this already? I would appreciate any help.

Are you using the driver from net-next?

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tree/drivers/net/can/m_can

Yes, I am using the driver from net-next.

Quoted 3 lines

DT documentation here

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tree/Documentation/devicetree/bindings/net/can/tcan4x5x.txt

I saw this documentation but it didn’t help much (As I said, I don’t have much experience with device trees) . My dts file currently looks like this:

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
    fragment@0 {
        target = <&spi0>;
	__overlay__ {
            status = "okay";
	    spidev@0{
	        status = "disabled";
	    };
	};
    };

    fragment@2 {
        compatible = "bosch, m_can";
	target = <&spi0>;
	__overlay__ {
	    tcan4x5x: tcan4x5x@0 {
	             compatible = "ti,tcan4x5x";
                          reg = <0>;
		#address-cells = <1>;
                         #size-cells = <1>;
		spi-max-frequency = <10000000>;
                         bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
		data-ready-gpios = <&gpio 23 0>;
		device-wake-gpios = <&gpio 24 1>;
				
	    };		
	};
    };
};

Checking dmesg I always see these errors:

[    5.409051] tcan4x5x spi0.0: no clock found
[    5.409064] tcan4x5x spi0.0: no CAN clock source defined
[    5.409125] tcan4x5x spi0.0: data-ready gpio not defined
[    5.409135] tcan4x5x spi0.0: Probe failed, err=-22

I already fixed the clock issue once by doing something like this:
clocks = <&can0_osc>,

              <&can0_osc>;

clock-names = "hclk", "cclk";
But that didn’t fix the " data-ready gpio not defined" error.

Quoted 7 lines

I did the development on a BeagleBone Black.

Dan

Thanks,
Konstantin

#3 lore raw

Hello Konstantin,

m 09.08.19 um 18:46 schrieb FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu):

Quoted 64 lines
Quoted 6 lines

Konstantin

Quoted 3 lines · FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)

Hi all,

Quoted 7 lines
Quoted 3 lines

I am currently working on a project where I am trying to use the tcan4550 chip with a Raspberry PI 3B. I am struggling to create a working device tree overlay file for the Raspberry Pi. Has anyone here tried this already? I would appreciate any help.

Are you using the driver from net-next?

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tree/drivers/net/can/m_can

Yes, I am using the driver from net-next.

Quoted 3 lines

DT documentation here

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/tree/Documentation/devicetree/bindings/net/can/tcan4x5x.txt

I saw this documentation but it didn’t help much (As I said, I don’t have much experience with device trees) . My dts file currently looks like this:

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
    fragment@0 {
        target = <&spi0>;
	__overlay__ {
            status = "okay";
	    spidev@0{
	        status = "disabled";
	    };
	};
    };

    fragment@2 {
        compatible = "bosch, m_can";
	target = <&spi0>;
	__overlay__ {
	    tcan4x5x: tcan4x5x@0 {
	             compatible = "ti,tcan4x5x";
                          reg = <0>;
		#address-cells = <1>;
                         #size-cells = <1>;
		spi-max-frequency = <10000000>;
                         bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
		data-ready-gpios = <&gpio 23 0>;
		device-wake-gpios = <&gpio 24 1>;
				
	    };		
	};
    };
};

Checking dmesg I always see these errors:

[    5.409051] tcan4x5x spi0.0: no clock found
[    5.409064] tcan4x5x spi0.0: no CAN clock source defined
[    5.409125] tcan4x5x spi0.0: data-ready gpio not defined
[    5.409135] tcan4x5x spi0.0: Probe failed, err=-22
Quoted 8 lines

I already fixed the clock issue once by doing something like this:
clocks = <&can0_osc>,

              <&can0_osc>;

clock-names = "hclk", "cclk";
But that didn’t fix the " data-ready gpio not defined" error.

Quoted 1 line

I did the development on a BeagleBone Black.

Before fiddling with the dynamic device tree, I would try to patch normal device tree source files first.

Wolfgang