Difference between revisions of "UCM-iMX95 Yocto Linux: CAN"

From Compulab Mediawiki
Jump to: navigation, search
(Created page with "=CAN bus= CAN bus interface is available on the evaluation board on header '''P17'''.<br> CAN bus on-board termination can be enabled by shorting jumper '''E6'''.<br> For more...")
 
 
Line 1: Line 1:
 
=CAN bus=
 
=CAN bus=
 
CAN bus interface is available on the evaluation board on header '''P17'''.<br>
 
CAN bus interface is available on the evaluation board on header '''P17'''.<br>
CAN bus on-board termination can be enabled by shorting jumper '''E6'''.<br>
 
 
For more details, please refer to the [[UCM-iMX95:_Evaluation_Kit:_Hardware_Guide#CAN_bus|Hardware Guide]]
 
For more details, please refer to the [[UCM-iMX95:_Evaluation_Kit:_Hardware_Guide#CAN_bus|Hardware Guide]]
==CAN interface configuration==
+
==Operation Example==
* To test it you will need another board with CAN IF
+
* Obtain another board with CAN  
 +
* Short jumper E6
 +
* Connect:
 +
<pre>
 +
DUT                    Device 2
 +
CAN_H (pin 2) --------  CAN_H
 +
CAN_L (pin 6) --------  CAN_L
 +
</pre>
 
* Configure both CAN interface bit-rate to 1 Mbit/sec:
 
* Configure both CAN interface bit-rate to 1 Mbit/sec:
 
<pre>
 
<pre>
 
ip link set can0 up type can bitrate 1000000
 
ip link set can0 up type can bitrate 1000000
 
</pre>
 
</pre>
* On one system, dump all received data frames as well as error frames:
+
* On both system, listen to received data frames as well as error frames:
<pre>
+
candump any,0:0,#FFFFFFFF &
candump any,0:0,#FFFFFFFF
 
 
 
  can0  111  [8]  11 22 33 44 55 66 77 88
 
  can0  11111111  [8]  11 22 33 44 55 66 77 88
 
...
 
  can0  03FF0983  [8]  D7 61 FF 03 C1 F7 C1 34
 
  can0  19C34D32  [8]  F7 5A C2 73 AD 0E 3F 0B
 
  can0  0675E391  [4]  2B 2D D3 49
 
  can0  13091C55  [8]  99 32 EC 77 27 81 49 0B
 
  can0  098D67CF  [8]  22 50 AB 48 AD 7F F4 26
 
  can0  05263FEC  [5]  1B 4C 02 45 6E
 
  can0  12B30E20  [0]
 
  can0  1F193DF9  [1]  C5
 
  can0  1EB0B18F  [8]  3E 3F DA 57 C2 FE 73 58
 
  can0  1E5C64D9  [5]  6F 0D B3 63 6A
 
  can0  1E1DE3F9  [8]  96 48 AC 79 4E 00 27 71
 
  can0  0E1A11B7  [8]  75 81 70 7C 86 79 A7 77
 
  can0  05F8FD8B  [7]  33 F9 9B 1E 77 3D 1F
 
  can0  1E155FCD  [8]  E6 BA F8 58 ED 6D C8 10
 
  can0  1D91DF9E  [8]  5D 29 82 7B 97 1D AB 5C
 
  can0  11FB3CDA  [3]  14 65 C3
 
  can0  091352C0  [2]  2C ED
 
...
 
</pre>
 
 
 
On second system:
 
* Send standard CAN frame:
 
<pre>
 
cansend can0 111#1122334455667788
 
</pre>
 
 
 
* Send extended CAN frame:
 
<pre>
 
cansend can0 11111111#1122334455667788
 
</pre>
 
  
* CAN frames (extended mode) generator, random payload, interval between two successive flames 50 msec:
+
* Send data from one system and expect to receive it on the other:
<pre>
+
:* Standard frame:
cangen -g 50 -e -D r -v can0
+
cansend can0 111#1122334455667788
 
+
:* Extended frame:
can: raw protocol (rev 20170425)
+
cansend can0 11111111#1122334455667788
...
+
:* Generate 50 random extended frames with 50 msec interval between each:
  can0  03FF0983#D7.61.FF.03.C1.F7.C1.34
+
cangen -g 50 -e -D r -v can0 -n 50
  can0  19C34D32#F7.5A.C2.73.AD.0E.3F.0B
+
* Disable the interfaces:
  can0  0675E391#2B.2D.D3.49
+
  ip link set can0 down
  can0  13091C55#99.32.EC.77.27.81.49.0B
 
  can0  098D67CF#22.50.AB.48.AD.7F.F4.26
 
  can0  05263FEC#1B.4C.02.45.6E
 
  can0  12B30E20#
 
  can0  1F193DF9#C5
 
  can0  1EB0B18F#3E.3F.DA.57.C2.FE.73.58
 
  can0  1E5C64D9#6F.0D.B3.63.6A
 
  can0  1E1DE3F9#96.48.AC.79.4E.00.27.71
 
  can0 0E1A11B7#75.81.70.7C.86.79.A7.77
 
  can0 05F8FD8B#33.F9.9B.1E.77.3D.1F
 
  can0  1E155FCD#E6.BA.F8.58.ED.6D.C8.10
 
  can0  1D91DF9E#5D.29.82.7B.97.1D.AB.5C
 
  can0  11FB3CDA#14.65.C3
 
  can0  091352C0#2C.ED
 
...
 
</pre>
 
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:Yocto]]
 
[[Category:Yocto]]
 
[[Category:UCM-iMX95]]
 
[[Category:UCM-iMX95]]

Latest revision as of 10:05, 19 February 2025

CAN bus

CAN bus interface is available on the evaluation board on header P17.
For more details, please refer to the Hardware Guide

Operation Example

  • Obtain another board with CAN
  • Short jumper E6
  • Connect:
DUT                     Device 2
CAN_H (pin 2) --------  CAN_H
CAN_L (pin 6) --------  CAN_L
  • Configure both CAN interface bit-rate to 1 Mbit/sec:
ip link set can0 up type can bitrate 1000000
  • On both system, listen to received data frames as well as error frames:
candump any,0:0,#FFFFFFFF &
  • Send data from one system and expect to receive it on the other:
  • Standard frame:
cansend can0 111#1122334455667788
  • Extended frame:
cansend can0 11111111#1122334455667788
  • Generate 50 random extended frames with 50 msec interval between each:
cangen -g 50 -e -D r -v can0 -n 50
  • Disable the interfaces:
ip link set can0 down