| can Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xcan_intr_example.c File Reference

## Overview

Contains an example of how to use the XCan driver directly.

The example here shows using the driver/device in interrupt mode.

Note

This code assumes that Xilinx interrupt controller (XIntc) is used in the system to forward the CAN device interrupt output to the processor and no operating system is being used.

The Baud Rate Prescaler Register (BRPR) and Bit Timing Register (BTR) are setup such that CAN baud rate equals 40Kbps, assuming that the the CAN clock is 24MHz. The user needs to modify these values based on the desired baud rate and the CAN clock frequency. For more information see the CAN 2.0A, CAN 2.0B, ISO 11898-1 specifications.

    MODIFICATION HISTORY:

    Ver   Who       Date     Changes

    1.00a xd/sv     01/12/09 First release
    2.00a ktn       10/22/09 Updated to use the HAL APIs/macros.
                     The macros have been renamed to remove _m from the
                     name.
    2.00a bss       01/11/11 Updated the example to be used with the SCUGIC in
                     Zynq.
    2.00a bss       01/16/12 Updated the example to fix CR 694533,
                     replaced INTC_DEVID with INTC_DEVICE_ID.
    3.2   ms  01/23/17 Added xil_printf statement in main function to
                       ensure that "Successfully ran" and "Failed" strings are
                       available in all examples. This is a fix for CR-965028.
    3.3   ask  08/01/18 Fixed Cppcheck and GCC warnings in can driver
    3.7   ht   07/04/23 Added support for system device-tree flow.
    3.8   ht   12/13/23 Added support for ECC.

## Functions
int | main (void)
| This function is the main function of the Can interrupt example. More...

## Function Documentation

int main | ( | void |  | ) |

This function is the main function of the Can interrupt example.

Returns
  - XST_SUCCESS if the example has completed successfully.
  - XST_FAILURE if the example has failed.

Note
  None.

References XCan::EnableECC, TEST_MESSAGE_ID, XCan_CreateDlcValue, XCan_CreateIdValue, XCan_EnterMode(), XCAN_ESR_ACKER_MASK, XCAN_ESR_BERR_MASK, XCAN_ESR_CRCER_MASK, XCAN_ESR_FMER_MASK, XCAN_ESR_STER_MASK, XCan_GetMode(), XCAN_HANDLER_ERROR, XCAN_HANDLER_EVENT, XCAN_HANDLER_RECV, XCAN_HANDLER_SEND, XCan_Initialize(), XCan_InterruptEnable(), XCan_IntrHandler(), XCan_IsTxFifoFull, XCAN_IXR_ALL, XCAN_IXR_ARBLST_MASK, XCAN_IXR_BSOFF_MASK, XCAN_IXR_ECC_MASK, XCAN_IXR_RXOFLW_MASK, XCAN_IXR_RXUFLW_MASK, XCAN_IXR_SLP_MASK, XCAN_IXR_TXBFLL_MASK, XCAN_IXR_TXFLL_MASK, XCAN_IXR_WKUP_MASK, XCan_LookupConfig(), XCAN_MODE_CONFIG, XCAN_MODE_LOOPBACK, XCan_Recv(), XCan_Reset(), XCan_SelfTest(), XCan_Send(), XCan_SetBaudRatePrescaler(), XCan_SetBitTiming(), and XCan_SetHandler().