|
PF1550 Driver
API reference
|
Namespaces | |
| namespace | profiles |
Classes | |
| class | BusInterface |
| CRTP template interface for PF1550 bus and strap pins. More... | |
| struct | DiagnosticSnapshot |
Full diagnostic snapshot returned by PF1550::ReadDiagnosticSnapshot(). More... | |
| struct | FaultFlags |
| Bitset of latched fault flags. More... | |
| struct | IntCategoryBits |
| Bit positions within INT_CATEGORY (Reg 0x06). More... | |
| struct | LdoCtrlBits |
Bit positions within LDOn_CTRL (0x4D / 0x50 / 0x53). More... | |
| struct | LdoIntStat0Bits |
| Bit positions within LDO_INT_STAT0 (Reg 0x18) — LDO current-limit faults. More... | |
| struct | MiscIntStat0Bits |
| Bit positions within MISC_INT_STAT0 (Reg 0x28, Table 108). Bits 7:5 are unused. More... | |
| struct | OtpRegion |
| OTP memory indirect address range (via FMRADDR/FMRDATA). More... | |
| struct | OtpUnlockKeys |
| OTP indirect-read unlock sequence (Section 12.x KEY1 / KEY2 / KEY3). More... | |
| class | PF1550 |
| CRTP-based PF1550 PMIC driver. More... | |
| struct | RailDiagnostics |
| Per-rail status snapshot (latched + live + control byte). More... | |
| struct | SelfTestResult |
| Result of a power self-test pass. More... | |
| struct | SwCtrlBits |
Bit positions within SWn_CTRL (e.g. 0x35 / 0x3B / 0x41). More... | |
| struct | SwIntStat0Bits |
| Bit positions within SW_INT_STAT0 (Reg 0x08) — low-side current-limit faults. More... | |
| struct | SwIntStat1Bits |
| Bit positions within SW_INT_STAT1 (Reg 0x0B, Table 93) — high-side current-limit faults. SW_INT_SENSE1 (0x0D) uses the same layout. More... | |
| struct | TempIntStat0Bits |
| Bit positions within TEMP_INT_STAT0 (Reg 0x20, Table 102). Bit 1 is unused. More... | |
Enumerations | |
| enum class | RailId : uint8_t { Sw1 = 0 , Sw2 = 1 , Sw3 = 2 , Ldo1 = 3 , Ldo2 = 4 , Ldo3 = 5 , Vsnvs = 6 , COUNT = 7 } |
| Logical identifier for each independently-controllable PF1550 output. More... | |
| enum class | FaultSeverity : uint8_t { kInfo = 0 , kWarning = 1 , kCritical = 2 , kMcuKill = 3 } |
| Severity classification for a fault. More... | |
| enum class | CtrlPin : uint8_t { Standby = 0 , UsbVbusEn = 1 , UsbOtgEn = 2 , PmicInt = 3 } |
| Platform-wired PF1550 control signals (beyond I2C). More... | |
| enum class | GpioSignal : uint8_t { Inactive = 0 , Active = 1 } |
| enum class | PowerMode : uint8_t { Run = 0 , Standby = 1 } |
| enum class | Register : uint8_t { DeviceId = 0x00 , OtpFlavor = 0x01 , SiliconRev = 0x02 , IntCategory = 0x06 , SwIntStat0 = 0x08 , SwIntMask0 = 0x09 , SwIntSense0 = 0x0A , SwIntStat1 = 0x0B , SwIntMask1 = 0x0C , SwIntSense1 = 0x0D , SwIntStat2 = 0x0E , SwIntMask2 = 0x0F , SwIntSense2 = 0x10 , LdoIntStat0 = 0x18 , LdoIntMask0 = 0x19 , LdoIntSense0 = 0x1A , TempIntStat0 = 0x20 , TempIntMask0 = 0x21 , TempIntSense0 = 0x22 , OnKeyIntStat0 = 0x24 , OnKeyIntMask0 = 0x25 , OnKeyIntSense0 = 0x26 , MiscIntStat0 = 0x28 , MiscIntMask0 = 0x29 , MiscIntSense0 = 0x2A , CoinCellCtrl = 0x30 , Sw1Volt = 0x32 , Sw1StbyVolt = 0x33 , Sw1SlpVolt = 0x34 , Sw1Ctrl = 0x35 , Sw1Ctrl1 = 0x36 , Sw2Volt = 0x38 , Sw2StbyVolt = 0x39 , Sw2SlpVolt = 0x3A , Sw2Ctrl = 0x3B , Sw2Ctrl1 = 0x3C , Sw3Volt = 0x3E , Sw3StbyVolt = 0x3F , Sw3SlpVolt = 0x40 , Sw3Ctrl = 0x41 , Sw3Ctrl1 = 0x42 , VsnvsCtrl = 0x48 , VrefDdrCtrl = 0x4A , Ldo1Volt = 0x4C , Ldo1Ctrl = 0x4D , Ldo2Volt = 0x4F , Ldo2Ctrl = 0x50 , Ldo3Volt = 0x52 , Ldo3Ctrl = 0x53 , PwrCtrl0 = 0x58 , PwrCtrl1 = 0x59 , PwrCtrl2 = 0x5A , PwrCtrl3 = 0x5B , Sw1PwrDnSeq = 0x5F , Sw2PwrDnSeq = 0x60 , Sw3PwrDnSeq = 0x61 , Ldo1PwrDnSeq = 0x62 , Ldo2PwrDnSeq = 0x63 , Ldo3PwrDnSeq = 0x64 , VrefDdrPwrDnSeq = 0x65 , StateInfo = 0x67 , I2cAddrReg = 0x68 , Rc16Mhz = 0x6B , OtpKey1 = 0x6F , ChargerLedDuty = 0x9C , OtpKey2 = 0x9F , ChargerLedCtrl = 0x9E , VbusInCurrentLimit = 0x94 , FmrAddr = 0xC4 , FmrData = 0xC5 , TestRegKey3 = 0xDF , ChgInt = 0x80 , ChgIntMask = 0x82 , ChgIntOk = 0x84 , VbusSns = 0x86 , ChgSense = 0x87 } |
| Symbolic register addresses used by the PF1550 driver. More... | |
| enum class | PmicState : uint8_t { Wait = 0b000000 , Run = 0b001100 , Standby = 0b001101 , Sleep = 0b001110 , RegsDisable = 0b101011 , Unknown = 0xFF } |
| STATE_INFO[5:0] values (Reg 0x67) describing the PMIC state machine. More... | |
| enum class | ChargerState : uint8_t { PreCharge = 0 , FastCC = 1 , FastCV = 2 , EndOfCharge = 3 , Done = 4 , TimerFault = 6 , ThermSuspend = 7 , Off = 8 , BatteryOv = 9 , TempShutdown = 10 , LinearOnly = 12 , Unknown = 0xFF } |
| CHG_SNS[3:0] values (Reg 0x87) describing the charger sub-state. More... | |
| enum class | SwVoltageCode : uint8_t { V1_1 = 0x00 , V2_5 = 0x05 , V3_0 = 0x06 , V3_3 = 0x07 , V3_1 = 0x0D } |
| Common SW buck output voltage codes (RUN mode). More... | |
| enum class | LdoVoltageCode : uint8_t { V1_0 = 0x05 , V1_2 = 0x09 , V1_8 = 0x00 } |
| Common LDO output voltage codes used on Portenta H7 (Table 41). More... | |
Functions | |
| constexpr RailId | FaultRail (uint32_t single_flag) noexcept |
| Map a single fault flag to the rail it relates to, or RailId::COUNT if the fault is system-wide. | |
| constexpr FaultSeverity | FaultSeverityPortentaH7 (uint32_t single_flag) noexcept |
| Classify the severity of a Portenta H7 eval fault. | |
| constexpr FaultSeverity | WorstSeverityPortentaH7 (FaultFlags fl) noexcept |
| Return the worst-case severity across an aggregated bitmask. | |
| constexpr const char * | RailName (RailId id) noexcept |
Human-readable rail label ("SW1", "LDO2", …). | |
| constexpr const char * | PmicStateName (PmicState s) noexcept |
| Human-readable name for a PmicState enumerator. | |
| constexpr const char * | ChargerStateName (ChargerState s) noexcept |
| Human-readable name for a ChargerState enumerator. | |
| constexpr const char * | FaultSeverityName (FaultSeverity s) noexcept |
| Human-readable name for a FaultSeverity. | |
| constexpr uint16_t | SwCodeToMillivolts (uint8_t code) noexcept |
SW1 / SW2 output voltage, DVS disabled (OTP_SWx_DVS_SEL = 1). | |
| constexpr uint16_t | SwDvsCodeToMillivolts (uint8_t code) noexcept |
SW1 / SW2 output voltage, DVS enabled (OTP_SWx_DVS_SEL = 0): 0.6000 V + 12.5 mV × code (Table 31, left column), rounded to mV. | |
| constexpr uint8_t | SwDvsMillivoltsToCode (uint16_t mv) noexcept |
| Encode a DVS-enabled SW1 / SW2 voltage (Table 31, left column). | |
| constexpr uint16_t | Sw3CodeToMillivolts (uint8_t code) noexcept |
SW3 output voltage (Table 37): 1.80 V + 100 mV × SW3_VOLT[3:0]. | |
| constexpr uint8_t | SwMillivoltsToCode (uint16_t mv) noexcept |
| Build a 6-bit SW voltage code from millivolts (Portenta-verified codes). | |
| constexpr uint16_t | LdoCodeToMillivolts (uint8_t code, bool is_ldo2) noexcept |
| Decode a 5-bit LDO voltage register field to millivolts. | |
| constexpr uint16_t | VbusLimitRegToMilliamps (uint8_t reg_value) noexcept |
| Decode VBUS_IN_LIM_CNFG (absolute address 0x94) register byte to mA. | |
| constexpr uint8_t | VbusLimitMilliampsToReg (uint16_t mA) noexcept |
| Encode mA → VBUS_IN_LIM_CNFG (0x94) register byte (bits 7:3). | |
| constexpr uint16_t | SwCurrentLimitCodeToMilliamps (uint8_t code) noexcept |
Decode the SW3_CTRL1[1:0] (or SW1/SW2_CTRL1) current limit field. | |
| constexpr PmicState | DecodeStateInfo (uint8_t reg) noexcept |
| Convert STATE_INFO (0x67) full byte into a typed PmicState. | |
| constexpr ChargerState | DecodeChargerSense (uint8_t reg) noexcept |
| Convert CHG_SNS (0x87) into a typed ChargerState. | |
Variables | |
| constexpr uint8_t | kDefaultI2cAddress = 0x08 |
| Default 7-bit I²C slave address (settable via OTP — see Table 147). | |
| constexpr uint8_t | kExpectedDeviceId = 0x7C |
Expected DEVICE_ID[2:0] family identifier (PF1550 family = 100b). | |
| constexpr uint16_t | kVsnvsMillivolts = 3000 |
| VSNVS output voltage: fixed 3.0 V (VSNVS_CTRL has no voltage field, Table 127). | |
| constexpr uint8_t | kChargerPageBase = 0x80 |
| Base offset for Section 12.2 charger sub-page (see datasheet §12.2). | |
|
strong |
CHG_SNS[3:0] values (Reg 0x87) describing the charger sub-state.
|
strong |
Platform-wired PF1550 control signals (beyond I2C).
Portenta H7 mapping:
| Enumerator | |
|---|---|
| Standby | |
| UsbVbusEn | |
| UsbOtgEn | |
| PmicInt | |
|
strong |
Severity classification for a fault.
| Enumerator | |
|---|---|
| kInfo | |
| kWarning | |
| kCritical | |
| kMcuKill | |
|
strong |
|
strong |
|
strong |
STATE_INFO[5:0] values (Reg 0x67) describing the PMIC state machine.
|
strong |
|
strong |
Logical identifier for each independently-controllable PF1550 output.
Used to index into RailDiagnostics arrays and to label log lines.
|
strong |
Symbolic register addresses used by the PF1550 driver.
Names follow datasheet Table N — Register XXX - ADDR yy exactly so cross-reference is trivial. Charger-page registers (§12.2) are mapped to their kChargerPageBase-offset absolute addresses.
| Enumerator | |
|---|---|
| DeviceId | DEVICE_ID — Table 86. Bits[2:0] = family, [7:3] = |
| OtpFlavor | OTP_FLAVOR — Table 87. 0x00 = OTP not burned (A0EP). |
| SiliconRev | SILICON_REV — Table 88. Metal/full-layer/fab-fin identifiers. |
| IntCategory | INT_CATEGORY — Table 89. CHG/SW1/SW2/SW3/LDO/ONKEY/TEMP/MISC summary. |
| SwIntStat0 | SW_INT_STAT0 — low-side current limits (SW1/2/3). |
| SwIntMask0 | SW_INT_MASK0. |
| SwIntSense0 | SW_INT_SENSE0. |
| SwIntStat1 | SW_INT_STAT1 — high-side current limits. |
| SwIntMask1 | SW_INT_MASK1. |
| SwIntSense1 | SW_INT_SENSE1. |
| SwIntStat2 | SW_INT_STAT2 — DVS done. |
| SwIntMask2 | SW_INT_MASK2. |
| SwIntSense2 | SW_INT_SENSE2. |
| LdoIntStat0 | LDO_INT_STAT0 — Table 99. LDO1/2/3 current-limit faults. |
| LdoIntMask0 | LDO_INT_MASK0. |
| LdoIntSense0 | LDO_INT_SENSE0. |
| TempIntStat0 | TEMP_INT_STAT0 — Table 102. Junction-temperature events. |
| TempIntMask0 | TEMP_INT_MASK0. |
| TempIntSense0 | TEMP_INT_SENSE0. |
| OnKeyIntStat0 | ONKEY_INT_STAT0 — Table 105. Push / 1s/2s/3s/4s/8s long-press. |
| OnKeyIntMask0 | ONKEY_INT_MASK0. |
| OnKeyIntSense0 | ONKEY_INT_SENSE0. |
| MiscIntStat0 | MISC_INT_STAT0 — Table 108. PWRON / VSYS / RESETBMCU events. |
| MiscIntMask0 | MISC_INT_MASK0. |
| MiscIntSense0 | MISC_INT_SENSE0. |
| CoinCellCtrl | COINCELL_CONTROL — Table 111. LICELL charging configuration. |
| Sw1Volt | SW1_VOLT — RUN-mode voltage code (Table 31). |
| Sw1StbyVolt | SW1_STBY_VOLT — STANDBY-mode voltage. |
| Sw1SlpVolt | SW1_SLP_VOLT — SLEEP-mode voltage. |
| Sw1Ctrl | SW1_CTRL — EN/STBY_EN/OMODE/LPWR/DVSSPEED/FPWM/RDIS_ENB. |
| Sw1Ctrl1 | SW1_CTRL1 — SW1_ILIM[1:0] current limit + TMODE_SEL. |
| Sw2Volt | SW2_VOLT — Table 117. |
| Sw2StbyVolt | SW2_STBY_VOLT. |
| Sw2SlpVolt | SW2_SLP_VOLT. |
| Sw2Ctrl | SW2_CTRL — Table 120. |
| Sw2Ctrl1 | SW2_CTRL1 — SW2_ILIM[1:0]. |
| Sw3Volt | SW3_VOLT — Table 122. |
| Sw3StbyVolt | SW3_STBY_VOLT. |
| Sw3SlpVolt | SW3_SLP_VOLT. |
| Sw3Ctrl | SW3_CTRL. |
| Sw3Ctrl1 | SW3_CTRL1 — Table 126. SW3_ILIM[1:0] + SW3_TMODE_SEL (Portenta writes |
| VsnvsCtrl | VSNVS_CTRL — Table 127. RTC/SNVS backup LDO control. |
| VrefDdrCtrl | VREFDDR_CTRL — Table 128. DDR reference (unused on Portenta). |
| Ldo1Volt | LDO1_VOLT. |
| Ldo1Ctrl | LDO1_CTRL. |
| Ldo2Volt | LDO2_VOLT. |
| Ldo2Ctrl | LDO2_CTRL — must be written last in Portenta profile. |
| Ldo3Volt | LDO3_VOLT. |
| Ldo3Ctrl | LDO3_CTRL. |
| PwrCtrl0 | PWRCTRL0 — STANDBYDLY, STANDBYINV, POR_DLY, TGRESET. |
| PwrCtrl1 | PWRCTRL1 — PWRONDBNC, ONKEYDBNC, PWRONRSTEN, RESTARTEN, REGSCPEN. |
| PwrCtrl2 | PWRCTRL2 — WDI_EN, WDI_POL etc. |
| PwrCtrl3 | PWRCTRL3 — sequence delay etc. |
| Sw1PwrDnSeq | SW1_PWRDN_SEQ. |
| Sw2PwrDnSeq | SW2_PWRDN_SEQ. |
| Sw3PwrDnSeq | SW3_PWRDN_SEQ. |
| Ldo1PwrDnSeq | LDO1_PWRDN_SEQ. |
| Ldo2PwrDnSeq | LDO2_PWRDN_SEQ. |
| Ldo3PwrDnSeq | LDO3_PWRDN_SEQ. |
| VrefDdrPwrDnSeq | VREFDDR_PWRDN_SEQ. |
| StateInfo | STATE_INFO — Table 146. STATE[5:0] = Wait/RUN/STANDBY/SLEEP/REGS_DISABLE. |
| I2cAddrReg | I2C_ADDR — Table 147 (read-only, OTP-driven). |
| Rc16Mhz | RC_16MHZ — 16 MHz clock force, analog core overrides. |
| OtpKey1 | KEY1 unlock (write |
| ChargerLedDuty | LED_PWM — Table 170. LED_EN, LED_RAMP, LED_PWM[5:0] duty (Portenta writes |
| OtpKey2 | KEY2 unlock (write |
| ChargerLedCtrl | LED_CNFG — Table 172. LEDOVRD, LED_CFG, current, frequency (Portenta writes |
| VbusInCurrentLimit | VBUS input current limit ((mA/50) << 3 — Portenta uses 1500 mA → |
| FmrAddr | FMRADDR — OTP indirect address. |
| FmrData | FRMDATA — OTP indirect data. |
| TestRegKey3 | TEST_REG_KEY3 — third OTP unlock key (write |
| ChgInt | CHG_INT — Table 150. SUP_I/BAT2SOC_I/CHGREV_I/CHG_I. |
| ChgIntMask | CHG_INT_MASK. |
| ChgIntOk | CHG_INT_OK — Table 152. CHG_OK, BATT_OK, VBUS_OK. |
| VbusSns | VBUS_SNS — Table 153. VBUS_VALID, DPM_SNS, OVLO, UVLO. |
| ChgSense | CHG_SNS — Table 154. Charger mode (precharge, fast-cc, fast-cv, eoc …). |
|
strong |
Common SW buck output voltage codes (RUN mode).
Full encoding is code → V_out per datasheet Table 31:
OTP_SWx_DVS_SEL = 1): 1.10, 1.20, 1.35, 1.50, 1.80, 2.50, 3.00 V for codes 0..6, and 3.30 V for every code from 7 up.OTP_SWx_DVS_SEL = 0): 0.6000 V + 12.5 mV × code. These enumerators are DVS-disabled codes; SW3 uses Table 37 instead.Only the codes used on Arduino Portenta H7 eval are enumerated.
|
constexprnoexcept |
Human-readable name for a ChargerState enumerator.
|
constexprnoexcept |
Convert CHG_SNS (0x87) into a typed ChargerState.
|
constexprnoexcept |
Convert STATE_INFO (0x67) full byte into a typed PmicState.
Only STATE[5:0] carries meaning; upper bits are reserved.
|
constexprnoexcept |
Map a single fault flag to the rail it relates to, or RailId::COUNT if the fault is system-wide.
|
constexprnoexcept |
Human-readable name for a FaultSeverity.
|
constexprnoexcept |
Classify the severity of a Portenta H7 eval fault.
On other platforms the same flag may have a different severity (e.g. a board that runs the MCU from SW2 instead of SW3). Callers should provide board-specific overrides if they re-use the driver for non-Portenta wiring.
|
constexprnoexcept |
Decode a 5-bit LDO voltage register field to millivolts.
Per datasheet Table 41 (LDO1/2/3 voltage encoding):
0x00..0x0F cover 750 mV → 1500 mV (step 50 mV), codes 0x10..0x1F cover 1800 mV → 3300 mV (step 100 mV).0x00..0x0F cover 1800 mV → 3300 mV (step 100 mV).| code | Raw 5-bit value from LDOn_VOLT[4:0]. |
| is_ldo2 | true for LDO2 (Group B), false for LDO1/LDO3 (Group A). |
0 if reserved.
|
constexprnoexcept |
Human-readable name for a PmicState enumerator.
|
constexprnoexcept |
Human-readable rail label ("SW1", "LDO2", …).
|
constexprnoexcept |
SW3 output voltage (Table 37): 1.80 V + 100 mV × SW3_VOLT[3:0].
|
constexprnoexcept |
SW1 / SW2 output voltage, DVS disabled (OTP_SWx_DVS_SEL = 1).
Datasheet Rev. 7 Table 31, right column: eight set points, every code from 7 up is 3.30 V. Portenta H7 runs SW1 at 3.0 V and SW2 at 3.3 V — values that exist only in this table, so its SW1/SW2 are DVS-disabled. (In that mode the datasheet makes SWx_VOLT read-only.)
| Code | mV | Code | mV | |
|---|---|---|---|---|
| 0 | 1100 | 4 | 1800 | |
| 1 | 1200 | 5 | 2500 | |
| 2 | 1350 | 6 | 3000 | |
| 3 | 1500 | ≥ 7 | 3300 |
| code | Raw SWx_VOLT[5:0]. |
|
constexprnoexcept |
Decode the SW3_CTRL1[1:0] (or SW1/SW2_CTRL1) current limit field.
Encoded current limits per Tables 116, 121, 126:
00 → 1.0 A typical01 → 1.2 A typical10 → 1.5 A typical11 → 2.0 A typical
|
constexprnoexcept |
SW1 / SW2 output voltage, DVS enabled (OTP_SWx_DVS_SEL = 0): 0.6000 V + 12.5 mV × code (Table 31, left column), rounded to mV.
|
constexprnoexcept |
Encode a DVS-enabled SW1 / SW2 voltage (Table 31, left column).
Inverse of SwDvsCodeToMillivolts: accepts exactly the millivolt values that function returns (600 to 1388 mV on the 12.5 mV grid, rounded to mV).
0xFF when mv is not on the grid.
|
constexprnoexcept |
Build a 6-bit SW voltage code from millivolts (Portenta-verified codes).
Returns 0xFF if the requested voltage is not a verified Portenta setting. Use SwVoltageCode for the type-safe variant.
|
constexprnoexcept |
Encode mA → VBUS_IN_LIM_CNFG (0x94) register byte (bits 7:3).
Only common values are supported (10/100/500/1000/1500 mA). Out-of-grid requests return 0xFF.
|
constexprnoexcept |
Decode VBUS_IN_LIM_CNFG (absolute address 0x94) register byte to mA.
The VBUS input current limit field occupies bits [7:3] of the register and uses a non-linear lookup table (datasheet Table 58):
| code | mA | code | mA | |
|---|---|---|---|---|
| 0x00 | 10 | 0x10 | 700 | |
| 0x01 | 15 | 0x11 | 800 | |
| 0x02 | 20 | 0x12 | 900 | |
| 0x03 | 25 | 0x13 | 1000 | |
| 0x04 | 30 | 0x14 | 1500 (Portenta default) | |
| 0x05 | 35 | 0x15..0x1F | reserved | |
| 0x06 | 40 | |||
| 0x07 | 45 | |||
| 0x08 | 50 | |||
| 0x09 | 100 | |||
| … | … | |||
| 0x0F | 600 |
Portenta H7 writes (20 << 3) == 0xA0 (code 0x14 = 1500 mA).
| reg_value | Raw register byte (bits 2:0 ignored). |
0.
|
constexprnoexcept |
Return the worst-case severity across an aggregated bitmask.
|
inlineconstexpr |
Base offset for Section 12.2 charger sub-page (see datasheet §12.2).
|
inlineconstexpr |
Default 7-bit I²C slave address (settable via OTP — see Table 147).
|
inlineconstexpr |
Expected DEVICE_ID[2:0] family identifier (PF1550 family = 100b).
|
inlineconstexpr |
VSNVS output voltage: fixed 3.0 V (VSNVS_CTRL has no voltage field, Table 127).