
CHAPTER 19 CAN CONTROLLER
Preliminary User’s Manual U16541EJ1V0UM
688
19.14 Time Stamp Function
CAN is an asynchronous, serial protocol. All nodes connected to the bus have a local, autonomous clock. As a
consequence, the clocks of the nodes have no relation (i.e., the clocks are asynchronous and may even have different
frequencies). But in some applications, a common time base over the network (global time base) is needed. In order
to build up a global time base, a time stamp (TS) function is used. The essential mechanism of a TS function is the
capture of timer values triggered by signals on the CAN bus.
19.14.1 Basic time stamp function
The CAN module supports the capturing of successfully received data frames upon occurrence of an event (basic
time stamp function). For the basic TS, a 16-bit timer with a capture and compare register in a microcontroller system
is used. In this case, the 16-bit capture timer unit captures the timer value according to a trigger signal (TSOUT)
provided by the CAN module. The CPU can retrieve the point in time when the event happened by reading the
captured value. In other words, the CPU can get the time stamp of a message received from the CAN bus.
TSOUT is generated by two source events selected by the TSSEL bit in the C0TS register.
SOF event (start of frame): TSSEL = 0
EOF event (last bit of end of frame): TSSEL = 1
The TSOUT signal has to be enabled by setting the TSEN bit in the C0TS register.
Figure 19-42. Timing Diagram of Capture Output Signal TSOUT
t
TSOUT
SOF
TSOUT toggles its level upon occurrence of the selected source event (in the timing diagram in Figure 19-42, the
SOF event is selected) during data frame reception. As a consequence, the function “capture on falling or rising
edge” has to be selected in the 16-bit timer in the microcontroller system.
The time stamp function is controlled by the TSLOCK bit in the C0TS register. When TSLOCK is cleared (0) upon
the selected source event, a TSOUT pulse is generated. If TSLOCK is set (1) upon the selected source event, a
TSOUT pulse is generated, but as soon as a data frame has been successfully received in message buffer 0, the
TSEN signal is automatically cleared (0) to prevent further time stamp pulses.
Thus, the toggle of TSOUT is
suppressed, and the time stamp value references a data frame in message buffer 0. The CPU does not need to react
quickly as the value will not be overwritten until TSEN is set (1) again. The basic TS function cannot be used while
the CAN module operates in “normal operating mode with automatic block transmission”.