Jump to main content

##

# 1.4 CAN Interrupt

This example application shows how to use the CAN module to transmit and receive normal CAN messages in interrupt mode.

## Description

This application transmits CAN message to CAN Bus and receives CAN message from CAN Bus. To run this application, an evaluation board and Microchip CAN Bus Analyzer is required . They act as different nodes on the CAN bus. While running the application, user can send and receive CAN messages between the board and the analyzer.

## Downloading and Building the Application

To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.

Path of the application within the repository is apps/can/can_normal_operation_interrupt_timestamp/firmware.

To build the application, refer to the following table and open the project using its IDE.

Project Name | Description
--- | ---
pic32mx_125_sk.X | MPLABX project for PIC32MX1/2/5 Starter Kit
pic32mx_xlp_sk.X | MPLABX project for PIC32 Ethernet Starter Kit

## Setting Up the Hardware

The following table shows the target hardware for the application projects.

Project Name | Description
--- | ---
pic32mx_125_sk.X | PIC32MX1/2/5 Starter Kit
pic32mx_eth_sk2.X | PIC32 Ethernet Starter Kit

### Setting Up PIC32MX1/2/5 Starter Kit

- To run the demo, the following additional hardware are required:
  - Microchip CAN Bus Analyzer
- Install Microchip CAN Bus Analyzer software on PC
- Connect Microchip CAN Bus Analyzer to J6 connector using male to female DB9 serial cable
- Connect Microchip CAN Bus Analyzer to PC using USB Male-A to Male Mini-B cable
- Connect mini USB cable to the ‘Debug USB’ connector(J3) on the board to the computer.

### Setting Up PIC32 Ethernet Starter Kit

- To run the demo, the following additional hardware are required:
  - Microchip CAN Bus Analyzer
  - Starter Kit I/O Expansion Board
  - CAN/LIN PICtail (Plus) Daughter Board
- Install Microchip CAN Bus Analyzer software on PC
- Connect J1 connector on board to J1 connector on Starter Kit I/O Expansion Board
- Connect J4 connector on Starter Kit I/O Expansion Board to J7 connector on CAN/LIN PICtail (Plus) Daughter Board
- Connect Microchip CAN Bus Analyzer to P1 connector on CAN/LIN PICtail (Plus) Daughter Board using female to female DB9 serial cable
- Short (close) Jumper J5 on PIC32MX Ethernet Starter Kit II
- Connect Microchip CAN Bus Analyzer to PC using USB Male-A to Male Mini-B cable
- Connect mini USB cable to the ‘Debug USB’ connector(J7) on the board to the computer

## Running the Application

1. Build and program the application project using its respective IDE
2. Open Microchip CAN Bus Analyzer software and make the following configurations:

   Description | Settings
   --- | ---
   CAN Bitrate Control | 500 Kbps
   CAN Mode Control | Normal Mode
   Bus Termination Control | ON

3. Press Switch to transmit message to CAN Bus from board
4. CAN message will be displayed in the CAN analyzer software
5. Send following CAN message from CAN analyzer software
   - ID : 0x469, DLC : 8, Data: 1, 2, 3, 4, 5, 6, 7, 8
6. LED toggles at each message transmission or reception

   Board | Switch Name | LED Name
   --- | --- | ---
   PIC32MX1/2/5 Starter Kit | SW1 | LED1
   PIC32 Ethernet Starter Kit | SW1 | LED1