How to use CAN Bus on Aster Carrier Board with Colibri iMX6DL

Hi,

I’m trying to use the CAN bus on a Colibri iMX6DL connected to an Aster Carrier Board.

I’ve modified the device tree according to the [CAN (Linux)][1] article.

Checking the Colibri iMX6DL datasheet, it says that the pins for CAN0 are 55 (TX) and 63 (RX), and these pins are connected to the Aster pins X17.8 and X18.1 respectively.

I’ve edited the device tree making the below modifications:

diff --git a/arch/arm/boot/dts/imx6dl-colibri-aster.dts b/arch/arm/boot/dts/imx6dl-colibri-aster.dts
index ee0569efb711..3c1aa98efcdd 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-aster.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-aster.dts
@@ -81,6 +81,14 @@
status = "okay";
 };

+&can1 {
+       status = "okay";
+};
+
+&can2 {
+       status = "okay";
+};
+
 &ecspi4 {
fsl,spi-num-chipselects = <2>;
cs-gpios = <
@@ -145,10 +153,9 @@
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
    >;

The problem is: we hooked up a logic analyzer on the TX/RX pins in the Aster pin header, but there is no output.

I’d like to know if there is anything else to be changed to make this work.

Another question is about CAN1. This CAN bus is available on SODIMM pins 188/178 on the Colibri iMX6DL, but only the pin 188 is exposed in the Aster Carrer Board (X20.35). So it’s not possible use CAN1 on the Aster?

Thanks in advance.
[1]: CAN (Linux)

Hi

I don’t see anything wrong in your changes.

  • Are there any indication in dmesg output, e.g. that pinmuxing failed?
  • I assume you did not attach a CAN transceiver. What happens if you pull the flexcan RX to 1 respectively 0 and try again to send?
  • Did you try all can network interfaces reported by e.g. ‘ip -br link show’?

The FLEXCAN2_TX signal is only available on SODIMM 178, you need access to that pin to use the second flexcan controller.

Max

Hi Max,

Are there any indication in dmesg output, e.g. that pinmuxing failed?

See below the dmesg output after running ip link set can0 up type can bitrate 500000 and ifconfig can0 up :

root@colibri-imx6:~# dmesg | grep can
[    0.140777] i2c i2c-1: can't use DMA
[    0.141457] i2c i2c-2: can't use DMA
[    1.256063] vcan: Virtual CAN interface driver
[    1.294377] 2090000.flexcan supply xceiver not found, using dummy regulator
[    1.303977] flexcan 2090000.flexcan: device registered (reg_base=a09f0000, irq=33)
[    1.315197] 2094000.flexcan supply xceiver not found, using dummy regulator
[    1.324841] flexcan 2094000.flexcan: device registered (reg_base=a09f8000, irq=34)
[    2.157468] snvs-secvio 20cc000.caam-snvs: can't get snvs clock
[    2.315839] can: controller area network core (rev 20120528 abi 9)
[    2.330320] can: raw protocol (rev 20120528)
[    2.336524] can: broadcast manager protocol (rev 20120528 t)
[    2.344161] can: netlink gateway (rev 20130117) max_hops=1
[ 2313.152306] flexcan 2090000.flexcan can0: writing ctrl=0x03292005
[ 2313.158763] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

I assume you did not attach a CAN transceiver. What happens if you pull the flexcan RX to 1 respectively 0 and try again to send?

Nothing happens in the TX output on the logic analyzer.

Did you try all can network interfaces reported by e.g. ‘ip -br link show’?

root@colibri-imx6:~# ip -br link show
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
can0             DOWN           <NO-CARRIER,NOARP,UP,ECHO> 
can1             DOWN           <NOARP,ECHO> 
eth0             DOWN           00:14:2d:4a:4e:60 <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> 
usb0             DOWN           00:14:2d:ff:ff:ff <NO-CARRIER,BROADCAST,MULTICAST,UP> 

Thanks for your help!

Could you share the complete dmesg log please? Thanks.

Hi Jaski,

See below:
dmesg_log

Thanks.

Thanks for the log. Did you disable the mcp251x, since you are using flexcan?

[    1.346612] vcan: Virtual CAN interface driver
[    1.352995] CAN device driver interface
[    1.368939] mcp251x spi3.0: Cannot initialize MCP2515. Wrong wiring?
[    1.377254] mcp251x spi3.0: Probe failed, err=19

Hi Jaski,

Even with the MCP251x disabled it didn’t work, see below logs:

dmesg_log

zcat:

root@colibri-imx6:~# zcat /proc/config.gz | grep CONFIG_CAN_MCP251X
# CONFIG_CAN_MCP251X is not set

ip -br link show:

root@colibri-imx6:~# ip -br link show
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
can0             DOWN           <NO-CARRIER,NOARP,UP,ECHO> 
can1             DOWN           <NOARP,ECHO> 
eth0             DOWN           00:14:2d:49:cd:33 <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> 
usb0             DOWN           00:14:2d:ff:ff:ff <NO-CARRIER,BROADCAST,MULTICAST,UP> 

hi @daniel_m.tx

For Colibri_iMX6, you need also to change the pinmuxing, since in Colibri Standard these pins are used as GPIOs. I changed to the following PinMuxing and it was working. @leo.tx, Maybe we should update the documentation too.

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
 >;
     };
};
@@ -474,8 +474,8 @@
};
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
+//MX6QDL_PAD_GPIO_7__GPIO1_IO07       PAD_CTRL_HYS_PU
+//MX6QDL_PAD_GPIO_8__GPIO1_IO08       PAD_CTRL_HYS_PU
  >;
       };
 };

Thanks for you help Jaski!

Everything is working now!

hello @daniel_m.tx,

could you please share the final working device tree? I’m also looking for the same solution.

thanks!

Hello @akabai!

Didn’t the changes Jaski mentioned above work?

Thanks.
Daniel