BAT32G1x9 user manual | Chapter 22 CAN control
927 / 1149
Rev.1.02
22.9.3
Receive history list function
The Receive History List (RHL) function in the Receive History List records the number of receive
message buffers that are received and stored for each data frame or remote frame. RHL consists of a storage
element equivalent to up to 23 messages, the last packet-in pointer (LIPT) has the corresponding CnLIPT
register and the Receive History List Fetch Pointer (RGPT) has the corresponding CnRGPT register.
Immediately after the CAN module transitions from initialization mode to one of the modes of operation,
the RHL is immediately left undefined.
The CnLIPT register contains the contents of the RHL element indicated by the value of the LIPT pointer
minus 1. Therefore, by reading the CnLIPT register, it is possible to check the number of packet buffers that
receive and store the data frame or remote frame first. The LIPT pointer is used as a write pointer to indicate
which part of the RHLa packet buffer number is logged. Whenever a data frame or remote frame is received
and stored, the corresponding message buffer number is logged to the RHL element indicated by the LIPT
pointer. Each time you record to THEHL, the LIPT pointer is automatically incremented. This way, the
number of packet buffers that receive and store frames is recorded in chronological order.
The RGPT pointer is used as a read pointer to read the message buffer number of the record from
THEL. This pointer indicates the first RHL element that the CPU has not yet read. By reading the CnRGPT
registers on a per-software basis, you can read the number of packet buffers that have received and stored
data frames or remote frames. Each time the message buffer number is read from the CnRGPT register,
the RGPT pointer is automatically incremented.
If the value of the RGPT pointer matches the value of the LIPT pointer, the RHPM bit of the CnRGPT
register (receive history list pointer matches) is set to 1. This indicates that the unread packet buffer number in
THEHL is not retained. If a new message buffer number is logged, the LIPT pointer is incremented, and since
its value no longer matches the value of the RGPT pointer, the RHPM bit is cleared. In other words, the
number of unread packet buffers exists in THER.
If the LIPT pointer increments and matches the value of the RGPT pointer minus 1, the ROVF bit of the
CnRGPT register (Receive History List Overflow) is set to 1. This indicates that the RHL is filled with the
number of packet buffers that have not yet been read. When further packets are received and stored, the
message buffer number of the last record is overwritten by the number of packet buffers received and stored
for the new message. In this case, after setting the ROVF bit (1), the packet buffer numbers recorded in the
RHL are not in exact chronological order. However, the message itself is not lost and can be located in the
message buffer memory with the help of DN bits through CPU search.
Note: If the history list is in an overflow condition (ROVF is set), it is still possible to read the
contents of the history list until the history list is empty (indicated by the RHPM flag).
However, the history list remains in an overflow state until the ROVF is cleared by
software. If the ROVF is not cleared, the RHPM flag is also not updated (cleared) on the
message of the newly received frame. This can lead to the situation where THE RHPM
represents an empty history list, although a reception has occurred and the history list is in
an overflow state (ROVF and RHPM are set).