1.5 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 |
---|---|
pic32mz_w1_curiosity.X | MPLABX project for PIC32MZ W1 Curiosity Board |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32mz_w1_curiosity.X | PIC32MZ W1 Curiosity Board |
Setting Up PIC32MZ W1 Curiosity Board
- To run the demo, the following additional hardware are required:
- Install Microchip CAN Bus Analyzer software on PC
- Connect Microchip CAN Bus Analyzer to ATA6563 click board using female to female DB9 serial cable
- Connect ATA6563 click board to the PIC32MZ W1 Curiosity
Board as per the Pin connections shown below
PIC32MZ W1 Curiosity Board ATA6563 click board PWM(RPB12), mikroBUS Connector RX (PIN 14) AN(RPA14), mikroBUS Connector TX (PIN 13) +3.3V, mikroBUS Connector 3V3 (PIN 7) +5V, mikroBUS Connector 5V (PIN 10) GND, mikroBUS Connector GND (PIN 9) - Connect Microchip CAN Bus Analyzer to PC using USB Male-A to Male Mini-B cable
- Connect the USB to TTL serial (USB UART click board) to U1TX pin (pin 23) and U1RX pin (pin 13) of J207 header
- Connect the Debug USB port on the board to the computer using a mini USB cable
- Connect mini USB cable to USB UART click board to the computer. This will enumerate the USB to UART port.
Running the Application
- Build and program the application project using its respective IDE
- 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 - Connect to the DEBUG UART Virtual COM port and configure the serial settings as
follows:
- Baud : 115200
- Data : 8 Bits
- Parity : None
- Stop : 1 Bit
- Flow Control : None
- Press ‘1’ to transmit message to CAN Bus on console window of the board
- “Transmitting Message:Success” will be displayed in the console window of PIC32MK GP DB board board
- CAN message will be displayed in the CAN analyzer software
- Press ‘2’ to receive message from CAN Bus on console window of the board
- Send following CAN message from CAN analyzer software
- ID : 0x469, DLC : 8, Data: 1, 2, 3, 4, 5, 6, 7, 8
- CAN message will be displayed in the terminal window of PIC32MK GP DB board
- LED toggles at each message
transmission or reception
Board LED Name PIC32MZ W1 Curiosity Board RED LED (D202)