MCAN internal loopback

This example demonstrates MCAN communication using internal loopback mode. The application configures the MCAN module to transmit and receive messages internally, allowing verification of the CAN controller functionality without requiring external connections. The sent message is received by the same node through the internal loopback path.

Example Usage

  1. Build and run the example after connecting to the device.

  2. The application initializes the MCAN module with:

    • Internal loopback mode enabled

    • Standard CAN message format

  3. The transmitter sends test messages with incrementing data.

  4. The receiver captures the looped-back messages internally.

  5. The application verifies that the received data matches the transmitted data.

  6. txMsg.data[0] is updated with the current value of gMsgCount before each transmission to confirm new data is being transmitted and received.

  7. A breakpoint will be hit if an error is encountered; check the gError variable for status.

Key features demonstrated:

  • MCAN configuration for internal loopback

  • CAN message transmission and reception

  • Loopback validation without external hardware

  • Error detection and reporting

Peripherals & Pin Assignments

Peripheral

Pin

Function

MCAN0

PA11

RX Pin

MCAN0

PA12

TX Pin

Note: No external connections are required for this internal loopback example.