NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
The Controller Area network module is a high integrity serial communications protocol for distributed real time applications. The DCAN module present on AM335x is compliant to the CAN 2.0B protocol specification and supports bit-rates upto 1Mbits/s. The core IP for the DCAN controller is provided by Bosch.
Configuring DCAN for board-board communication
- Platform Related Configurations
- Configure the system clocks for DCAN peripheral by using the function provided in the platform directory
- Perform pin mux for DCAN peripherals Tx and Rx pins
- DCAN message RAM has to be initialized before the peripheral can be enabled for communication. This can be done by calling the function DCANMsgRAMInit
- Initialization and Configuration
- To place the DCAN in software reset DCANReset API can be used
- DCAN module can be placed in initialization mode by calling the API DCANInitModeSet
- Write access to the configuration registers can be enabled or disabled by calling the DCANConfigRegWriteAccessControl API
- Configuration of CAN bit timing can be done by calling the DCANBitTimingConfig API
- To enable the status change or error interrupts the DCANIntEnable API can be used
- To enable the interrupt lines of DCAN peripheral the DCANIntLineEnable API can be used
- To enable acceptance filtering for a receive message object DCANUseAcceptanceMaskControl and DCANMsgObjectMskConfig APIs can be used.
- To invalidate a message object the DCANMsgObjInvalidate API can be used
- To validate a message object the API DCANMsgObjValidate can be used
- To configure the DCAN command register DCANCommandRegSet API can be used
- To set the message ID of the CAN frame to be used for communication DCANMsgIdSet API can be used. Configure a receive message object with ID = 0, if CAN frames of any valid IDs(Standard/Extended) should be accepted.
- To configure the direction of the message object DCANMsgDirectionSet API can be used
- Data length code(DLC) can be configured using the DCANDataLengthCodeSet API
- Data bytes to be transmitted as a part of a CAN frame can be written to the interface data registers by using the API DCANDataWrite
- Message object interrupts can be enabled using the DCANMsgObjIntEnable API
- Configuration for FIFO end of block control can be done by calling the DCANFIFOEndOfBlockControl API
- To get the transmit request status the DCANTxRqstStatGet API can be used
- To get the message valid status of a message object the DCANMsgValidStatusGet API can be used
- To enable/disable the test modes of DCAN the DCANTestModeControl API can be used
- To configure DCAN in various test modes the DCANTestModesEnable API can be used
- Status of the interrupt register can be obtained by using the DCANIntRegStatusGet API
- Status of DCAN error and status register can be obtained by using the DCANErrAndStatusRegInfoGet API
- To get CAN bus from bus off to bus on state once the CAN bus errors are within the specified limit the DCANAutoBusOnControl API can be used
- To clear the interrupt pending status of a message object the DCANCommandRegSet API with appropriate parameter can be used
- To check the message number and the word number which caused the parity error in that message DCANParityErrCdRegStatusGet API can be used
- To disable transmit or receive interrupts for a message object DCANMsgObjIntDisable API can be used
- To read message object data which is transferred from message RAM to the interface register the DCANDataRead API can be used
- To start communication on the CAN bus the DCANNormalModeSet API can be used
Here is a procedural document on enabling the DCAN port in Starterware on the ICEv2. This document also describes a DCAN test between the AM335x GPEVM and the ICEv2.