English
Language : 

XC164-16 Datasheet, PDF (341/417 Pages) Infineon Technologies AG – 16-Bit Single-Chip Microcontroller with C166SV2 Core Volume 2 (of 2): Peripheral Units
XC164-16 Derivatives
Peripheral Units (Vol. 2 of 2)
TwinCAN Module
register MSGCFGn.
Message objects can be provided with a FIFO buffer. The buffer size is determined by
bitfield FSIZE in the FIFO/Gateway control register MSGFGCRn.
For transmit message objects, the object property assignment can be already finished
by setting MSGVAL to ‘10’, before the corresponding data partition has been initialized.
If bitfield CPUUPD is set to ‘10’, an incoming remote frame with matching identifier is
kept in mind via setting TXRQ internally, but is not immediately answered by a
corresponding data frame. The message data, stored in register MSGDRn0/MSGDRn4,
can be updated as long as CPUUPD is hold on ‘10’. As soon as CPUUPD is reset to ‘01’,
the respective data frame is transmitted by the associated CAN node controller.
21.1.7.3 Controlling a Message Transfer
Figure 21-23 illustrates the handling of a transmit message object. The initialization of
the message object properties is always started with disabling the message object via
MSGVAL = ‘01’. After resetting some control flags (INTPND, RMTPND, TXRQ and
NEWDAT), the transfer direction and the identifier are defined. The message object
initialization is finished by setting MSGVAL to ‘10’.
An update of a transmit message data partition should be prepared by setting CPUUPD
to ‘10’ followed by a write access to the MSGDRn0/MSGDRn4 register. The data
partition update must be indicated by the CPU via setting NEWDAT to ‘10’. Afterwards,
bit CPUUPD must be reset to ‘01’, if an automatic message handling is requested. In this
case, the data transmission is started, when flag TXRQ in register MSGCTRn has been
set to ‘10’ by software or by the respective CAN node hardware due to a received remote
frame with matching identifier. If CPUUPD remains set, the CPU must initiate the data
transmission by setting TXRQ to ‘10’ and disabling CPUUPD. If a remote frame with an
accepted identifier arrives during the update of a message object’s data storage, bit
TXRQ and RMTPND are automatically set to ‘10’ and the transmission of the
corresponding data frame is automatically started by the CAN controller when CPUUPD
is reset again.
Figure 21-24 demonstrates the handling of a receive message object. The initialization
of the message object properties is embedded between disabling and enabling the
message object via MSGVAL as described above. After setting MSGVAL to ‘10’, the
transmission of a remote frame can be initiated by the CPU via TXRQ = ‘10’. The
reception of a data frame is indicated by the associated CAN node controller via
NEWDAT = ‘10’. The processing of the received data frame, stored in register
MSGDRn0/MSGDRn4, should be started by the CPU with resetting NEWDAT to ‘01’.
After scanning flag MSGLST, indicating a loss of the previous message, the received
information should be copied to an application data buffer in order to release the
message object for a new data frame. Finally, NEWDAT should be checked again to
ensure, that the processing was based on a consistent set of data and not on a part of
an old message and part of the new message.
User’s Manual
TwinCAN_X41, V2.1
21-41
V2.1, 2004-03