MCMCAN FD 1

for KIT_AURIX_TC375_LK

MCMCAN FD data transmission

AURIX™ TC3xx Microcontroller Training V1.0.0

Please read the Important Notice and Warnings at the end of this document

Scope of Work

MCMCAN in Flexible Data-Rate mode is used to exchange data between two nodes, implemented in the same device using Loop-Back mode. The CAN messages are sent from CAN node 0 to CAN node 1 using Loop-Back mode. Both CAN nodes are set to CAN Flexible Data-rate mode (CAN FD). After each CAN message transmission and successful reception, an interrupt is generated. Inside the interrupt service routine, the content of the received CAN message is read. In case of the successful read operation, the received data is compared to the transmitted data. If all messages are received without any error detected, the LED is turned on to confirm successful message reception.

Introduction

Hardware Setup

This code example has been developed for the board KIT_A2G_TC375_LITE. LED1 (1) is used for this example.

Hardware Diagram Description: The image displays the Infineon AURIX™ lite Kit V2 development board. Key components visible include the TC375 microcontroller, various connectors (e.g., Ethernet, MIKROBUS), power indicators, and numerous pins and test points. A specific LED, labeled with the number '1', is highlighted, indicating its role in this example.

Implementation

CAN FD Use Cases

This code example covers the following four different CAN FD use cases. The definition of these use cases is provided in the "g_useCaseConf" table.

CCCRi .FDOECCCRi .BRSETxMsgk_T1 .FDFTxMsgk_T1 .BRSTxMsgk_T0 .XTDTransmit Behavior
11000Classical CAN frames with standard ID (ISO 11898-1)
11001Classical CAN frames with extended ID (ISO 11898-1)
11100Long frame with standard ID
11111Long + Fast frame with extended ID

Application Code Segments

Application code can be separated into four segments:

Interrupt Service Routine (ISR)

An additional Interrupt Service Routine (ISR) is implemented:

MCMCAN Module Initialization

Initialization is performed as follows:

All functions used for the MCMCAN module and node initialization are declared in the iLLD header IfxCan_Can.h.

Initialization of a Pin Connected to the LED

An LED is used to verify the success of a CAN message reception. Before using the LED, the port pin to which the LED is connected must be configured.

All functions are declared in the iLLD header IfxPort.h.

Transmission of CAN Messages

Before a CAN message is transmitted, two CAN messages (TX and RX) need to be initialized. The TX message is configured based on the current CAN FD use case (see slide 5 for more details). The TX message data content (data content that is transmitted) is initialized with the combination of current data payload byte and current CAN message value, using the following format:

bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
data contentg_currentCan Message range: 0 - 3currentDataPayloadByte range: 0 - 63

The RX message (message where the received CAN message is stored) is initialized with the default configuration (after successful CAN transmission, the values are replaced with the valid content). Additionally, both the TX and RX message data content need to be invalidated. No additional CAN message is transmitted until the received data has been read by the interrupt service routine.

Transmission of CAN Messages (Functions)

The functions IfxCan_Can_initMessage() and IfxCan_Can_sendMessage() are declared in the iLLD header IfxCan_Can.h. The function memset() is declared in the standard C library header string.h.

Verification of CAN Messages

After successful reception of each CAN message, several checks are performed:

  1. Message ID check (check that the received message ID matches the transmitted one). Verifies that both standard and extended IDs have been received
  2. Message length check (check that the received message length matches the transmitted one). The check is covering both classical CAN and CAN FD frame sizes
  3. Frame mode check (check that the received FD Format (FDF) and Bit Rate Switching (BRS) bit field values match with the transmitted ones)
  4. Expected valid data check (check that the received data matches with the expected one). Both classical CAN and CAN FD data content is covered
  5. Invalid data check (check that the invalid data has not been modified with the CAN transmission)

If no error has been observed, the g_status variable holds CanCommunicationStatus_Success value upon returning from the verifyCanMessage() function.

Interrupt Service Routine (ISR)

An ISR is triggered by the successful CAN message reception.

The functions IfxCan_Node_clearInterruptFlag() is declared in the iLLD header IfxCan.h while the function IfxCan_Can_readMessage() is declared in the iLLD header IfxCan_Can.h.

Run and Test

After code compilation and flashing the device, observe the following behavior:

References

Trademarks

