Regarding can interface in imx6q sabresd

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

Regarding can interface in imx6q sabresd

2,176 Views
shalinikp
Contributor II

HI,

      I have enabled CAN interface on imx6q EVB. Able to see CAN interfaces "can0" and "can1".  I have also configured gpio pins. But when I connect CANoe to the board and send messages using "cansend" there is not data recieved at CANoe. PLease help.  Are there any jumper settings on the board ?

List of commands I'm executing.

echo 101 > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio101/direction

echo 0 > /sys/class/gpio/gpio101/value

ip link set can0 up

ip link set can0 type can bitrate 500000

cansend can0 500#1E.10.10

Commands are successful. Configured same baud rates at both the ends. But not able to recieve/transfer data.

Request help on yhis.

Regards

Shalini

Tags (3)
7 Replies

1,292 Views
shivanipatel
Senior Contributor II

Hi,

Please follow below mentioned steps to enable the CAN interface on i.MX6Q SABRESD board.

  • Populate R662 Register to stabilize CANH and CANL output signals.

imx6q_canbus.png

  • Pin connection of CAN interface with i.MX6Q Processor is shown as below.

imx6q.png

  • CAN_TX:
    • CAN_TX signal is connected between i.MX6Q Processor and CAN transceiver pin 1.
    • CAN_TX pin is GPIO_7 of P5 port of i.MX6Q Processor.
    • CAN_TX pin is defined as MX6QDL_PAD_GPIO_7__FLEXCAN1_TX Macro in i.MX6Q SABRESD Board DTS.
  • CAN_RX:
    • CAN_RX signal is connected between i.MX6Q Processor and CAN transceiver pin 4.
    • CAN_RX pin is GPIO_8 of P5 port of i.MX6Q Processor.
    • CAN_RX pin is defined as MX6QDL_PAD_GPIO_8__FLEXCAN1_RX Macro in i.MX6Q SABRESD Board DTS.
  • CANL_STBY:
    • CAN_STBY signal is connected between i.MX6Q Processor and CAN transceiver pin 8.
    • CAN_STBY pin is GPIO_19 of P5 port of i.MX6Q Processor.
    • CAN_STBY pin is defined as MX6QDL_PAD_GPIO_19__GPIO4_IO05 Macro in Macro in i.MX6Q SABRESD Board DTS.

  • Apply following changes in i.MX6Q SABRESD kernel source DTS file.
CAN interface Patch
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -137,6 +137,19 @@
             gpio = <&gpio6 14 0>;
             enable-active-high;
         };
+
+        reg_can_xcvr: regulator@6 {
+
+            compatible = "regulator-fixed";
+            reg = <5>;
+            regulator-name = "CAN XCVR";
+            regulator-min-microvolt = <3300000>;
+            regulator-max-microvolt = <3300000>;
+            pinctrl-names = "default";
+            gpio = <&gpio4 5 GPIO_ACTIVE_HIGH>;
+            enable-active-low;
+        };    
+
     };
 
     gpio-keys {
@@ -608,6 +621,14 @@
         interrupt-parent = <&gpio3>;
         interrupts = <16 1>;
     };
+
+    max7310_b: gpio@32 {
+        compatible = "maxim,max7310";
+        reg = <0x32>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
 };
 
 &iomuxc {
@@ -700,6 +721,16 @@
             >;
         };
 
+
+        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
@@ -1064,3 +1095,11 @@
     fsl,wdog_b;
     status = "okay";
 };
+
+&can1 {
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_flexcan1>;
+    xceiver-supply = <&reg_can_xcvr>;
+    status = "okay"; /* pin conflict with fec */
+};

After applying these modification, run following commands on i.MX6Q SABRESD Board terminal,

$ ip link set can0 up

$ ip link set can0 type can bitrate 500000

$ cansend can0 123#DEADBEEF

The CAN bus data captured in CAN analyzer between CANH (pin-7) and GND (pin-2) is shown as below:

canbus_pico.png

Regards,

Shivani.

1,292 Views
idriver
Contributor I

Hi,

   I got this result like you, can you tell me how to resolve the question.

0 Kudos

1,292 Views
igorpadykov
NXP Employee
NXP Employee

Hi Shalini

please look at

How to enable CAN bus on i.MX6Q SabreSD

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,292 Views
shalinikp
Contributor II

Hi,

    I'm using LINUX KERNEL 3.14.28. M not using LTIB. I'm using buildroot.  IN linux kernel 3.14.28, there is no folder mach-mx6 and also there is no "bard-mx6q_sabresd.h". PLease help.

0 Kudos

1,292 Views
igorpadykov
NXP Employee
NXP Employee

please use sabre-ai configuration, sabre sd by default does not

support can.

0 Kudos

1,292 Views
shalinikp
Contributor II

Hi,

    Thanks for the reply. I have configured flex can drivers in linux kernel and compiled. There is no issue at driver level. BUt not able to send/recieve data. I doubt if there are any other GPIO settings.

0 Kudos

1,292 Views
amit251291
Contributor IV

Hi shalini, 

Were you able to solve this issue ? 
If yes, please let us know how. We are also facing the same issue.

0 Kudos