Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MCAN example
Purpose

This example demonstrates the basic functions of MCAN controller.

Requirements

This package can be used with two SAMV71 Xplained Ultra boards. The CAN1 in two board should be connected externally before running the example.

Description

In this example, one board sends messages over CAN bus to another board. The CAN message will display on the terminal window.

Usage
  1. Build the program and download it into the evaluation board.
  2. On the computer, open and configure a terminal application (e.g., HyperTerminal on Microsoft Windows) with these settings:
    • 115200 bauds
    • 8 bits of data
    • No parity
    • 1 stop bit
    • No flow control
  3. Connect CAN1 in two boards.
  4. Start the application.
  5. Upon startup, the application will output the following lines on the terminal window.
    " -- Select the action:\r\n"
    " 0: Set standard filter ID 0: 0x45A, store into Rx buffer. \r\n"
    " 1: Set standard filter ID 1: 0x469, store into Rx FIFO 0. \r\n"
    " 2: Send FD standard message with ID: 0x45A and 64 byte data 0 to 63. \r\n"
    " 3: Send FD standard message with ID: 0x469 and 64 byte data 128 to 191. \r\n"
    " 4: Set extended filter ID 0: 0x100000A5, store into Rx buffer. \r\n"
    " 5: Set extended filter ID 1: 0x10000096, store into Rx FIFO 1. \r\n"
    " 6: Send FD extended message with ID: 0x100000A5 and 64 byte data 0 to 63. \r\n"
    " 7: Send FD extended message with ID: 0x10000096 and 64 byte data 128 to 191. \r\n"
    " a: Send normal standard message with ID: 0x469 and 8 byte data 0 to 7. \r\n"
    " h: Display menu \r\n\r\n");
  6. Press '0' or '1' or '4' or '5' key in the terminal window to configure one board to receive CAN message.
  7. Press '2' or '3' or '6' or '7' key in the terminal window to configure another board to send CAN message. The message will be displayed on the terminal window.