主要内容

Configure SocketCAN Block Interface for Real-Time Linux Support Package

R2026b

To set up the CAN interface on the Linux target device, you need sudo privileges. Consider requesting system admin help to set up the interface.

  1. Set up the bitrate for CAN interface (canX, where X could be 0,1,2, etc.). Specify the data bus speed with bitrate and specify other parameters. From the Linux target device command line, use this command:

    sudo ip link set canX type can bitrate 500000
  2. To bring the channel online, use command:

    sudo ip link set up canX
  3. To bring the channel offline, use command:

    sudo ip link set down canX

For information, see The Virtual CAN Driver.