Colibri iMX6 flexcan not work

Hi all!
I have configured my Colibri Evaluation Board V3.2B to work with FLEXCAN.
Following this and this , configured the kernel CAN system as:

root@colibri-imx6:~# zcat /proc/config.gz | grep CAN
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
# CONFIG_CAN_GW is not set
# CAN Device Drivers
CONFIG_CAN_VCAN=y
CONFIG_CAN_DEV=y
CONFIG_CAN_CALC_BITTIMING=y
# CONFIG_CAN_LEDS is not set
CONFIG_CAN_FLEXCAN=y
# CAN SPI interfaces
# CONFIG_CAN_MCP251X is not set
CONFIG_CAN_DEBUG_DEVICES=y

These are the kernel messages relate to ca at sysem startup:

root@colibri-imx6:~# dmesg | grep can
[    0.257640] i2c i2c-1: can't use DMA, using PIO instead.
[    0.258671] i2c i2c-2: can't use DMA, using PIO instead.
[    1.401490] vcan: Virtual CAN interface driver
[    1.414090] 2090000.flexcan supply xceiver not found, using dummy regulator
[    1.424136] flexcan 2090000.flexcan: gpr /soc/aips-bus@02000000/iomuxc-gpr@020e0000 req_gpr 0x34 req_bit 28 ack_gpr 0x10 ack_bit 17
[    1.424226] flexcan 2090000.flexcan: device registered (reg_base=a09dc000, irq=35)
[    2.375638] snvs-secvio 20cc000.caam-snvs: can't get snvs clock
[    2.430579] can: controller area network core (rev 20120528 abi 9)
[    2.452718] can: raw protocol (rev 20120528)
[    2.458505] can: broadcast manager protocol (rev 20161123 t)

Others stuff:

root@colibri-imx6:~#uname -a
Linux colibri-imx6 4.9.87-rt62+g3bb6e32 #9 SMP PREEMPT RT Thu Jul 11 11:26:57 CEST 2019 armv7l GNU/Linux

root@colibri-imx6:~# ls -l /sys/class/net/can0/device
lrwxrwxrwx    1 root     root             0 Jul 11 09:37 /sys/class/net/can0/device -> ../../../2090000.flexcan

I set up the can0 with the command:

# ip link set can0 up type can bitrate 125000 berr-reporting on
[ 3490.157019] IPv6: ADDRCONF(NETDEV_UP): can0: link is not ready
[ 3490.164984] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

the ip details are:

root@colibri-imx6:~# ip -details link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can <BERR-REPORTING> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
          bitrate 125000 sample-point 0.875 
          tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
          flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
          clock 30000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

and the dmesg messages related are:

[ 4177.654054] flexcan 2090000.flexcan can0: writing ctrl=0x0e312055
[ 4177.654087] flexcan 2090000.flexcan can0: flexcan_set_bittiming: mcr=0x5980000f ctrl=0x0e312055
[ 4177.654112] flexcan 2090000.flexcan can0: flexcan_chip_start: writing mcr=0x7de20209
[ 4177.654133] flexcan 2090000.flexcan can0: flexcan_chip_start: writing ctrl=0x0e312055
[ 4177.654211] flexcan 2090000.flexcan can0: flexcan_chip_start: reading mcr=0x64e20209 ctrl=0x0e31ec55
[ 4177.663267] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

Well, if I do:

root@colibri-imx6:~# cansend can0 -i 0x1F   0x11 0x22 0x33 0x44 0x55 0x55 0x77 0x88
interface = can0, family = 29, type = 3, proto = 1

and the dmesg message are:

[ 4275.460024] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460186] flexcan 2090000.flexcan can0: New error state: 2
[ 4275.460222] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460351] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460528] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460733] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460944] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461163] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461367] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461568] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461810] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461998] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462207] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462429] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462629] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462833] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.463029] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.463240] flexcan 2090000.flexcan can0: New error state: 3
[ 4275.463264] flexcan 2090000.flexcan can0: bus-off
[ 4275.463323] flexcan 2090000.flexcan can0: BIT0_ERR irq
root@colibri-imx6:~# 

With the oscilloscope on SODIMM55, I see the TX level going down and high,
but nothing appear in the output of “candump can0”.
Relaunching the previous command, nothing appears on oscilloscope, and noting else in the dmesg output.

Someone have some idea?
Thank you.
F.

