MCAN Receive
Libraries:
Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers /
AURIX TC4x
Description
The Modular Controller Area Network (MCAN) Receive block reads data from the CAN bus.
The block outputs the received values as a 64-by-1 array or an 8-by-1 array for unpacked output type, depending on whether the frame format is CAN-FD or Classic CAN.
The blocks outputs a Simulink® bus signal for packed output type. Based on the frame format, use the CAN Unpack or CAN FD Unpack blocks to extract data from the Simulink bus signal.
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
Buffer Number — Buffer number for CAN communication
scalar
Specify the buffer number.
Dependencies
To enable this port, set the Read source
parameter to Buffers
and select the Enable
input port for buffer number parameter.
Data Types: uint8
Output
Msg — CAN Message
vector | scalar
The MCAN Receive block outputs the CAN message (data and header) it receives from the Simulink bus signal.
Dependencies
To enable this port, set Output type to
Packed
.
Data Types: CAN Msg
Data — Message data
vector | scalar
The block outputs the data read from FIFO 0 register, FIFO 1 register, or
buffer, based on the value of Read Source parameter. The
maximum size of the data is 8
bytes for Classic
CAN
and 64
bytes for
CAN-FD
frame format.
Dependencies
To enable this port, set Output type to
Unpacked
.
Data Types: uint8
Id — CAN message identifier value
scalar
This port outputs a standard or extended ID value from the received CAN message.
Dependencies
To enable this port, set Output type to
Unpacked
.
Data Types: uint32
Length — CAN message length
scalar
This port outputs the data length of the received CAN message in bytes.
Dependencies
To enable this port, set Output type to
Unpacked
.
Data Types: uint8
Id Type — CAN message identifier type
scalar
This port outputs the identifier type as:
0
— If its 11-bit standard identifier1
— If its 29-bit extended identifier
Dependencies
To enable this port, set the Output type parameter
to Unpacked
and enableOutput identifier
type parameter.
Data Types: Boolean
Frame Type — CAN message frame type
scalar
This port outputs the CAN frame data format as:
0
— If it is Classic CAN1
— If it is CAN-FD
Dependencies
To enable this port, set the Output type parameter
to Unpacked
and enable Output frame
type.
Data Types: uint32
Bitrate switching — Bit rate switching status
scalar
This port outputs the status as one of these values:
0
— When the MCAN Receive block receives the CAN FD frames without bit rate switching1
— When the MCAN Receive block receives the with bit rate switching
Dependencies
To enable this port, set the Frame format parameter
to CAN-FD
, the Output type
parameter to Unpacked
, and select the Output
bit rate switching parameter.
Data Types: uint8
Remote — Remote frame status
scalar
This port outputs the remote transmission status 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 Frame format to
Classic CAN
, Output type
parameter to Unpacked
, and enable Output
remote parameter.
Data Types: Boolean
FIFO Level — FIFO fill level
scalar
The port outputs the received FIFO fill level.
The FIFO level provides the receive FIFO 0 or FIFO 1 register level after reading the message. Rx FIFO provides how much of Rx FIFO is empty.
Dependencies
To enable this port, set the Read source parameter
to FIFO 0
or FIFO 1
and enable
the Output receive FIFO level.
Data Types: uint8
Status — Status of received message
scalar
This port outputs the message read status as:
1
— If the read CAN message is invalid0
— If the read CAN message is valid
Dependencies
To enable this port, select the Output Status parameter.
Data Types: uint8
Parameters
Frame format — Frame format type
CAN-FD
(default) |
Classic CAN
Select the frame type to receive the message.
Read source — Source of received CAN message
FIFO 0
(default) |
FIFO 1
|
Buffers
Specify the read source as FIFO or buffer.
Note
The MCAN Receive block reads the message from FIFO , FIFO 1, or buffer depending on the filter configuration you set in the MCAN Receive Peripheral Configuration.
Buffer number — Buffer number for CAN data reception
0
(default) | scalar in the range (0-63)
Specify the buffer number that the MCAN Receive block uses to read the received CAN message.
Dependencies
To enable this parameter, set Read source to
Buffers
and disable the Enable input port for
buffer number parameter.
Enable input port for buffer number — Option to enable input port for buffer number
off
(default) |
on
Select this parameter to enable the input port to specify the buffer number.
Dependencies
To enable this parameter, set Read source to
Buffers
and select the Enable input port for
buffer number parameter.
Output Type — Message output type
Packed
(default) |
Unpacked
Specify output type of the MCAN Receive block as Packed
or
Unpacked
.
For unpacked messages, the block outputs different fields of the unpacked CAN message.
For packed messages, the block outputs a Simulink bus signal. To extract data from a Simulink bus signal, depending on the frame format, connect the MCAN Receive block to the CAN Unpack or CAN FD Unpack blocks.
Output identifier type — Option to enable output identifier type
off
(default) |
on
Select this parameter to enable the Id Type port, which outputs the standard or extended message status.
Dependencies
To enable this parameter, set the Output type parameter
to Unpacked
.
Output frame type — Option to enable output frame type
off
(default) |
on
Select this parameter to enable the Frame Type port, which outputs the message frame type.
Dependencies
To enable this parameter, set the Output type parameter
to Unpacked
.
Output bitrate switching — Option to enable output bitrate switching
off
(default) |
on
Select this parameter to enable the Bitrate Switching port, which outputs the status of bit rate switching.
Dependencies
To enable this parameter, set the Frame format
parameter to CAN-FD
and the Output
type parameter to Unpacked
.
Output remote — Option to enable output frame type
off
(default) |
on
Select this parameter to enable the Remote, which outputs the message remote frame status.
Dependencies
To enable this parameter, set Frame format to
Classic CAN
and Output type
parameter to Unpacked
.
Output receive FIFO level — Enable receive FIFO fill level
off
(default) |
on
Select this parameter to enable the FIFO level port, which outputs the received FIFO message level.
Dependencies
To enable this parameter, set the Read source parameter
to FIFO 0
or FIFO
1
.
Output status — Option to enable output status
off
(default) |
on
Select this parameter to enable the Status port, which outputs the read status.
Sample Time — Time interval to read message
-1 (default) | nonnegative real value
Specify how often the block receives message, in seconds. When you specify this
parameter as -1
, Simulink determines the best sample time for the block based on the block
context within the model.
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 (한국어)