Difference between revisions of "AOM-3841 CAN FD(CAN0/1)"

From ESS-WIKI
Jump to: navigation, search
(Check Network Ports)
 
Line 54: Line 54:
 
|}
 
|}
 
<p style="text-align: justify;">[[File:AOM-DB3500 CAN0 1.jpg|RTENOTITLE]]&nbsp;&nbsp;[[File:AOM-DB3500 CAN0 1 Pin define.jpg]]</p>  
 
<p style="text-align: justify;">[[File:AOM-DB3500 CAN0 1.jpg|RTENOTITLE]]&nbsp;&nbsp;[[File:AOM-DB3500 CAN0 1 Pin define.jpg]]</p>  
 +
 
=== '''Check Network Ports''' ===
 
=== '''Check Network Ports''' ===
  
&nbsp;
+
Check network ports of can0 and can1:&nbsp;
 +
<pre># ifconfig -a
 +
… …
 +
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
 +
 
 +
can1: 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
 +
 
 +
… …
 +
</pre>
 +
 
 +
==== '''Configure''' ====
 +
 
 +
Use “ip” command to configure can port. See details of the usage of “ip link”:
 +
<pre># ip link help
 +
… …
 +
ip link set { DEVICE | dev DEVICE | group DEVGROUP }
 +
[ { up | down } ]
 +
[ type TYPE ARGS ]
 +
… …
 +
</pre>
 +
<pre># ip link help can
 +
… …
 +
ip link set DEVICE type can
 +
[ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
 +
[ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
 +
[ fd { on | off } ]
 +
… …
 +
</pre>
 +
 
 +
For example, set can0&nbsp;"birate rate” to 1000000 “dbitrate rate” to 2000000 “fd” to on
 +
<pre># #---- For can0 ----# #
 +
# ip link set can0 down
 +
# ip link set can0 type can bitrate 1000000 dbitrate 2000000 fd on
 +
# ip link set can0 up
 +
</pre>
 +
 
 +
=== '''Send and Reveive Data''' ===
 +
 
 +
*'''As receiver'''
 +
<pre># #---- As receiver ----# #
 +
# ip link set can0 down
 +
# ip link set can0 type can bitrate 1000000 dbitrate 2000000 fd on
 +
# ip link set can0 up
 +
# candump can0 &
 +
</pre>
 +
 
 +
*'''As sender'''
 +
<pre># #---- As sender ----# #
 +
# ip link set can1 down
 +
# ip link set can1 type can bitrate 1000000 dbitrate 2000000 fd on
 +
# ip link set can1 up
 +
# cansend can1 123##155
 +
 
 +
# #----If no error, the receiver will receive the following data----# #
 +
Can0 123 [01] 55</pre>

Latest revision as of 04:07, 24 March 2026

CAN FD

AOM-3841 has two CAN ports.
Use the “candump” and “cansend” tools directly to send and receive messages. The tools have been embedded into the system.

AOM-DB3500 CAN0_1 HW Pindefine

Pin Signal I/O Description
1 CAN0_D+ I/O CAN0 Data+
2 CAN0_D- I/O CAN0 Data-
3 CAN1_D+ I/O CAN1 Data+
4 CAN1_D- I/O CAN1 Data-
5 GND   Ground
6 GND   Ground
7 N/A   Not Applicable
8 N/A   Not Applicable

RTENOTITLE  AOM-DB3500 CAN0 1 Pin define.jpg

Check Network Ports

Check network ports of can0 and can1: 

# ifconfig -a
… …
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

can1: 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

… …

Configure

Use “ip” command to configure can port. See details of the usage of “ip link”:

# ip link help
… …
ip link set { DEVICE | dev DEVICE | group DEVGROUP }
[ { up | down } ]
[ type TYPE ARGS ]
… …
# ip link help can
… …
ip link set DEVICE type can
[ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
[ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
[ fd { on | off } ]
… …

For example, set can0 "birate rate” to 1000000 “dbitrate rate” to 2000000 “fd” to on

# #---- For can0 ----# #
# ip link set can0 down
# ip link set can0 type can bitrate 1000000 dbitrate 2000000 fd on
# ip link set can0 up

Send and Reveive Data

  • As receiver
# #---- As receiver ----# #
# ip link set can0 down
# ip link set can0 type can bitrate 1000000 dbitrate 2000000 fd on
# ip link set can0 up
# candump can0 &
  • As sender
# #---- As sender ----# #
# ip link set can1 down
# ip link set can1 type can bitrate 1000000 dbitrate 2000000 fd on
# ip link set can1 up
# cansend can1 123##155

# #----If no error, the receiver will receive the following data----# #
Can0 123 [01] 55