MCAN Transmit
Libraries:
Embedded Coder Support Package for Infineon AURIX TC4x
Microcontrollers /
AURIX TC4x
Description
The Modular Controller Area Network (MCAN) transmit block writes data to the CAN bus.
The block accepts a 1-D array of type uint8
when you set the data
format to Raw data
. If you set the data format to
CAN Message
, the block accepts Simulink® bus signal from the CAN Pack or CAN FD Pack blocks depending on
the frame format.
Examples
Polling-Based CAN Communication Using MCAN Blocks of Infineon AURIX TC4x
Use the MCAN Transmit and MCAN Receive blocks from Embedded Coder® Support Package for Infineon® AURIX™ TC4x Microcontrollers to handle polling-based communication between different CAN modules of Infineon® AURIX™ TC4x Microcontrollers.
Interrupt-Based CAN Communication Using MCAN blocks of Infineon AURIX TC4x
Use the MCAN Transmit and Receive blocks from Embedded Coder® Support Package for Infineon® AURIX™ TC4x Microcontrollers to handle interrupt-based communication between different CAN modules of Infineon® AURIX™ TC4x Microcontrollers.
Ports
Input
Data — Input data port
vector | scalar
Specify the messages in the raw data format at this port.
Dependencies
To enable this port, set the Data format parameter
to Raw data
and disable the Remote
transmit parameter.
Data Types: uint8
Remote — Remote transmission status
vector | scalar
Specify the remote transmission status at this port as one of these values:
1 —
If the received CAN message is a remote frame0 —
If the received CAN message is a data frame
Dependencies
To enable this port, set the Data format parameter
to Raw data
, Frame format parameter
to Classic CAN
, and enable the Remote
transmit parameter.
Data Types: Boolean
ID — CAN message identifier
scalar
Specify the CAN message identifier at this port as one of these values:
0-0x7ff —
For a Standard (11-bit) identifier0-0x1fffffff —
For a Extended (29-bit) identifier
Dependencies
To enable this parameter, set the Data format
parameter to Raw data
and select the Enable
input port for identifier parameter.
Data Types: uint32
ID Type — CAN message identifier type
scalar
Specify the CAN message identifier type at this port as one of these values:
0 —
If its 11-bit standard identifier1
or any value other than0 —
If its 29-bit standard identifier
Dependencies
To enable this parameter, set the Data format
parameter to Raw data
and select the Enable
input port for identifier type parameter.
Data Types: uint8
Length — CAN message length
scalar
Specify the length of the received CAN message in bytes at this port.
Dependencies
To enable this parameter, set the Data format
parameter to Raw data
and select the Enable
input port for data length parameter.
Data Types: uint8
Msg — Input CAN message
vector | scalar
Specify the messages in the CAN message format.
You can create your messages or you can upload a CAN database file from the CAN Pack or CAN FD Pack blocks depending on the value in the Frame Format parameter.
Note
To create a CAN message using the CAN Pack block, enable the Output as bus parameter in the CAN Pack block.
Dependencies
To enable this port, set the Data format parameter
to CAN message
.
Data Types: CAN message
Buffer Number — Number of buffers in buffer transmit mode
scalar
Specify the number of buffers for CAN transmission.
Dependencies
To enable this port, set the Data format
parameter to CAN message
, Mode
parameter to Buffer
, and select the
Enable input port for buffer number
parameter.
Data Types: uint8
Output
Status — Status of data transmission
scalar
Specify the data transmission status at this port as one of these values:
0
— No error in CAN data transmission1
— Error in CAN data transmission due to timeout2
— Error in CAN data transmission due to invalid buffer configuration
Dependencies
To enable this port, select the Enable status port parameter.
Data Types: uint8
FIFO Level — FIFO register filling level
scalar
Output port to display the level of FIFO register.
Dependencies
To enable this parameter, set Mode parameter to
FIFO or Queue
and select Output FIFO
transmit free level parameter.
Parameters
Data format — Data output type
Raw data
(default) | CAN message
Set the data type of the transmitted message as one of these values:
Raw data
— To transmit the message as a 1-by-Nuint8
array, select Data Format asRaw data
.CAN message
— To transmit message in CAN message format, set Data Format toCAN message
. Depending on the value of Frame Format parameter, use CAN Pack or CAN FD Pack blocks along with the MCAN Transmit block to pack the CAN message.
Frame format — Frame format type
CAN-FD
(default) | Classic CAN
Select the frame format of the transmitted message.
Remote transmit — Option to enable remote message transmission
off
(default) | on
Select this parameter to transmit a remote frame in the CAN message.
Enabling this parameter configures Remote input port in the block.
Dependencies
To enable this parameter, set the Data format parameter
to Raw data
and set the Frame
format parameter to Classic
CAN
.
Enable bit rate switching — Option to enable switching between nominal bit rate and data bit rate
off
(default) | on
Select this parameter to enable switching between the nominal bit rate and the data bit rate.
Dependencies
To enable this parameter, set the Data
Format parameter to Raw data
and
Frame format to CAN-FD
.
Enable input port for identifier type — Option to enable input port for identifier type
off
(default) | on
Select this parameter to enable the input port to specify the identifier type.
Dependencies
To enable this parameter, set the Data format parameter
to Raw data
.
Identifier type — Message identifier type
Standard (11-bit identifier)
(default) | Extended (29-bit identifier)
Specify the type of message identifier.
Dependencies
To enable this parameter, disable the Enable input port for identifier type parameter.
Enable input port for identifier — Option to enable input port for identifier
on
(default) | off
Select to enable input port for identifier.
Dependencies
To enable this parameter, set Data format parameter to
Raw data
.
Identifier — Message identifier
100
(default) | scalar in the range (0,2047)
Specify an 11-bit identifier for the standard frame size or a 29-bit one for the extended frame size. You can specify the identifier as a decimal, binary, or hex value. For binary and hex formats, use bin2dec(' '), and hex2dec(' ') respectively to convert the value. The block codes the identifier into a message and sends it the CAN bus.
Dependencies
To enable this parameter, disable the Enable input port for identifier type parameter.
Enable input port for data length — Option to enable input port for data length
on
(default) | off
Select this parameter to enable the input port to specify data length.
Dependencies
To enable this parameter, set the Data format as
Raw data
.
Data length — Length in bytes
8
(default) | scalar in the range (0,8) | 12
| 16
| 20
| 24
| 32
| 48
| 64
Specify the data length in bytes.
Dependencies
To enable this parameter, disable the Enable input port for data length parameter.
Number of nodes — Number of CAN nodes
1
(default) | scalar in the range (0 to 20)
Specify the number of CAN nodes for data transmission.
Mode — Message transmission mode
FIFO or Queue
(default) | Buffer
Select the mode of the CAN data transmission.
Enable input port for buffer number — Option to enable input port for buffer number
off
(default) | on
Select this parameter to enable the Buffer Number input port in the block.
Dependencies
To enable this parameter, set the Mode parameter to
Buffer
.
Buffer number (0 - 31) — Buffer number for data transmission
0
(default) | scalar in the range (0,31)
Specify the buffer number for transmit the CAN data.
Dependencies
To enable this parameter, disable the Enable input port for buffer number parameter.
Timeout(s) in seconds — Specify waiting time to complete write operation
0
(default) | scalar in the range (0,2147480)
Specify the maximum waiting time (in seconds) to transmit the CAN data.
Output FIFO transmit free level — Option to enable output FIFO transmit free level
off
(default) | on
Select this parameter to enable the FIFO level port, which outputs the transmitted FIFO message level.
Dependencies
To enable this parameter, set Mode parameter to
FIFO or Queue
.
Enable status port — Option to enable output status port
off
(default) | on
Select this parameter to enable the Status port, which outputs the data transmission status.
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)