
M0A21/M0A23 Series
May 06, 2022
Page
609
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
GPC0, GPC1, GPC2, GPC3, GPC4, GPC5,
GPC6, GPC7
MFP19
GPD2, GPD6
MFP3
6.16.5 Functional Description
Software Initialization
The software initialization is started by setting the Init bit (CAN_CON[0]), either by a software or a
hardware reset, or by going to bus-off state.
While the Init bit is set, all messages transfer to and from the CAN bus are stopped and the status of
the CAN_TX output pin is recessive (HIGH). The Error Management Logic (EML) counters are
unchanged. Setting the Init bit does not change any configuration register.
To initialize the CAN Controller, software has to set up the Bit Timing Register and each Message
Object. If a Message Object is not required, the corresponding MsgVal bit (CAN_IFn_ARB2[15]) should
be cleared. Otherwise, the entire Message Object has to be initialized.
Access to the Bit Timing Register and to the Baud Rate Prescaler Extension Register for configuring bit
timing is enabled when both the Init and CCE (CAN_CON[6]) bits are set.
Resetting the Init bit (by software only) finishes the software initialization. Later, the Bit Stream Processor
(BSP) (see Section 6.16.7.15: Configuring the Bit Timing) synchronizes itself to the data transfer on the
CAN bus by waiting for the occurrence of a sequence of 11 consecutive recessive bits (= Bus Idle)
before it can take part in bus activities and start the message transfer.
The initialization of the Message Objects is independent of Init and can be done on the fly, but the
Message Objects should all be configured to particular identifiers or set to not valid before the BSP
starts the message transfer.
To change the configuration of a Message Object during normal operation, the software has to start by
resetting the corresponding MsgVal bit. When the configuration is completed, MsgVal bit is set again.
CAN Message Transfer
Once the C_CAN is initialized and Init bit (CAN_CON[0]) is reset to zero, the C_CAN Core synchronizes
itself to the CAN bus and starts the message transfer.
Received messages are stored in their appropriate Message Objects if they pass the Message Handler’s
acceptance filtering. The whole message including all arbitration bits, DLC (CAN_IFn_MCON[3:0]) and
eight data bytes (CAN_IFn_DAT_A1/2; CAN_IFn_DAT_B1/2) are stored in the Message Object. If the
Identifier Mask is used, the arbitration bits which are masked to “don’t care” may be overwritten in the
Message Object.
Software can read or write each message any time through the Interface Registers and the Message
Handler guarantees data consistency in case of concurrent accesses.
Messages to be transmitted are updated by the application software. If a permanent Message Object
(arbitration and control bits are set during configuration) exists for the message, only the data bytes are
updated and the TxRqst bit (CAN_IFn_MCON[8]) with NewDat bit (CAN_IFn_MCON[15]) are set to start
the transmission. 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. Message
objects are transmitted subsequently according to their internal priority. Messages may be updated or
set to not valid any time, even when their requested transmission is still pending. The old data will be
discarded when a message is updated before its pending transmission has started.
Depending on the configuration of the Message Object, the transmission of a message may be
requested autonomously by the reception of a remote frame with a matching identifier.