Repository navigation
Comparing changes
Open a pull request
base repository: FrameworkComputer/framework-system
base: main
head repository: FrameworkComputer/framework-system
compare: sealed-analysis
- 18 commits
- 2 files changed
- 2 contributors
Commits on Dec 1, 2026
-
--smartbattery: Retry MAC reads that race with the EC
The EC reads OperationStatus (0x0054) through ManufacturerAccess on every charge loop iteration, in battery_get_disconnect_state() for batteries with FUEL_GAUGE_FLAG_MFGACC, e.g. NVT FRANDBAT01. If that lands between our write to 0x00 and our read from 0x44, we get the response for the EC's command. That happened on a few of every 30 reads. Retry a few times before giving up. Always read the maximum block length, because the EC's response can be longer than the one we expect. It also works the other way around: if our write lands in between the EC's, the EC sees a mismatched echo and treats the battery as disconnected for one charge loop iteration. In normal operation that only delays leaving charge manager safe mode by one iteration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for ecca491 - Browse repository at this point
Copy the full SHA ecca491View commit details -
--smartbattery: Read status and lifetime data without unsealing
The SBS register aliases 0x50-0x77 (SafetyStatus, OperationStatus, LifeTimeDataBlock1-5, StateOfHealth, ...) NAK in SEALED mode, so without an unseal key none of this data was shown. The same data is available through ManufacturerBlockAccess (write the sub-command to 0x00, read 0x44), which works in SEALED mode too. Use that path in both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 234642c - Browse repository at this point
Copy the full SHA 234642cView commit details -
--smartbattery: Show more SBS registers available while sealed
Read and display registers the gauge answers in SEALED mode: - RunTimeToEmpty, AverageTimeToEmpty, AverageTimeToFull - StateOfHealth (0x4F, percent of design capacity) and MaxError - RemainingCapacityAlarm / RemainingTimeAlarm and BTP set points - SpecificationInfo and ManufacturerInfo - Turbo registers: max/sustained power and current, pack and system resistance, minimum system voltage Not every firmware revision has all of them, so they're optional and only written to and read from dump files when present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 394936b - Browse repository at this point
Copy the full SHA 394936bView commit details -
--smartbattery: Decode charging, gauging and DA status
Read and decode more ManufacturerAccess blocks, all accessible while sealed: - ChargingStatus (0x0055): temperature and voltage region, inhibit, suspend, termination flags. R3 inserted SU at bit 13, shifting the higher bits, so decode depending on R2/R3. - GaugingStatus (0x0056): Impedance Track state, e.g. whether QMax and resistance learning is qualified. - DAStatus1 (0x0071): per-cell voltage, current and power, BAT and PACK pin voltages, power and average power. - DAStatus2 (0x0072): internal, TS1-TS4, cell, FET and gauging temperatures. Out of range values are shown as not connected. - CBStatus (0x0076): calculated cell balancing time per cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for bacf62e - Browse repository at this point
Copy the full SHA bacf62eView commit details -
--smartbattery: Decode bq40z50-R4 status additions
Our packs (device 0x4500, FW 03.09) behave like the R4 TRM (SLUUCH2), which adds a few fields on top of R3: - ChargingStatus bits 22-23: charge degradation mode - GaugingStatus bit 14: OCVPRED - DAStatus2: cell voltages without IR loss compensation after the temperatures. The TRM also lists a User Temperature before them, but the packs return 24 bytes with 4 voltages at the end, so take those. These bits are reserved on R3, so decoding them there is harmless. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 90e6686 - Browse repository at this point
Copy the full SHA 90e6686View commit details -
EXAMPLES_ADVANCED: Update --smartbattery example
Show the output with everything that's now readable without unsealing, from a Framework Laptop 16 (AMD Ryzen AI 300) battery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for c4c1f2f - Browse repository at this point
Copy the full SHA c4c1f2fView commit details -
--smartbattery: Read Impedance Track status and time in ranges
Read and display more ManufacturerAccess blocks, all accessible while sealed: - GaugeStatus1 (0x0073): true FCC and temperature compensated resistance per cell - GaugeStatus2 (0x0074): learned status of QMax and resistance table - GaugeStatus3 (0x0075): QMax (chemical capacity) per cell - LifeTime Data Blocks 6-12 (0x0065-0x006B): time spent in each RSOC range, one block per charge temperature range. Shown with the range names, because the temperature thresholds are in data flash, which can't be read while sealed. Not every firmware revision has them, so don't fail without them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 50ff01d - Browse repository at this point
Copy the full SHA 50ff01dView commit details -
--smartbattery: Analyze health based on TI's checks
Collect the analysis into findings with a severity, so they can be tested, and check more of the data that's readable while sealed. Use the bq40z50 protection and permanent fail defaults as thresholds where there is one. New checks: - Decoded Safety/PF status, and Safety/PF alerts about to trip - Cell capacity imbalance from per cell QMax (QIM threshold 10%) - Cell resistance imbalance - Lifetime cell balancing time difference (CB threshold 40h) - Deep discharge, CUV and other safety events with the cycle of the last one, over-temperature and short-circuit in charge events - Gauge watchdog resets - Gauge learning: Capacity never or not recently re-learned, Impedance Track disabled, condition cycle requested, MaxError above 10% - Capacity fading faster than 8% per 100 cycles - Much time in high temperature ranges or above 90% charge Changes to existing checks: - Use the StateOfHealth FCC for capacity retention, which the gauge simulates at 25C and typical load, instead of the runtime FCC. - The gauge also sets TCA on normal charge termination and TDA when nearly empty, so don't warn about them then. - Cells diverge naturally when nearly empty, so like the gauge, only check the current voltage imbalance above 3.5V. Only note the historical maximum delta above 300mV. - Not charging to full is informational, it's expected with a charge limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 9070cf5 - Browse repository at this point
Copy the full SHA 9070cf5View commit details -
--smartbattery: Show charge temperature ranges when unsealed
ChargingStatus and LifeTime Data Blocks 6-12 refer to the charge temperature ranges (UT, LT, STL, RT, STH, HT, OT), but the thresholds between them are configured per pack in data flash. With TI's defaults the pack would report HT at 35C, but ours report STL, so they must be configured differently. When unsealed, read them through DataFlashAccess: block write the address to ManufacturerBlockAccess (0x44), then read 0x44. Only the address may be sent, further bytes would be written to data flash. The layout differs between revisions, tell them apart by the DAStatus2 length: - R3 (16 bytes): 0x4DC2, T1-T6 and one hysteresis - R4 (24 bytes): 0x4F03, T1-T6 and one hysteresis per threshold R2 stores them in different units and isn't supported. A failure to read them is logged and doesn't fail the rest. Not tested on hardware yet, needs the unseal key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for f516643 - Browse repository at this point
Copy the full SHA f516643View commit details -
--smartbattery: Check that unsealing worked
The gauge doesn't report a wrong unseal key, it just stays sealed. Since most data is readable while sealed now, everything else succeeded and only the data flash read failed, with the response of the EC's OperationStatus read still in ManufacturerBlockAccess. After sending the key, read OperationStatus and check that the security mode isn't SEALED anymore. Try twice, because the EC's own ManufacturerAccess writes can land between the two key words. Otherwise fail with a hint about the word order, without printing the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 191cc93 - Browse repository at this point
Copy the full SHA 191cc93View commit details -
--smartbattery: Read temperature ranges from the R3 address
Our packs report DAStatus2 with 24 bytes like the R4 TRM, so the temperature ranges were read from R4's data flash address 0x4F03. But FW 03.09 is an R3 firmware: what came back were R3 Elevated Degrade defaults (ERM Voltage Threshold 4000mV, ERM Time Threshold 10000h, ...), shown as temperatures over 2000C. Detect the revision by the firmware major version instead and only read the R3 layout at 0x4DC2 (T1-T6 and hysteresis). The R4 TRM doesn't say what version R4 firmware reports, so don't guess its address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for c396ac1 - Browse repository at this point
Copy the full SHA c396ac1View commit details -
--smartbattery: Show unused temperature ranges as such
Our packs set T5 = T6 = 45C, so the RT range is empty. Show it as not used instead of "45.0C - 45.0C". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for a6379c0 - Browse repository at this point
Copy the full SHA a6379c0View commit details -
--smartbattery: Label time in ranges with temperature thresholds
When unsealed, the temperature thresholds are known, so show them next to the range names in the time in temperature and charge ranges table, e.g. "STL 20-45C". Sealed output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 028fef0 - Browse repository at this point
Copy the full SHA 028fef0View commit details -
--smartbattery: Show known temperature ranges while sealed
The charge temperature thresholds are in data flash, which is only readable while unsealed. The EC's battery config only has the outer limits (charging_min_c/charging_max_c = T1/T4), not the ones between the ranges. Keep a table of thresholds read from real packs, by manufacturer and device name, and show them while sealed, marked as not read from the battery. For now only NVT FRANDBAT01: 0, 20, 45, 45, 52, 55C. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 5bdef4e - Browse repository at this point
Copy the full SHA 5bdef4eView commit details -
--smartbattery: Check time above 45C using the temperature ranges
The high temperature check counted the HT and OT rows of the time in ranges table. What they mean depends on the pack: with TI's defaults HT starts at 30C, on FRANDBAT01 at 52C, so time at 45-52C (STH) didn't count. When the thresholds are known (unsealed, or a known pack), count the ranges that start at 45C or above instead. Our packs reduce charging above 45C and the EC doesn't start charging above 45C on most packs. Otherwise keep counting HT and OT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 5ea441b - Browse repository at this point
Copy the full SHA 5ea441bView commit details -
--smartbattery: Add known temperature ranges of ATC FRANEDA
Read from a sakura pack (FW 03.09) while unsealed: 0, 10, 25, 35, 45, 60C, hysteresis 0C. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for 7645a62 - Browse repository at this point
Copy the full SHA 7645a62View commit details -
--smartbattery: Add known temperature ranges of more packs
Read while unsealed, all FW 03.09: - NVT FRANGWAT01: 0, 20, 45, 45, 45, 55C, hysteresis 1C - NVT Framework Laptop: 0, 20, 45, 45, 45, 55C, hysteresis 1C - ATC FRANDZG: 0, 10, 10, 45, 60, 60C, hysteresis 0C T1 and T4 match charging_min_c and charging_max_c in the EC's battery configs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for c2699d8 - Browse repository at this point
Copy the full SHA c2699d8View commit details -
--smartbattery: Name known packs by capacity
Device names don't say which battery it is, so add the capacity to each entry's comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration menu - View commit details
-
Copy full SHA for c658788 - Browse repository at this point
Copy the full SHA c658788View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...sealed-analysis