MCAN Receive

Libraries:
      Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers / 
      AURIX TC4x
   
Description
The MCAN Receive block is a Modular CAN (MCAN) that reads data from the controller area network (CAN) bus.
For unpacked messages, the block outputs the received values as a 64-by-1 array for the CAN-FD frame format and as a 8-by-1 array for the Classic CAN frame format.
For packed messages, the block outputs a Simulink® bus signal. To extract data from the Simulink bus signal, use the CAN Unpack block if the frame format is Classic CAN or CAN FD Unpack blocks if the frame format is CAN-FD.
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
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
The block outputs the CAN message (data and header) it receives from the Simulink bus signal.
Dependencies
To enable this port, set the Output type parameter
                        to Packed.
Data Types: CAN Message
The block outputs the data it reads from the FIFO 0 register, FIFO 1
                     register, or buffer, based on the value of the Read Source
                     parameter. The maximum size of the data is 8 bytes for the
                        Classic CAN frame format and
                        64 bytes for CAN-FD frame
                     format.
Dependencies
To enable this port, set the Output type parameter
                        to Unpacked.
Data Types: uint8
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
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
This port outputs the identifier type as:
- 0— If the ID is an 11-bit standard identifier
- 1— If the ID is an 29-bit extended identifier
Dependencies
To enable this port, set the Output type parameter
                        to Unpacked and enable Output identifier
                           type parameter.
Data Types: Boolean
This port outputs the CAN frame data format as:
- 0— If the format is Classic CAN
- 1— If the format is CAN-FD
Dependencies
To enable this port, set the Output type parameter
                        to Unpacked and enable Output frame
                           type.
Data Types: uint32
This port outputs the status as one of these values:
- 0— When the block receives the CAN FD frames without bit rate switching
- 1— When the 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
This port outputs the remote reception status as:
- 1— If the received CAN message is a remote frame
- 0— 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
This port outputs the received FIFO fill level.
The FIFO level indicates the receive level of the FIFO 0 or FIFO 1 register after the block reads the message. Rx FIFO indicates 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 parameter.
Data Types: uint8
This port outputs the message read status as:
- 1— If the read CAN message is invalid
- 0— If the read CAN message is valid
Dependencies
To enable this port, select the Output Status parameter.
Data Types: uint8
Parameters
Select the frame type to receive the message.
Specify the read source as FIFO or buffer.
Note
The block reads the message from FIFO 0, FIFO 1, or buffer depending on the filter configuration you set (see MCAN Receive Peripheral Configuration).
Specify the number of the buffer for the block to use 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.
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.
Specify the message output type of the 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 the data from the Simulink bus signal, use the CAN Unpack block if the frame format is Classic CAN or CAN FD Unpack blocks if the frame format is CAN-FD.
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.
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.
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.
Select this parameter to enable the Remote port, which outputs the message remote frame status.
Dependencies
To enable this parameter, set the Frame format 
                     parameter to Classic CAN and the Output
                        type parameter to Unpacked.
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.
Select this parameter to enable the Status port, which outputs the read status.
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 context
                  of the block in 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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)

