![Altera Cyclone V Device Handbook Download Page 1011](http://html1.mh-extra.com/html/altera/cyclone-v/cyclone-v_device-handbook_29107911011.webp)
Setting the
Init
bit to 0 finishes the software initialization. The CAN core synchronizes itself to the data
transfer on the CAN bus by waiting for the bus to reach an idle state before it can take part in bus activities
and message transfers.
The initialization of the message objects is independent of the CAN controller initialization and can be done
anytime, but the message objects should all be configured to particular identifiers or set to not valid before
message transferring begins.
On power up, the message RAM has to be initialized. To initialize RAM, set the
Init
bit to 1, then set the
RAMInit
bit in the CAN function register (
CFR
) in the protocol group (
protogrp
) to 1. The
RAMInit
bit returns to 0 when RAM initialization completes. During RAM initialization, all message objects are
cleared to zero and the RAM ECC bits are initialized. Access to RAM is not allowed prior to or during RAM
initialization.
CAN Message Transfer
Once the CAN controller is initialized, the CAN controller synchronizes itself to the CAN bus and starts
transferring messages.
Received messages are stored to their appropriate message objects, if they pass the message handler's
acceptance filtering. The entire message, including all arbitration bits,
Xtd
,
Dir
,
DLC
, eight data bytes, the
mask and control bits
UMask
,
MXtd
,
MDir
,
EoB
,
MsgLst
,
RxIE
,
TxIE
, and
RmtEn
, is stored in the
message object. Masked arbitration bits might change in the message object when a received message is
stored.
The host processor may read or update each message at any time using the message interface registers. The
message handler guarantees data consistency when the host processor accesses the message object at the
same time the message is being transferred to or from RAM.
Messages to be transmitted are updated by the host processor. If a permanent message object (arbitration
and control bits set up during configuration are unchanged for multiple CAN transfers) exists for the message,
only the data bytes need to be updated. If several transmit messages are assigned to the same message object
(when the number of message objects is not sufficient), the whole message object has to be configured before
the transmission of this message is requested.
The transmission of any number of message objects may be requested at the same time they are transmitted,
according to their internal priority. The message object numbers are 1 to 128, with 1 being the lowest internal
priority and 128 the highest priority. Messages may be updated or set to invalid (
MsgVal
=0) at anytime,
even when their requested transmission is still pending. The old data is discarded when a message is updated
before its pending transmission has started.
Depending on the configuration on the message object, the transmission of a message may be requested
automatically by the reception of a remote frame with a matching identifier. Remote frames are frames used
to request a particular message on the CAN network.
For ease in programming, Altera recommends using one
IF
message interface for all receive direction
activity and the other
IF
message interface for all transmit direction activity.
Note:
Message Object Reconfiguration for Frame Reception
To configure a message object to receive data frames, set the
Dir
field to 0.
CAN Controller Introduction
Altera Corporation
cv_54025
CAN Message Transfer
25-12
2013.12.30