-
Notifications
You must be signed in to change notification settings - Fork 2
EEPROM Error Logger
The TM4C EEPROM is being used to implement a ring buffer to store error messages. The EEPROM has 96 blocks of 16 words each, and as of now (Jan 29, 2020), only block 1 is being used for other purposes. To set the block range used by the buffer, set macros EBUF_MINBLK and EBUF_MAXBLK in utils.h
. The buffer will use every block in the range [EBUF_MINBLK, EBUF_MAXBLK], inclusive. After changing buffer size, or if the EEPROM is ever reset, use the CLI command buffer_reset
.
Each buffer entry is one 4-byte word, currently configured as such
2 bytes | 4 bits | 5 bits | 7 bits |
---|---|---|---|
timestamp | message counter | error code | error data |
The sizes of the counter, error code and error data can be set by COUNTER_OFFSET, ERRCODE_OFFSET, and ERRDATA_OFFSET
errbuffer_put(ebuf, errcode, errdata)
is used to put a new entry in the buffer.
From the CLI, buffer_in <code>
can be used to manually add an error code, and buffer_out <n>
prints n past entries.
The error codes currently in use are listed below.
error code | data |
---|---|
RESTART | N/A |
RESET_BUFFER | N/A |
TEMP_HIGH(status) | Temperature (C) |
The temperature warnings are the only warnings with the most significant bit set to 1. The remaining 4 bits hold the status integer, which describes which devices are over their threshold temperatures. The temperature stored in the data field corresponds to that of the device furthest over its threshold temperature.
The counter keeps track of repeated entries with the same error code. The first instance of an error code is recorded in its own entry, and the second instance creates another entry in which the counter will increment for as many times as the error code is repeated. If the counter reaches its maximum value, a new entry will be made, starting again at 0.
For the sake of the EEPROM endurance, the counter is only updated in the EEPROM entry for every few messages it receives, determined by COUNTER_UPDATE. The error data and timestamp are also updated with the counter.
The (most accurate) counter, stored in software, can be viewed by calling buffer_info
.