The toolbox provides basic blocks for sending and receiving CAN messages for ERT Linux Simulink target when mainlined socket based CAN bus support is used. The cantransmit and canreceive blocks support directly encapsulation and conversion to the Simulink signals for basic data types: uint8, uint16 and uint32. The standard Simulink defined CAN MESSAGE TYPE can be used when more complex structure of CAN message sending and receiption is required. The signal of CAN MESSAGE TYPE can be connected to CAN Pack and CAN Unpack blocks which encode or retrieve multiple signals to/from CAN message. The CAN Pack and CAN Unpack blocks are provided by canmsglib which is part of standard Simulink distribution.

The code generation requires to include CAN Setup into diagram to work correctly. This block is used to setup baudrate for each CAN channel in the embedded environment but this option is ignored in the actual setup block implementation on Linux. The baudrate can be selected by system administrator from commandline

ip link set can0 down
ip link set can0 type can bitrate 1000000 
ip link set can0 down
or on Debian based systems /etc/network/interfaces configuration file can be used to setup CAN interface baudrate at system startup
allow-hotplug can0
iface can0 can static
    bitrate 1000000
The later setup works automatic even with CAN-USB converter hotplug.

Linux CAN bus toolbox repository
http://rtime.felk.cvut.cz/gitweb/socketcan-simulink.git
git clone git://rtime.felk.cvut.cz/socketcan-simulink.git