Embedded Target for Motorola MPC555    
Vector CAN Configuration

Configure a Vector CAN channel (either hardware or virtual) for use with Vector-Informatik drivers

Library

Can Drivers (Vector)

Description

The Vector CAN Configuration block configures a CAN channel on the host PC, using the Vector CAN Driver. A CAN channel can be

The Vector CAN Driver software must be installed on your PC, regardless of whether you want to use virtual channels or actual hardware.

Place one Vector CAN Configuration block in the model for each CAN channel required.

You can use virtual channels to communicate between two separate Simulink models in the same MATLAB session, or between a CANalyser session and Simulink, or even between two Simulink models running in different sessions of MATLAB on the same machine. For an example of how this can be done see the mpc555rt_io and mpc555rt_iohost demos.

A Vector CAN Configuration block works in association with Vector CAN Transmit and Vector CAN Receive blocks. The association is formed by assigning the same values to the Tag parameter of all the blocks.

Setting the Baud Rate

The Vector CAN Configuration block lets you set the speed of the CAN channel connection.

In many cases you can avoid the complexities of CAN bit timing by selecting one of the Precalculated baud rate settings in the Block Parameters dialog box. We recommend using the precalculated baud rates wherever possible.

If the precalculated baud rates do not meet your requirements, you can select the Set bit timing parameters manually option. You can then set the baud rate by configuring the Baud rate prescaler, Synchronization jump width, Time segment 1, Time segment 2, and Sample mode parameters as described in this section.

The following variables are defined in calculating the baud rate for the Vector CAN Configuration block:

To set the baud rate, first derive values for prescaler, tseg1, and tseg2, using the following formulas:

  1. Number of time quanta per second qps = f /(2 * prescaler).
  2. Number of time quanta per bit time qpb = 1 + tseg1 + tseg2.
  3. Baud rate = (number of bit times per second) = qps / qpb.

Next, select values for the following parameters:

Finally, enter the values derived above into the block parameters:

As an example, the parameters used for the precalculated baud rate 500 kBaud were

For further information on the CAN, and on CAN bit timing, see the following documents, available at the CAN in Automation (CiA) Web site: http://www.can-cia.de

Dialog Box

Tag to identify this configuration
A unique identifier for naming a configured CAN channel. This tag is used to associate transmit and receive blocks with the configured channel.
Channel
Lets you select either a virtual channel (Virtual 1 or Virtual 2) or a supported hardware device.
If you have the required drivers installed, but no hardware device, you can use Virtual 1 or Virtual 2.
If you do not have the required drivers installed, select None. This allows you to use the block in simulation, even without the required driver or hardware installed. If you select a hardware device and the driver detects that you do not have the requested hardware installed, the block will report an error during simulation.
Precalculated baud rate
This parameter sets the speed of your channel connection. If none of the precalculated baud rates meets your requirements, you can select the Set bit timing parameters manually option.
Set bit timing parameters manually
Select this option if you want to program the CAN bit timing values yourself. See Setting the Baud Rate for details.
Baud rate prescaler
Synchronization jump width
Time segment 1
Time segment 2
Sample mode
These parameters are enabled only if Set bit timing parameters manually is selected. See Setting the Baud Rate.

  TouCAN Warnings Vector CAN Receive