CAN Configuration

Configure parameters for specified CAN device

Library

Vehicle Network Toolbox: CAN Communication

Description

The CAN Configuration block configures parameters for a CAN device that you can use to transmit and receive messages.

Specify the configuration of your CAN device before you configure other CAN blocks.

Use one CAN Configuration block to configure each device that sends and receives messages in your model. If you use a CAN Receive or a CAN Transmit block to receive and send messages on a device, your model checks to see if there is a corresponding CAN Configuration block for the specified device. If the device is not configured, you will see a prompt advising you to use a CAN Configuration block to configure the specified device.

    Note:   You need a license for both Vehicle Network Toolbox™ and Simulink® software to use this block.

Other Supported Features

The CAN Configuration block supports the use of Simulink Accelerator™ and Rapid Accelerator mode. Using this feature, you can speed up the execution of Simulink models.

For more information on this feature, see the Simulink documentation.

The CAN Configuration block supports the use of code generation when you use it with the CAN Receive and CAN Transmit blocks.

Dialog Box

Use the Block Parameters dialog box to select your CAN device configuration.

Device

Select the CAN device and a channel on the device that you want to use from the list. Use this device to transmit and/or receive messages. The device driver determines the default bus speed.

Bus speed

Set the bus speed property for the selected device. The default bus speed is the default assigned by the selected device.

Enable bit parameters manually

    Note:   This option is disabled if you are using an NI CAN channel.

Select this check box to specify bit parameter settings manually. The bit parameter settings include:

Synchronization jump width, Time segment 1, Time segment 2, and Number of samples. If you do not select this option, the device automatically assigns the bit parameters depending on the bus speed setting.

    Tip   Use the default bit parameter settings unless you have specific timing requirements for your CAN connection.

Synchronization jump width

Specify the maximum value of the bit time adjustments. The specified value must be a positive integer. If you do not specify a value, the selected bus speed setting determine the default value. To change this value, select the Enable bit parameters manually check box first. Refer to the SJW property for more information.

Time segment 1

Specify the amount of bit time segments that the channel can lengthen the sample time. The specified value must be a positive integer. If you do not specify a value, the selected bus speed setting determines the default value. To change this value, select the Enable bit parameters manually check box first. Refer to the TSEG1 property for more information.

Time segment 2

Specify the amount of bit time segments that the channel can shorten the sample time to resynchronize. The specified value must be a positive integer. If you do not specify a value, the selected bus speed setting determines the default value. To change this value, select the Enable bit parameters manually check box first. Refer to the TSEG2 property for more information.

Number of samples

Specify the total number of samples available to this channel. The specified value must be a positive integer. If you do not specify a value, the selected bus speed setting determines the default value. To change this value, select the Enable bit parameters manually check box first. Refer to the NumOfSamples property for more information.

Verify bit parameter settings validity

If you have set the bit parameter settings manually, click this button to see if your settings are valid. The block then runs a check to see if the combination of your bus speed setting and the bit parameter value forms a valid value for the CAN device. If the new bit parameter values do not form a valid combination, the verification fails and displays an error message.

Acknowledge mode

Specify whether the channel is in Normal or Silent mode. By default Acknowledge mode is Normal. In this mode, the channel both receives and transmits messages normally and performs other tasks on the network such as acknowledging messages and creating error frames. To observe all message activity on the network and perform analysis, without affecting the network state or behavior, select Silent. In Silent mode, you can only receive messages and not transmit.

    Notes  

    • You cannot specify the mode if you are using NI virtual channels.

    • Use Silent mode only if you want to observe and analyze your network activity.

Was this topic helpful?