Controller Area Network (CAN)
6
Controller Area Network (CAN)
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.1
Introduction
The Controller Area Network (CAN) APIs provide a set of functions for accessing the CAN modules.
Functions are provided to configure the CAN controllers, configure message objects, and manage
CAN interrupts.
The CAN module provides hardware processing of the CAN data link layer. It can be configured
with message filters and preloaded message data so that it can autonomously send and receive
messages on the bus, and notify the application accordingly. It automatically handles generation
and checking of CRCs, error processing, and retransmission of CAN messages.
The message objects are stored in the CAN controller and provide the main interface for the CAN
module on the CAN bus. There are 32 message objects that can each be programmed to handle
a separate message ID, or can be chained together for a sequence of frames with the same ID.
The message identifier filters provide masking that can be programmed to match any or all of the
message ID bits, and frame types.
The CAN module is disabled by default, so the the
function must be called before
any other CAN functions are called. This call initializes the message objects to a safe state prior
to enabling the controller on the CAN bus. Also, the bit timing values must be programmed prior to
enabling the CAN controller. The
function should be called with the ap-
propriate bit timing values for the CAN bus. Once these two functions have been called, a CAN con-
troller can be enabled using the
, and later disabled using
if needed. Calling
does not reinitialize a CAN controller, so it can be used to
temporarily remove a CAN controller from the bus.
The CAN controller is highly configurable and contains 32 message objects that can be pro-
grammed to automatically transmit and receive CAN messages under certain conditions. Message
objects allow the application to perform some actions automatically without interaction from the
microcontroller. Some examples of these actions are the following:
Send a data frame immediately
Send a data frame when a matching remote frame is seen on the CAN bus
Receive a specific data frame
Receive data frames that match a certain identifier pattern
To configure message objects to perform any of these actions, the application must first set up one
of the 32 message objects using
. This function must be used to configure
a message object to send data, or to configure a message object to receive data. Each message
object can be configured to generate interrupts on transmission or reception of CAN messages.
When data is received from the CAN bus, the application can use the
function to read the received message. This function can also be used to read a message object
that is already configured in order to populate a message structure prior to making changes to the
April 8, 2013
53
Summary of Contents for Tiva TM4C123GH6PM
Page 26: ...Boot Loader 26 April 8 2013...
Page 68: ...Controller Area Network CAN 68 April 8 2013...
Page 122: ...Hibernation Module 122 April 8 2013...
Page 136: ...Inter Integrated Circuit I2C 136 April 8 2013...
Page 152: ...Memory Protection Unit MPU 152 April 8 2013...
Page 174: ...Pulse Width Modulator PWM Returns None 174 April 8 2013...
Page 196: ...Synchronous Serial Interface SSI 196 April 8 2013...
Page 222: ...System Control 222 April 8 2013...
Page 270: ...UART 270 April 8 2013...
Page 296: ...uDMA Controller 296 April 8 2013...
Page 351: ...April 8 2013 351...