1# i2c_capture_bytes
2
3## Description
4
5Captures device register bytes to be stored in an error log.
6
7Reads the specified device register and temporarily stores the value. If a
8subsequent action (such as [log_phase_fault](log_phase_fault.md)) creates an
9error log, the captured bytes will be stored in the error log.
10
11This action allows you to capture additional data about a hardware error. The
12action can be used multiple times if you wish to capture data from multiple
13registers or devices before logging the error.
14
15Communicates with the device directly using the
16[I2C interface](i2c_interface.md). All of the bytes will be read in a single I2C
17operation.
18
19The bytes will be stored in the error log in the same order as they are received
20from the device. For example, a PMBus device transmits byte values in
21little-endian order (least significant byte first).
22
23Note: This action should only be used after a hardware error has been detected
24to avoid unnecessary I2C operations and memory usage.
25
26## Properties
27
28| Name     | Required | Type   | Description                                                                                                                                         |
29| :------- | :------: | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
30| register |   yes    | string | Device register address expressed in hexadecimal. Must be prefixed with 0x and surrounded by double quotes. This is the location of the first byte. |
31| count    |   yes    | number | Number of bytes to read from the device register.                                                                                                   |
32
33## Return Value
34
35true
36
37## Example
38
39```
40{
41  "comments": [ "Capture 2 bytes from register 0xA0 to store in error log" ],
42  "i2c_capture_bytes": {
43    "register": "0xA0",
44    "count": 2
45  }
46}
47```
48