All referenced product or service names and trademarks are the property of their respective owners.

Document Information

Edition 2021-03
Published by Infineon Technologies AG
81726 Munich, Germany
© 2021 Infineon Technologies AG. All Rights Reserved.
Do you have a question about this document? Email: erratum@infineon.com
Document reference: MCMCAN_FD_1_KIT_TC375_LK

Important Notice

The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics (“Beschaffenheitsgarantie”). With respect to any examples, hints or any typical values stated herein and/or any information regarding the application of the product, Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind, including without limitation warranties of non-infringement of intellectual property rights of any third party. In addition, any information given in this document is subject to customer's compliance with its obligations stated in this document and any applicable legal requirements, norms and standards concerning customer's products and any use of the product of Infineon Technologies in customer's applications. The data contained in this document is exclusively intended for technically trained staff. It is the responsibility of customer's technical departments to evaluate the suitability of the product for the intended application and the completeness of the product information given in this document with respect to such application.

Warnings

Due to technical requirements products may contain dangerous substances. For information on the types in question please contact your nearest Infineon Technologies office. Except as otherwise explicitly approved by Infineon Technologies in a written document signed by authorized representatives of Infineon Technologies, Infineon Technologies' products may not be used in any applications where a failure of the product or any consequences of the use thereof can reasonably be expected to result in personal injury.

PDF preview unavailable. Download the PDF instead.

Infineon-MCMCAN FD 1 KIT TC375 LK-Training-v01 00-EN "; size Microsoft PowerPoint 2016 Microsoft PowerPoint 2016

Related Documents

Preview MCMCAN Data Transmission Training for AURIX TC397 TFT
This document provides training on MCMCAN data transmission for the AURIX TC397 TFT microcontroller, covering its introduction, hardware setup, implementation details, and testing procedures.
Preview DMA ADC Transfer Example for Infineon AURIX TC375 LK
This technical training document from Infineon details the DMA transfer of ADC conversion results using the AURIX TC375 LK microcontroller kit. It covers scope, introduction to DMA and EVADC, hardware setup, step-by-step implementation for ADC, DMA, and UART configuration, and a run/test procedure with debugging observations. Includes references and important notices.
Preview MCMCAN Acceptance Filtering for AURIX TC397 TFT
This document details the MCMCAN acceptance filtering capabilities for the AURIX TC397 TFT microcontroller, covering its introduction, implementation, and testing.
Preview Infineon AURIX TC3xx Microcontroller Training: PWM Input Capturing via GTM TIM
This document details the process of capturing PWM input signals using the Generic Timer Module (GTM) Timer Input Module (TIM) on the Infineon AURIX TC3xx microcontroller, specifically for the KIT_AURIX_TC375_LK development board. It covers the scope of work, hardware setup, implementation steps for both TIM and TOM configuration, PWM generation, and measuring PWM frequency and duty cycle, along with a run and test guide.
Preview CCU6 ADC Conversion Triggering with AURIX TC375
This document details the configuration and implementation of the CCU6 (Capture/Compare Unit 6) module for triggering Analog-to-Digital Converter (ADC) conversions on the AURIX TC375 microcontroller. It covers scope of work, introduction to CCU6 and EVADC, hardware setup, implementation steps for CCU6 and EVADC, timer frequency calculation, event timing, UART configuration, and testing procedures.
Preview Infineon AURIX TC3xx Microcontrollers: CAN-FD, SMU, ADC Applications
Explore the AURIX TC3xx microcontroller system architecture, CAN-FD communication modules, and practical applications. This document details the features, history, development environment, and debugging tools for Infineon's AURIX TC3xx series, highlighting its suitability for automotive safety-critical applications.
Preview AURIX TC2xx CPU Trap Recognition: KIT_AURIX_TC297_TFT Training
Learn about TRAP error recognition and reaction on Infineon's AURIX TC2xx microcontrollers, focusing on the KIT_AURIX_TC297_TFT board. This guide covers trap types, handling, and debugging techniques for embedded systems.
Preview Infineon AURIX TC3xx Microcontroller Training: ADC Single Channel Conversion
Learn about configuring and using the Enhanced Versatile Analog-to-Digital Converter (EVADC) on Infineon's AURIX TC3xx microcontrollers for single-channel conversion. This guide covers hardware setup, software implementation, and testing procedures.