Difference between revisions of "DESK-MX6UL-L/Peripherals/CAN"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{subst:Peripheral | nome-som=AXEL Lite | nome-peripheral = CAN}}")
 
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<section begin=History/>
+
<section begin="History" />
 
{| style="border-collapse:collapse; "
 
{| style="border-collapse:collapse; "
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
+
! colspan="4" style="width:100%; text-align:left" ; border-bottom:solid 2px #ededed" |History
 
|-  
 
|-  
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Version
+
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Issue Date
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
+
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Notes
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|X.Y.Z
+
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |{{oldid|14243|2021/07/20}}
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
+
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |First DESK-MX6UL-L release
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
 
 
|-
 
|-
 +
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |{{oldid|16322|2022/03/16}}
 +
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |DESK-MX6UL-L 3.0.0 release
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|[TBD_link X.Y.Z]
+
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |2023/05/04
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
+
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX6UL-L 4.0.0 release
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
+
 
|-
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
 
|-
 
|-
 
|}
 
|}
<section end=History/>
+
<section end="History" />
<section begin=Body/>
+
<section begin="Body" />
  
 
==Peripheral CAN ==
 
==Peripheral CAN ==
 
+
{{ImportantMessage|text=The CAN peripheral is not available on [[AXEL_ULite_SOM/AXEL_ULite_Evaluation_Kit | AXEL ULite EVK]]. This peripheral is available on the i.MX6UL standard product [[SBC_Lynx_SBC | SBCLynx]]}}
''TBD: sostituire tutti i dump con le informazioni sull'uso della periferica''
 
  
 
=== Device tree configuration ===
 
=== Device tree configuration ===
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
+
Here below an example of device tree configuration used on standard DAVE's kit for the [[AXEL ULite SOM]]:
  
From <code>''carrier.dts''</code>:
+
From <code>imx6ul-lynx-som0013-cb002f.dts</code>:
  
 
<pre>
 
<pre>
 
&can1 {
 
&can1 {
 
     pinctrl-names = "default";
 
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_flexcan1_axel>;
+
     pinctrl-0 = <&pinctrl_flexcan1>;
 
     status = "okay";
 
     status = "okay";
 
};
 
};
 
</pre>
 
</pre>
  
From <code>''carrier-common.dtsi''</code>:
+
From <code>imx6ul-lynx-som0013.dtsi</code>:
  
 
<pre>
 
