Skip to Content

CAN Transmit

This block handles transmitting messages via the CAN bus in STM microcontrollers.



CAN Transmit block

Table of Contents

Inputs

Input NameTypeDescription
Data[ ]uint8Data to send. The number of bytes at the input depends on the input or parameter Data length.
Set ExtIDboolOptional input
ID number type of the message to send (Standard or Extended). This input is optional and depends on the Enable input ID type parameter.
IDuint32Optional input
ID number of the message to send. This input is optional and depends on the Enable input ID parameter.
Data lengthuint8Optional input
Amount of data to send. This input is optional and depends on the Enable input length of data parameter.

Outputs

Output NameTypeDescription
Statusuint8Transmission status. Returns:
1 transmission successful
0 transmission failed

Block Parameters

ParameterDescription
Module numberCAN module number
Enable input ID typeEnables the Set ExtID input
ID TypeConditional Parameter
Message ID number type:
Standard ID - standard number (11 bits)
Extended ID - extended number (29 bits)
This parameter is available if the Enable input ID type option is disabled.
Enable input IDEnables the ID input
IDConditional Parameter
ID number of the message to send. This parameter is available if the Enable input ID option is disabled.
Enable input length of dataEnables the Data length input
Data lengthConditional Parameter
Maximum data length per frame (in bytes). This parameter is available when the Enable input length of data option is disabled.
Frame repeatNumber of repetitions of the same frame. This setting allows the sent frame to be automatically repeated a specified number of times without needing to call the block again.
Behavior when queue fullBlock behavior when the transmission queue is full:
Discard new packets - discards new frames when the queue is full
Overwrite first packet - overwrites the newest frames in the queue when full
Overwrite last packet - overwrites the oldest frames in the queue when full
ImmediatelyExecution of the action specified in the Behavior when queue full parameter immediately after the block invocation, without waiting for data transmission to complete.
TimeoutConditional Parameter
Specifies how long the system will wait for the buffer to clear before executing the action defined in Behavior when queue full. This parameter is available when the Immediately option is disabled.
Wait for end sendingExecutes the block until data is sent or the time set in the Timeout parameter expires. If this option is disabled, the block returns a success status immediately after placing the message in the transmission queue, without waiting for its actual transmission.
TimeoutConditional Parameter
How long the system will wait for the block execution. This parameter is available when the Wait for end sending option is disabled.
Sample time [s]Function refresh rate


Block parameters for CAN Transmit

CubeMX Configuration for a Given MCU

Configuration for CAN can be found on the CubeMX Configuration for a Given MCU subpage.

See Also

Last updated on