these are the modifications in imx6qdl-colibri.dtsi :

	flexcan1 {
		pinctrl_flexcan1: flexcan1grp {
			fsl,pins = <
/* -				MX6QDL_PAD_GPIO_7__FLEXCAN1_TX   0x80000000 */
/* -				MX6QDL_PAD_GPIO_8__FLEXCAN1_RX   0x80000000 */
                MX6QDL_PAD_GPIO_7__FLEXCAN1_TX   PAD_CTRL_HYS_PU
                MX6QDL_PAD_GPIO_8__FLEXCAN1_RX   PAD_CTRL_HYS_PU
			>;
		};
		pinctrl_flexcan2: flexcan2grp {
			fsl,pins = <
/* -				MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x80000000 */
/* -				MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x80000000 */
                MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX   PAD_CTRL_HYS_PU 
                MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX   PAD_CTRL_HYS_PU 
			>;
		};
	};

	gpio {
		pinctrl_gpio_1: gpio-1 {
			fsl,pins = <
				MX6QDL_PAD_EIM_D27__GPIO3_IO27      PAD_CTRL_HYS_PU
				MX6QDL_PAD_NANDF_D6__GPIO2_IO06     PAD_CTRL_HYS_PU
				MX6QDL_PAD_NANDF_D3__GPIO2_IO03     PAD_CTRL_HYS_PU
				MX6QDL_PAD_ENET_REF_CLK__GPIO1_IO23 PAD_CTRL_HYS_PU
				MX6QDL_PAD_DI0_PIN4__GPIO4_IO20     PAD_CTRL_HYS_PU
				MX6QDL_PAD_SD4_DAT3__GPIO2_IO11     PAD_CTRL_HYS_PU
				MX6QDL_PAD_NANDF_D4__GPIO2_IO04     PAD_CTRL_HYS_PU
				MX6QDL_PAD_SD4_DAT0__GPIO2_IO08     PAD_CTRL_HYS_PU
			>;
		};
		pinctrl_gpio_2: gpio-2 {
			fsl,pins = <
//				MX6QDL_PAD_GPIO_7__GPIO1_IO07       PAD_CTRL_HYS_PU
//				MX6QDL_PAD_GPIO_8__GPIO1_IO08       PAD_CTRL_HYS_PU
			>;
		};
	};

And the modifications made in imx6dl-colibri-v3.dts:

/* CAN */
&can1 {
    status="okay";
};

&can2 {
    status="disabled";
};
/* Colibri SPI */
&ecspi4 {
	status = "okay";

	mcp258x0: mcp258x@1 {
		compatible = "microchip,mcp2515";
		reg = <0>;
		clocks = <&clk16m>;
		interrupt-parent = <&gpio3>;
		interrupts = <27 0x2>;
		spi-max-frequency = <10000000>;
		status = "disabled";
	};
    
	spidev0: spidev@1 {
		compatible = "toradex,evalspi";
		reg = <0>;
		spi-max-frequency = <23000000>;
		status = "okay";
	};
    
    
    spidev1: spidev@2 {
        compatible = "toradex,evalspi";
        reg = <1>;
        spi-max-frequency = <23000000>;
        status = "okay";
    };
};

[... CUT... ]

&iomuxc {
	/*
	 * Mux all pins which are unused to be GPIOs
	 * so they are ready for export to user space
	 */
	pinctrl-names = "default";
	pinctrl-0 = <
		&pinctrl_weim_gpio_1 &pinctrl_weim_gpio_2
		&pinctrl_weim_gpio_3 &pinctrl_weim_gpio_4
/* -		&pinctrl_weim_gpio_5 &pinctrl_weim_gpio_6 */
        &pinctrl_weim_gpio_5  /* + */
		&pinctrl_csi_gpio_1
		&pinctrl_gpio_1
/*		&pinctrl_gpio_2  */
		&pinctrl_usbh_oc_1 &pinctrl_usbc_id_1
	>;

	gpio {
		pinctrl_pcap_1: pcap-1 {
			fsl,pins = <
				MX6QDL_PAD_GPIO_9__GPIO1_IO09	PAD_CTRL_HYS_PU /* SODIMM 28 */
				MX6QDL_PAD_SD4_DAT2__GPIO2_IO10	PAD_CTRL_HYS_PU /* SODIMM 30 */
			>;
		};

You need at least two can devices on the bus for a transmission to complete, since the transmitter checks for an ACK of the sent packet. If no such ACK is received, the transmitter will re-transmit a few times and then give up entering BUS-OFF state. If you just try to transmit your message a second time, the transmitter will still be in OFF state.

Hi @Mane, @steff made a good remark about the CAN communication. Is the transceiver on the colibri evaluation board connected to any other CAN device or not?