| canfd Vitis Drivers API Documentation

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

Functions
xcanfd_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.0   nsk 06/04/15 First release
    1.2   ms  01/23/17 Modified 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.
          ms  04/05/17 Added tabspace for return statements in functions
                       for proper documentation while generating doxygen.
    2.1   ask 07/03/18 Added timeout, and Code to handle Timestamp Counter
                 Overflow Interrupt for CR# 992606, CR# 1004222 and
                 fixed gcc warnings.
                    ask    08/08/18 Changed the Can ID to 11 bit value as standard Can ID
                                                 is 11 bit.
            ask    09/12/18 Added timeout, and Code to handle Timestamp Counter
                                 Overflow Interrupt. Made logic generic for both
                                                 scugic and intc vectors.
    2.1     nsk  03/09/19 Fix build error in example
    2.3     sne  07/11/19 Added Protocol Exception support in EventHandler and updated
                  Bus Off EventHandler.
    2.8     ht   06/19/23 Added support for system device-tree flow
    2.10    ht   12/01/24 Fixed GCC warnings

## 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 XCanFd_Config::BaseAddress, EDL_CANFD, TEST_BRPR_BAUD_PRESCALAR, TEST_BTR_FIRST_TIMESEGMENT, TEST_BTR_SECOND_TIMESEGMENT, TEST_BTR_SYNCJUMPWIDTH, TEST_CANFD_DLC, TEST_FBRPR_BAUD_PRESCALAR, TEST_FBTR_FIRST_TIMESEGMENT, TEST_FBTR_SECOND_TIMESEGMENT, TEST_FBTR_SYNCJUMPWIDTH, TEST_MESSAGE_ID, XCanFd_AcceptFilterDisable(), XCanFd_AcceptFilterEnable(), XCANFD_AFR_UAF_ALL_MASK, XCanFd_CfgInitialize(), XCanFd_Create_CanFD_Dlc_BrsValue, XCanFd_CreateIdValue, XCANFD_DLCR_DLC_MASK, XCanFd_EnterMode(), XCANFD_ESR_ACKER_MASK, XCANFD_ESR_BERR_MASK, XCANFD_ESR_CRCER_MASK, XCANFD_ESR_F_BERR_MASK, XCANFD_ESR_F_FMER_MASK, XCANFD_ESR_F_STER_MASK, XCANFD_ESR_FMER_MASK, XCANFD_ESR_STER_MASK, XCANFD_GET_RX_MODE, XCanFd_Get_RxBuffers, XCanFd_GetDlc2len(), XCanFd_GetLen2Dlc(), XCanFd_GetMode(), XCANFD_HANDLER_ERROR, XCANFD_HANDLER_EVENT, XCANFD_HANDLER_RECV, XCANFD_HANDLER_SEND, XCanFd_InterruptEnable(), XCanFd_IntrHandler(), XCANFD_IXR_ALL, XCANFD_IXR_ARBLST_MASK, XCANFD_IXR_BSOFF_MASK, XCANFD_IXR_PEE_MASK, XCANFD_IXR_RXBOFLW_MASK, XCANFD_IXR_RXFOFLW_MASK, XCANFD_IXR_RXMNF_MASK, XCANFD_IXR_RXRBF_MASK, XCANFD_IXR_SLP_MASK, XCANFD_IXR_TSCNT_OFLW_MASK, XCANFD_IXR_TXCRS_MASK, XCANFD_IXR_TXRRS_MASK, XCANFD_IXR_WKUP_MASK, XCanFd_LookupConfig(), XCANFD_MODE_CONFIG, XCANFD_MODE_LOOPBACK, XCanFd_Pee_BusOff_Handler(), XCanFd_Recv_Mailbox(), XCanFd_Recv_Sequential(), XCanFd_RxBuff_MailBox_Active(), XCanFd_RxBuff_MailBox_DeActive(), XCanFd_SelfTest(), XCanFd_Send(), XCanFd_Set_MailBox_IdMask(), XCanFd_SetBaudRatePrescaler(), XCanFd_SetBitRateSwitch_DisableNominal(), XCanFd_SetBitTiming(), XCanFd_SetFBaudRatePrescaler(), XCanFd_SetFBitTiming(), and XCanFd_SetHandler().