BAT32G1x9 user manual | Chapter 22 CAN control
934 / 1149
Rev.1.02
22.10.2
Send history list function
The Transmission History List (THL) feature records the number of the packet buffer that sends data or
remote frames in the transmission history list. THL contains storage elements equivalent to up to seven
messages, the last outgoing message pointer (LOPT) with the corresponding CnLOPT register, and the
Transmit History List Fetch Pointer (TGPT) of the CnTGPT register.
After the CAN module transitions from initialization mode to one of the operating modes, THL will
immediately be left undefined.
The CnLOPT register contains the contents of the THL element indicated by the value of the LOPT
pointer minus 1. Therefore, by reading the CnLOPT register, it is possible to check the number of packet
buffers for the first transmitted data frame or remote frame. The LOPT pointer is used as a write pointer to
indicate which part of the THL of the packet buffer number is logged. Whenever a data frame or remote
frame is transmitted, the corresponding message buffer number is recorded to the THL element indicated
by the LOPT pointer. Each time the THL is recorded, the LOPT pointer is automatically incremented. In this
way, the packet buffer numbers of the frames received and stored are recorded in chronological order.
The TGPT pointer is used as a read pointer to read the message buffer number of the record from the
THL. This pointer indicates the first THL element that the CPU has not yet read. By reading the CnTGPT
registers by software, the number of packet buffers that have been transmitted can be read. Each time the
message buffer number is read from the CnTGPT register, the TGPT pointer is automatically incremented.
If the value of the TGPT pointer matches the value of the LOPT pointer, the THPM bit of the CnTGPT
register (transfer history list pointer matches) is set to 1. This indicates that no unread packet buffer
numbers are reserved in the TRL. If a new message buffer number is logged, the LOPT pointer will be
incremented, and since its value no longer matches the value of the TGPT pointer, the THPM bit will be
cleared. In other words, the number of unread packet buffers exists in the TRL.
If the LOPT pointer increments and matches the value of the TGPT pointer minus 1, the TOVF bit of
the CnTGPT register (transmission history list overflow) is set to 1. This indicates that the TRL is filled with
packet buffer numbers that have not yet been read. If a new message is received and stored, the last
recorded message buffer number is overwritten by the number of message buffers for subsequent
transmissions. After the TOVF bit is set to 1, the packet buffer numbers recorded in THL do not fully reflect
the chronological order. However, other transport packets can be found by CPU searches that apply to all
transmit packet buffers, unless the CPU has not already overwritten the transfer object in one of these
buffers before. A total of up to six transfers occur to complete the scan without THL overflow.
Note: If the history list is in an overflow condition (TOVF is set), the contents of the history list can still be read
until the history list is empty (indicated by the THPM flag). However, the history list remains in an
overflow state until TOVF is cleared by the software. If TOVF is not cleared, the THPM flag is not
updated (cleared) after a new message is successfully transmitted. This can lead to the situation
where THPM indicates an empty history list, although the transfer was successful and the history list
is in an overflow state (TOVF and THPM are set).
Note
m= 0
to
15