• Register
    • Login
    • Search
    • Recent
    • Wiki
    • Github
    • 百度网盘
    • Onedrive
    • Official
    • Shop

    CAN bus testing tools and commands

    Pi 4B
    1
    1
    196
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      george last edited by

      Test tools

      Canutils is a commonly used CAN communication testing toolkit that includes five independent programs: canconfig, candump, canecho, cansend, and cansequence. The functions of these programs are briefly described as follows:

      • canconfig
        The parameters used to configure the CAN bus interface mainly include baud rate and mode.

      • candump
        Receive data from the CAN bus interface and print it in hexadecimal format to standard output, or output it to a specified file.

      • canecho
        Resend all data received from the CAN bus interface to the CAN bus interface.

      • cansend
        Send the specified data to the specified CAN bus interface.

      • cansequence
        Automatically repeat the increment number to the specified CAN bus interface, or specify the receive mode and verify the received increment number.

      • ip
        Configuration of CAN baud rate, functions, etc.

      Common commands

      • Query current network devices:
      ifconfig -a
      
      • CAN start:
      ip link set can0 down  //Close CAN
      ip link set can0 type can bitrate 500000 //Set bit rate of 500KHz:
      ip -details -statistics link show can0 //Print can0 information:
      ip -details -statistics link show can0 //Start CAN:
      
      • CAN sending:

      Send (standard frame, data frame, ID: 123, date: DEADBEEF):

      cansend can0 123#DEADBEEF
      

      Sending (standard frame, remote frame, ID: 123):

      cansend can0 123#R
      

      Send (extended frame, data frame, ID: 0000123, date: DEADBEEF):

      cansend can0 00000123#12345678
      

      Sending (extended frame, remote frame, ID: 0000123):

      cansend can0 00000123#R
      
      • CAN reception:

      Start printing and wait for reception:

      candump can0
      
      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post