Functions
CANFD Driver External Functions

The section has a list of all the exported API which the applications need to invoke in order to use the CANFD driver. More...

Functions

CANFD_Handle CANFD_init (uint8_t instanceId, const CANFD_MCANInitParams *configParams, int32_t *errCode)
 
int32_t CANFD_deinit (CANFD_Handle handle, int32_t *errCode)
 
int32_t CANFD_configBitTime (CANFD_Handle handle, const CANFD_MCANBitTimingParams *bitTimeParams, int32_t *errCode)
 
CANFD_MsgObjHandle CANFD_createMsgObject (CANFD_Handle handle, const CANFD_MCANMsgObjCfgParams *msgObjectParams, int32_t *errCode)
 
CANFD_MsgObjHandle CANFD_createRxRangeMsgObject (CANFD_Handle handle, const CANFD_MCANRxMsgObjRangeCfgParams *msgObjectParams, int32_t *errCode)
 
int32_t CANFD_deleteMsgObject (CANFD_MsgObjHandle handle, int32_t *errCode)
 
int32_t CANFD_transmitData (CANFD_MsgObjHandle handle, uint32_t id, CANFD_MCANFrameType frameType, uint32_t dataLength, const uint8_t *data, int32_t *errCode)
 
int32_t CANFD_transmitDataCancel (CANFD_MsgObjHandle handle, int32_t *errCode)
 
int32_t CANFD_getData (CANFD_MsgObjHandle handle, uint32_t *id, CANFD_MCANFrameType *ptrFrameType, CANFD_MCANXidType *idType, uint32_t *ptrDataLength, uint8_t *data, int32_t *errCode)
 
int32_t CANFD_getOptions (CANFD_Handle handle, const CANFD_OptionTLV *ptrOptInfo, int32_t *errCode)
 
int32_t CANFD_setOptions (CANFD_Handle handle, const CANFD_OptionTLV *ptrOptInfo, int32_t *errCode)
 

Detailed Description

The section has a list of all the exported API which the applications need to invoke in order to use the CANFD driver.

Function Documentation

int32_t CANFD_configBitTime ( CANFD_Handle  handle,
const CANFD_MCANBitTimingParams *  bitTimeParams,
int32_t *  errCode 
)

Description
Function configures the bit time parameters for the CANFD module.

Parameters
[in]handleHandle to the CANFD Driver
[in]bitTimeParamsBit time configuration parameters
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
CANFD_MsgObjHandle CANFD_createMsgObject ( CANFD_Handle  handle,
const CANFD_MCANMsgObjCfgParams *  msgObjectParams,
int32_t *  errCode 
)

Description
Function configures the receive or transmit message object. It also enables Tx completion and Tx cancelation interrupts . The callback function will be invoked on data transmit complete for transmit message objects OR upon receiving data for receive message objects. The application MUST then call CANFD_getData() API to process the received data.

Parameters
[in]handleHandle to the CANFD Driver
[in]msgObjectParamsMessage Object configuration parameters
[out]errCodeError code populated on error
Return values
Success- Handle to the message object.
Error- NULL

Description
Function configures the receive or transmit message object. It also enables Tx completion and Tx cancelation interrupts. The callback function will be invoked on data transmit complete for transmit message objects OR upon receiving data for receive message objects. The application MUST then call CANFD_getData() API to process the received data.

Parameters
[in]handleHandle to the CANFD Driver
[in]msgObjectParamsMessage Object configuration parameters
[out]errCodeError code populated on error
Return values
Success- Handle to the message object.
Error- NULL
CANFD_MsgObjHandle CANFD_createRxRangeMsgObject ( CANFD_Handle  handle,
const CANFD_MCANRxMsgObjRangeCfgParams *  msgObjectParams,
int32_t *  errCode 
)

Description
Function configures a receive message objects for a range of message identifiers. It also enables Rx interrupts. The callback function will be invoked upon receiving data for receive message objects. The application MUST then call CANFD_getData() API to process the received data.

Parameters
[in]handleHandle to the CANFD Driver
[in]msgObjectParamsMessage Object configuration parameters
[out]errCodeError code populated on error
Return values
Success- Handle to the message object.
Error- NULL

