Difference between revisions of "ASR-A501 CAN/DEBUG"

From ESS-WIKI
Jump to: navigation, search
(Send and Reveive Data)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
 +
=== '''Hardware pin definition:''' ===
  
 
[[File:ASR-A501 can debug.png|RTENOTITLE]]
 
[[File:ASR-A501 can debug.png|RTENOTITLE]]
Line 22: Line 24:
 
=== '''CAN(2 * CAN FD(5M))''' ===
 
=== '''CAN(2 * CAN FD(5M))''' ===
  
 
+
ASR-A501 has two CAN ports.
 +
 
 +
Use the “candump” and “cansend” tools directly to send and receive messages. The tools have been embedded into the system.
 +
 
 +
==== '''Check network ports''' ====
 +
 
 +
Check network ports of can0 and can1:
 +
<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>
  
&nbsp;
+
See more details of the usage of “candump” and “cansend”&nbsp;:
 +
<pre># candump --help
 +
# cansend --help</pre>
  
&nbsp;
+
[[File:ASR-A501 CAN.png|RTENOTITLE]]

Latest revision as of 03:31, 25 June 2025

Hardware pin definition:

RTENOTITLE

DEBUG Port Connection:

1. Connect the debug port cable (1700035538-01) to the Debug port on ASRA501.

2. Connect it to your PC using the USB to RS-232 Cable.

Debug Port Settings:

ASR-A501 can communicate with a host server using serial cables. Common serial communication programs such as HyperTerminal, Tera Term, or PuTTY can be used in these applications. The example below describes the serial terminal setup using HyperTerminal on a Windows host:

1. Connect ASR-A501 with your PC using a serial cable.

2. Open HyperTerminal on your Windows PC, and select the settings demonstrated in the photo below.

RTENOTITLE

3. Insert power adapter to DC jack and power up the board. The Debug console log will be displayed on the terminal screen.

CAN(2 * CAN FD(5M))

ASR-A501 has two CAN ports.

Use the “candump” and “cansend” tools directly to send and receive messages. The tools have been embedded into the system.

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

See more details of the usage of “candump” and “cansend” :

# candump --help 
# cansend --help

RTENOTITLE