How to enable CAN peripheral

I wonder how did you get the rest of modules loaded. If you You should see message in dmesg, smth. like can’t load modules. You should not only replace kernel and DT, but as well compile kernel modules and install them to your specified folder on your host machine like

mkdir _modules
make modules_install INSTALL_MOD_PATH=./_modules ARCH=arm CROSS_COMPILE=xxx

, and finally replace files on target using scp or perhaps copying them to/from flash drive.

Yes indeed I compiled all the ko files and then transferred it onto my module using scp.

Hi @kp_2024,
Please confirm if the issue is solved or still facing the issue?

Hi @sahil.tx

I have enabled the CAN peripheral. However, when I tried to use CAN utilities, $candump can0, nothing is showing up.

Note: I already set-up the can0 interface using following commands:

$ ip link set can0 type can bitrate 500000
$ ip link set can0 up

Hi @kp_2024 ,

What is the BSP version and the carrier board/base board you are using.
Any jumper settings you modified on the carier board?
How you are testing the sending and receive of CAN data, are you using any CAN analyzer?
Please also share device tree changes done.

Hi @sahil.tx

  • I am using BSP 5.x.y and we are using Colibri Evaluation Board.

  • I have not changed any jumper setting in the carrier board.

  • I am using the can-utilities at the terminal to send the message and at the output CAN pin, I am using Digital Oscilloscope. I also tried to verify using PCAN, but did not got any result.

  • Device tree Changes are mentioned below:

imx6ull-colibri-eval-v3.dtsi

&ecspi1 {
	status = "disabled";

	mcp2515: can@0 {
		compatible = "microchip,mcp2515";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_can_int>;
		reg = <0>;
		clocks = <&clk16m>;
		interrupt-parent = <&gpio2>;
		interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
		spi-max-frequency = <10000000>;
		vdd-supply = <&reg_3v3>;
		xceiver-supply = <&reg_5v0>;
		status = "disabled";
	};

	/* To keep the CAN controller enabled by default,
	 * disable conflicting spidev.
	 */
	spidev0: spidev@0 {
		status = "disabled";
	};
};

&can1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_flexcan1>;
	xceiver-supply = <&reg_3v3>;
	status = "okay";
};

&can2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_flexcan2>;
	xceiver-supply = <&reg_3v3>;
	status = "okay";
};

imx6ull-colibri-wifi.dtsi

&iomuxc {
 pinctrl-names = "default";
 pinctrl-0 = <&pinctrl_gpio1 &pinctrl_gpio2
 &pinctrl_gpio4 >;
};

imx6ull-colibri.dtsi

pinctrl_gpio3: gpio3-grp { /* CAN2 */
			fsl,pins = <
			//	MX6UL_PAD_ENET1_RX_EN__GPIO2_IO02	0x10b0 /* SODIMM 178 */
			//	MX6UL_PAD_ENET1_TX_DATA0__GPIO2_IO03	0x10b0 /* SODIMM 188 */
			>;
		};
		pinctrl_gpio7: gpio7-grp { /* CAN1 */
			fsl,pins = <
			//	MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO00	0xb0b0 /* SODIMM 55 */
			//	MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO01	0xb0b0 /* SODIMM 63 */
			>;
		};
		pinctrl_pwm7: pwm7-grp {
			fsl,pins = <
			//	MX6UL_PAD_ENET1_TX_CLK__PWM7_OUT	0x00079	/* SODIMM 67 */
			>;
		};

Hi @kp_2024 ,
Did you miss the below point mentioned here
With the Colibri Evaluation Board V3.2 the CAN transceiver can be isolated from the MCP251x CAN controller with the jumpers JP4/JP5. Remove the jumpers and use jumper wires to route the FlexCAN RX/TX signals to the CAN transceiver (X3-A20 is CAN2 RX and X3-B12 is CAN2 TX).

Hi, thank you for mentioning, I guess I missed it.

Hi @sahil.tx
I successfully established the communication over CAN. I just removed and reinstalled jumpers back into the position.

Thank you for the response and time!