Main Content

CAN Transmit

Transmit message to CAN network

  • Library:
  • Simulink Coder Support Package for STMicroelectronics Nucleo Boards/STM32F7

  • CAN Transmit block

Description

The CAN Transmit block transmits message to a Controller Area Network (CAN) network connected to the hardware.

Configure the FIFO and other properties of CAN module in the Configuration Parameters.

Note

CAN Transmit block is currently supported only for STM32 Nucleo F767ZI processor.

Ports

Input

expand all

The block accepts messages in Raw data format.

To accept the message as a uint8 vector array, set Data Format as Raw data.

Dependencies

To enable this port, set the Data Format to Raw data.

Data Types: uint8

The block accepts messages in CAN Message format.

You can create your messages or you can upload a CAN database file to CAN Pack block.

Dependencies

To enable this port, set the Data Format to CAN Message.

Data Types: CAN Msg

Output

expand all

Output port to display the status of data transmission.

  • 1 - data transmission is successful

  • 0 - data transmission is unsuccessful

Dependencies

To enable this port, select the Output Status parameter.

Parameters

expand all

CAN module which is used for communication.

Note

  • CAN 0 Module on block represents CAN 1 peripheral on hardware.

  • CAN 1 Module on block represents CAN 2 peripheral on hardware.

Select a type to transmit message.

  • Raw data – To transmit message as a 1-by-N uint8 array, select Data Format as Raw data.

  • CAN Msg – To transmit message in CAN message format, select Data Format as CAN Msg and then perform these steps:

    1. Add a CAN pack block to your model.

    2. Connect the output of the CAN Receive pack block to the input of the CAN Transmit block

    3. Using the options in the Data to be input as list of the CAN Pack block, specify if you want to create your messages or you want to upload a CAN database file. If you choose to upload a CAN database file, the CAN Pack inherits the message properties from the uploaded file.

The type of message identifier.

Dependencies

To enable this parameter, set the Data Format as Raw data.

Identifier, which is 11 bits long for the standard frame size or 29 bits long for the extended frame size, specified in decimal, binary, or hex. For binary and hex formats, use bin2dec(' ') and hex2dec(' '), respectively, to convert the entry. The identifier is coded into a message that is sent to the CAN bus.

Dependencies

To enable this parameter, set the Data Format as Raw data. To output the identifier of the CAN Msg, select Output identifier of the CAN Unpack block.

The length of the message, in bytes.

Dependencies

To enable this parameter, set the Data Format as Raw data. To output the length of the CAN Msg, select Output length of the CAN Unpack block.

The block sends a remote frame in the CAN message if this parameter is selected. The data at the input port is not sent in the CAN message.

Dependencies

To enable this parameter, set the Data Format as Raw data. For CAN Msg, the Remote Frame is inherited from the request specified in the CAN Pack block.

When you select the Output Status parameter, the block configures an output port, Status. The port outputs the status of CAN message.

Version History

Introduced in R2021b