Description
Function configures a receive message objects for a range of message Identifiersmessage object. It also enables Rx interrupts. The callback function will be invoked upon receiving data for receive message objects. The application MUST then call CANFD_getData() API to process the received data.

Parameters
[in]handleHandle to the CANFD Driver
[in]msgObjectParamsMessage Object configuration parameters
[out]errCodeError code populated on error
Return values
Success- Handle to the message object.
Error- NULL
int32_t CANFD_deinit ( CANFD_Handle  handle,
int32_t *  errCode 
)

Description
Function closes the CANFD driver instance and cleanups all the memory allocated by the CANFD driver.

Parameters
[in]handleHandle to the CANFD Driver
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
int32_t CANFD_deleteMsgObject ( CANFD_MsgObjHandle  handle,
int32_t *  errCode 
)

Description
Function deletes a message object.

Parameters
[in]handleHandle to the message object
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
int32_t CANFD_getData ( CANFD_MsgObjHandle  handle,
uint32_t *  id,
CANFD_MCANFrameType *  ptrFrameType,
CANFD_MCANXidType *  idType,
uint32_t *  ptrDataLength,
uint8_t *  data,
int32_t *  errCode 
)

Description
Function is used by the application to get the CAN message from message RAM using a receive message object. NOTE: This API must ONLY be called from the callback context.

Parameters
[in]handleHandle to the message object
[out]idMessage Identifier
[out]ptrFrameTypeFrame type - Classic or FD
[out]idTypeMeassage Id type - 11 bit standard or 29 bit extended
[out]ptrDataLengthData Length of the received frame. Valid values: 1 to 64 bytes.
[out]dataReceived data.
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
int32_t CANFD_getOptions ( CANFD_Handle  handle,
const CANFD_OptionTLV *  ptrOptInfo,
int32_t *  errCode 
)

Description
Function is used by the application to get the error and status information from the driver.

Parameters
[in]handleHandle to the CANFD Driver
[out]ptrOptInfoOption info in TLV format which is populated with the requested information
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0

Description
Function is used by the application to get the error and status information from the driver.

Parameters
[in]handleHandle to the CAN Driver
[out]ptrOptInfoOption info in TLV format which is populated with the requested information
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
CANFD_Handle CANFD_init ( uint8_t  instanceId,
const CANFD_MCANInitParams *  configParams,
int32_t *  errCode 
)

Description
Function initializes the CANFD driver instance with the specified hardware attributes. It resets and configures the MCAN module, sets up the Message RAM and ECC Aggregator. It configures the CANFD driver with the control parameters.

Parameters
[in]instanceIdCANFD Instance Id. Note: Currently only 1 instance of CANFD is supported. Valid value is 0.
[in]configParamsCANFD module configuration parameters
[out]errCodeError code populated on error
Return values
Success- Handle to the CANFD Driver
Error- NULL
int32_t CANFD_setOptions ( CANFD_Handle  handle,
const CANFD_OptionTLV *  ptrOptInfo,
int32_t *  errCode 
)

Description
Function is used by the application to configure the driver options.

Parameters
[in]handleHandle to the CANFD Driver
[in]ptrOptInfoOption info in TLV format which is used to configure the driver
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
int32_t CANFD_transmitData ( CANFD_MsgObjHandle  handle,
uint32_t  id,
CANFD_MCANFrameType  frameType,
uint32_t  dataLength,
const uint8_t *  data,
int32_t *  errCode 
)

Description
Function used by the application to transmit data.

Parameters
[in]handleHandle to the message object
[in]idMessage Identifier
[in]frameTypeFrame type - Classic or FD
[in]dataLengthData Length to be transmitted. Valid values: 1 to 64 bytes.
[in]dataData to be transmitted
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0
int32_t CANFD_transmitDataCancel ( CANFD_MsgObjHandle  handle,
int32_t *  errCode 
)

Description
Function used by the application to cancel a pending data transmit.

Parameters
[in]handleHandle to the message object
[out]errCodeError code populated on error
Return values
Success- 0
Error- <0

Copyright 2020, Texas Instruments Incorporated