CANFD Driver

The CANFD driver provides functionality of transferring data between CANFD peripherals. This driver does not interpret any of the data sent to or received from using this peripheral.

The CANFD header file should be included in an application as follows:

Initializing the driver

The CANFD Driver needs to be initialized once across the System. This is done using the CANFD_init. None of the CANFD API's can be used without invoking this API.

Once the CANFD Driver has been initialized; the bit timing can be configured using CANFD_configBitTime. This APIs can be called multiple times to reconfigure bit timings.

Creating the message objects

Message objects are used to transmit or receive data over the CANFD peripheral. A message object is created using CANFD_createMsgObject.

Sending and receiving data

Data is transmitted using the CANFD_transmitData. The application will be notified when the transmit is complete if it has enabled dataInterruptEnable and registered a callback function appDataCallBack when initializing the CANFD driver.

If the receive interrupts are enabled using dataInterruptEnable field and a callback function appCallBack has been registered when initializing the CANFD driver, the driver notifies the application when the data has arrived. The application needs to call the CANFD_getData function to read the received data.

Error and status handling

The application can monitor the ECC error, Bus off error and Protocol Errors by enabling the error interrupts errInterruptEnable. The driver will call the registered callback function appErrCallBack to indicate which error fields caused the interrupt. It is up to the application to take appropriate action.

Get/Set Options

Helper APIs to get and set various statistics, error counters, ECC diagnostics, power down have been provided. Refer to CANFD_Option for more information.

Limitation

The CANFD driver does not support the DMA or power down.

The canfd/include/hw_mcanss.h has the register layer definitons for the CANFD controller module.


Copyright 2020, Texas Instruments Incorporated