How to enable CAN Bus on MCIMX6QP-SDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to enable CAN Bus on MCIMX6QP-SDB

1,401 Views
liu_jialu
Contributor III

How to enable CAN Bus on MCIMX6QP-SDB with L4.1.15_2.0.0, i modifiled the code like below, but it still can't work.

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 04ad185..9d0ff77 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -295,6 +295,13 @@
     status = "okay";
 };
 
+&can1 {
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_flexcan1>;
+    can-stby-gpio = <&gpio4 5 GPIO_ACTIVE_LOW>;
+    status = "okay";
+};
+
 &cpu0 {
     arm-supply = <&sw1a_reg>;
     soc-supply = <&sw1c_reg>;
@@ -700,6 +707,14 @@
             >;
         };
 
+        pinctrl_flexcan1: flexcan1grp {
+            fsl,pins = <
+                MX6QDL_PAD_GPIO_7__FLEXCAN1_TX        0x1b0b0
+                MX6QDL_PAD_GPIO_8__FLEXCAN1_RX        0x1b0b0
+                MX6QDL_PAD_GPIO_19__GPIO4_IO05          0x1b0b0 /* CAN_STBY */
+            >;
+        };
+
         pinctrl_gpio_keys: gpio_keysgrp {
             fsl,pins = <
                 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x1b0b0

Labels (3)
0 Kudos
2 Replies

987 Views
igorpadykov
NXP Employee
NXP Employee

Hi 家禄

for device tree settings one can look in

linux/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
and example in imx6qdl-sabreauto.dtsi :
http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/tree/arch/arm/boot/dts/imx6qdl-sabreauto.dts...

For testing please refer to Chapter 37 FlexCAN Driver attached Linux Manual.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

987 Views
liu_jialu
Contributor III

according to the thread: Unable to send CAN frames on imx6dlsabresd ,it works for me, patch like this:

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 04ad185..7f10a64 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -130,6 +130,17 @@
             enable-active-high;
             hdmi-5v-supply = <&swbst_reg>;
         };
+        
+        reg_can_xcvr: regulator@6 {
+            compatible = "regulator-fixed";
+            reg = <6>;
+            regulator-name = "CAN XCVR";
+            regulator-min-microvolt = <3300000>;
+            regulator-max-microvolt = <3300000>;
+            pinctrl-names = "default";
+            gpio = <&gpio4 5 GPIO_ACTIVE_HIGH>;
+            enable-active-low;
+        };
 
         reg_mipi_dsi_pwr_on: mipi_dsi_pwr_on {
             compatible = "regulator-fixed";
@@ -295,6 +306,14 @@
     status = "okay";
 };
 
+&can1 {
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_flexcan1>;
+    xceiver-supply = <&reg_can_xcvr>;
+//    can-stby-gpio = <&gpio4 5 0>;
+    status = "okay";
+};
+
 &cpu0 {
     arm-supply = <&sw1a_reg>;
     soc-supply = <&sw1c_reg>;
@@ -700,6 +719,14 @@
             >;
         };
 
+        pinctrl_flexcan1: flexcan1grp {
+            fsl,pins = <
+                MX6QDL_PAD_GPIO_7__FLEXCAN1_TX        0x1b0b0
+                MX6QDL_PAD_GPIO_8__FLEXCAN1_RX        0x1b0b0
+                MX6QDL_PAD_GPIO_19__GPIO4_IO05          0x1b0b0
+            >;
+        };
+
         pinctrl_gpio_keys: gpio_keysgrp {
             fsl,pins = <
                 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x1b0b0

0 Kudos