<pre>
    can1 {
+
&iomuxc {
         pinctrl_flexcan1_axel: flexcan1axelgrp-1 {
+
         pinctrl-names = "default";
             fsl,pins = <
+
        pinctrl-0 = <&pinctrl_hog_gpios>;
                MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x80000000
+
 
                MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x80000000
+
        imx6ul-lynx {
            >;
+
...
        };
+
...
    };
+
             pinctrl_flexcan1: flexcan1grp{
 +
                    fsl,pins = <
 +
                            MX6UL_PAD_LCD_DATA09__FLEXCAN1_RX      0x1b020
 +
                            MX6UL_PAD_LCD_DATA08__FLEXCAN1_TX      0x1b020
 +
                    >;
 +
            };
 +
};
 
</pre>
 
</pre>
  
Line 60: Line 61:
 
...
 
...
 
...
 
...
[    1.807495] flexcan 2090000.flexcan: 2090000.flexcan supply xceiver not found, using dummy regulator
+
[    3.047454] can: controller area network core
[    1.817366] flexcan 2090000.flexcan: device registered (reg_base=c0a30000, irq=31)
+
[    3.057221] can: raw protocol
 +
[    3.069417] can: broadcast manager protocol
 +
[    3.073846] can: netlink gateway - max_hops=1
 
...
 
...
 
...
 
...
[    3.952659] can: controller area network core (rev 20170425 abi 9)
 
[    3.963413] can: raw protocol (rev 20170425)
 
[    3.967717] can: broadcast manager protocol (rev 20170425 t)
 
[    3.973397] can: netlink gateway (rev 20170425) max_hops=1
 
 
</pre>
 
</pre>
  
 
====Enable the interface and check status====
 
====Enable the interface and check status====
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000
+
root@desk-mx6ul-lynx:~# ip link set can0 type can bitrate 500000
root@imx6qxelk:~# ifconfig can0 up
+
root@desk-mx6ul-lynx:~# ifconfig can0 up
root@imx6qxelk:~# ifconfig can0
+
root@desk-mx6ul-lynx:~# ifconfig can0
can0     Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
+
can0: flags=193<UP,RUNNING,NOARP> mtu 16
          UP RUNNING NOARP MTU:16 Metric:1
+
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10 (UNSPEC)
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
+
        RX packets 0 bytes 0 (0.0 B)
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
+
        RX errors 0 dropped 0 overruns 0 frame 0
          collisions:0 txqueuelen:10
+
        TX packets 0 bytes 0 (0.0 B)
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
+
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
          Interrupt:31
+
        device interrupt 33
 
 
root@imx6qxelk:~#
 
 
</pre>
 
</pre>
  
 
==== Usage with [https://github.com/linux-can/can-utils can-utils] ====
 
==== Usage with [https://github.com/linux-can/can-utils can-utils] ====
 
''TBD: reference verso eventuali informazioni sul web''
 
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000 triple-sampling on
+
root@desk-mx6ul-lynx:~# ip link set can0 type can bitrate 500000 triple-sampling on loopback on
root@imx6qxelk:~# ifconfig can0 up
+
root@desk-mx6ul-lynx:~# ifconfig can0 up
root@imx6qxelk:~# cansend can0 128#1122334455667788
+
root@desk-mx6ul-lynx:~# candump can0 &
root@imx6qxelk:~# candump can0
+
[1] 291
  can0 128  [8] 11 22 33 44 55 66 77 88
+
interface = can0, family = 29, type = 3, proto = 1
root@imx6qxelk:~#
+
root@desk-mx6ul-lynx:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
 +
interface = can0, family = 29, type = 3, proto = 1
 +
<0x7ff> [8] 00 01 02 03 04 05 06 07
 +
<0x7ff> [8] 00 01 02 03 04 05 06 07
 
</pre>
 
</pre>
  
Line 102: Line 100:
 
Each CAN port appears like a networking interface in the form <code>canX</code> where <b><i>X</i></b> is the port number.  
 
Each CAN port appears like a networking interface in the form <code>canX</code> where <b><i>X</i></b> is the port number.  
  
Information about programming the CAN socket interface is given in the kernel tree under ''Documentation/networking/can.txt''
+
Information about programming the CAN socket interface is given in the kernel tree under ''Documentation/networking/can.rst''
<section end=Body/>
+
<section end="Body" />
 
 
 
----
 
----
  
[[Category:AXEL Lite]]
+
[[Category:AXEL ULite]]

Latest revision as of 17:58, 11 January 2024

History
Issue Date Notes

2021/07/20

First DESK-MX6UL-L release

2022/03/16

DESK-MX6UL-L 3.0.0 release
2023/05/04 DESK-MX6UL-L 4.0.0 release


Peripheral CAN[edit | edit source]

200px-Emblem-important.svg.png

The CAN peripheral is not available on AXEL ULite EVK. This peripheral is available on the i.MX6UL standard product SBCLynx

Device tree configuration[edit | edit source]

Here below an example of device tree configuration used on standard DAVE's kit for the AXEL ULite SOM:

From imx6ul-lynx-som0013-cb002f.dts:

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

From imx6ul-lynx-som0013.dtsi:

&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog_gpios>;

        imx6ul-lynx {
...
...
            pinctrl_flexcan1: flexcan1grp{
                    fsl,pins = <
                            MX6UL_PAD_LCD_DATA09__FLEXCAN1_RX       0x1b020
                            MX6UL_PAD_LCD_DATA08__FLEXCAN1_TX       0x1b020
                    >;
            };
};

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

...
...
[    3.047454] can: controller area network core
[    3.057221] can: raw protocol
[    3.069417] can: broadcast manager protocol
[    3.073846] can: netlink gateway - max_hops=1
...
...

Enable the interface and check status[edit | edit source]

root@desk-mx6ul-lynx:~# ip link set can0 type can bitrate 500000
root@desk-mx6ul-lynx:~# ifconfig can0 up
root@desk-mx6ul-lynx:~# ifconfig can0
can0: flags=193<UP,RUNNING,NOARP>  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 33

Usage with can-utils[edit | edit source]

root@desk-mx6ul-lynx:~# ip link set can0 type can bitrate 500000 triple-sampling on loopback on
root@desk-mx6ul-lynx:~# ifconfig can0 up
root@desk-mx6ul-lynx:~# candump can0 &
[1] 291
interface = can0, family = 29, type = 3, proto = 1
root@desk-mx6ul-lynx:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07 
interface = can0, family = 29, type = 3, proto = 1
<0x7ff> [8] 00 01 02 03 04 05 06 07 
<0x7ff> [8] 00 01 02 03 04 05 06 07

Additional information[edit | edit source]

Each CAN port appears like a networking interface in the form canX where X is the port number.

Information about programming the CAN socket interface is given in the kernel tree under Documentation/networking/can.rst