17e2a549eSShawn McCarney# phase_fault_detection 27e2a549eSShawn McCarney 37e2a549eSShawn McCarney## Description 4*0dbce568SPatrick Williams 57e2a549eSShawn McCarneySpecifies how to detect and log redundant phase faults in a voltage regulator. 67e2a549eSShawn McCarney 7*0dbce568SPatrick WilliamsA voltage regulator is sometimes called a "phase controller" because it controls 8*0dbce568SPatrick Williamsone or more phases that perform the actual voltage regulation. 97e2a549eSShawn McCarney 10*0dbce568SPatrick WilliamsA regulator may have redundant phases. If a redundant phase fails, the regulator 11*0dbce568SPatrick Williamswill continue to provide the desired output voltage. However, a phase fault 12*0dbce568SPatrick Williamserror should be logged warning the user that the regulator has lost redundancy. 137e2a549eSShawn McCarney 147e2a549eSShawn McCarneyThe technique used to detect a phase fault varies depending on the regulator 15*0dbce568SPatrick Williamshardware. Often a bit is checked in a status register. The status register could 16*0dbce568SPatrick Williamsexist in the regulator or in a related I/O expander. 177e2a549eSShawn McCarney 187e2a549eSShawn McCarneyPhase fault detection is performed every 15 seconds. A phase fault must be 197e2a549eSShawn McCarneydetected two consecutive times (15 seconds apart) before an error is logged. 207e2a549eSShawn McCarneyThis provides "de-glitching" to ignore transient hardware problems. 217e2a549eSShawn McCarney 227e2a549eSShawn McCarneyPhase faults are detected and logged by executing actions: 23*0dbce568SPatrick Williams 24*0dbce568SPatrick Williams- Use the [if](if.md) action to implement the high level behavior "if a fault is 25*0dbce568SPatrick Williams detected, then log an error". 26*0dbce568SPatrick Williams- Detecting the fault 27*0dbce568SPatrick Williams - Use a comparison action like [i2c_compare_bit](i2c_compare_bit.md) to detect 28*0dbce568SPatrick Williams the fault. For example, you may need to check a bit in a status register. 29*0dbce568SPatrick Williams- Logging the error 30*0dbce568SPatrick Williams - Use the [i2c_capture_bytes](i2c_capture_bytes.md) action to capture 317e2a549eSShawn McCarney additional data about the fault if necessary. 32*0dbce568SPatrick Williams - Use the [log_phase_fault](log_phase_fault.md) action to log a phase fault 337e2a549eSShawn McCarney error. The error log will include any data previously captured using 347e2a549eSShawn McCarney i2c_capture_bytes. 357e2a549eSShawn McCarney 367e2a549eSShawn McCarneyThe actions can be specified in two ways: 37*0dbce568SPatrick Williams 38*0dbce568SPatrick Williams- Use the "rule_id" property to specify a standard rule to run. 39*0dbce568SPatrick Williams- Use the "actions" property to specify an array of actions that are unique to 407e2a549eSShawn McCarney this regulator. 417e2a549eSShawn McCarney 427e2a549eSShawn McCarneyThe default device for the actions is the voltage regulator. You can specify a 43*0dbce568SPatrick Williamsdifferent device using the "device_id" property. If you need to access multiple 44*0dbce568SPatrick Williamsdevices, use the [set_device](set_device.md) action. 457e2a549eSShawn McCarney 467e2a549eSShawn McCarney## Properties 47*0dbce568SPatrick Williams 487e2a549eSShawn McCarney| Name | Required | Type | Description | 49*0dbce568SPatrick Williams| :-------- | :-----------------: | :---------------------------- | :------------------------------------------------------------------------------------------------------------- | 507e2a549eSShawn McCarney| comments | no | array of strings | One or more comment lines describing the phase fault detection. | 517e2a549eSShawn McCarney| device_id | no | string | Unique ID of the [device](device.md) to access. If not specified, the default device is the voltage regulator. | 527e2a549eSShawn McCarney| rule_id | see [notes](#notes) | string | Unique ID of the [rule](rule.md) to execute. | 537e2a549eSShawn McCarney| actions | see [notes](#notes) | array of [actions](action.md) | One or more actions to execute. | 547e2a549eSShawn McCarney 557e2a549eSShawn McCarney### Notes 56*0dbce568SPatrick Williams 57*0dbce568SPatrick Williams- You must specify either "rule_id" or "actions". 587e2a549eSShawn McCarney 597e2a549eSShawn McCarney## Examples 60*0dbce568SPatrick Williams 617e2a549eSShawn McCarney``` 627e2a549eSShawn McCarney{ 637e2a549eSShawn McCarney "comments": [ "Detect phase fault using I/O expander" ], 647e2a549eSShawn McCarney "device_id": "io_expander", 657e2a549eSShawn McCarney "rule_id": "detect_phase_fault_rule" 667e2a549eSShawn McCarney} 677e2a549eSShawn McCarney 687e2a549eSShawn McCarney{ 697e2a549eSShawn McCarney "comments": [ "Detect N phase fault using I/O expander.", 707e2a549eSShawn McCarney "A fault occurred if bit 3 is ON in register 0x02.", 717e2a549eSShawn McCarney "Capture value of registers 0x02 and 0x04 in error log." ], 727e2a549eSShawn McCarney "device_id": "io_expander", 737e2a549eSShawn McCarney "actions": [ 747e2a549eSShawn McCarney { 757e2a549eSShawn McCarney "if": { 767e2a549eSShawn McCarney "condition": { 777e2a549eSShawn McCarney "i2c_compare_bit": { "register": "0x02", "position": 3, "value": 1 } 787e2a549eSShawn McCarney }, 797e2a549eSShawn McCarney "then": [ 807e2a549eSShawn McCarney { "i2c_capture_bytes": { "register": "0x02", "count": 1 } }, 817e2a549eSShawn McCarney { "i2c_capture_bytes": { "register": "0x04", "count": 1 } }, 827e2a549eSShawn McCarney { "log_phase_fault": { "type": "n" } } 837e2a549eSShawn McCarney ] 847e2a549eSShawn McCarney } 857e2a549eSShawn McCarney } 867e2a549eSShawn McCarney ] 877e2a549eSShawn McCarney} 887e2a549eSShawn McCarney``` 89