-
Notifications
You must be signed in to change notification settings - Fork 460
Description
Edit: The checksum errors where caused by my Arduino!
- The current issue is FullAccess / Unseal commands not working.
- DJI battery killer app works, so I attached some logic captures showing the differences between the two programs here, to hopefully improve it.
Hi! I'm trying to unseal this battery.
First I manually charged the cells in series with 12V @ 500mA, they charged slowly and very well balanced, with less than 50mV between cells.
The SBS is dead unless I apply 12V externally.
I used a small arduino board as USB-I2C bridge. Thanks, @Cleric-K!: #243 (comment)
But, I only received wrong PEC checksum.
I used a logic analyzer to make sure the bus was working, indeed it was! For example:
python comm_sbs_bqctrl.py -vvv --dev_address 0xb --chip BQ30z55 read ManufacturerAccess.Voltages
The captured response frame (Including dev. address) was:
17 0C E4 0E F6 0E 00 00 00 00 4E 1C 8D 31 09
CRC-8-CCITT matches the last crc byte, 09, but the first CRC seems to be wrong or use a different algo.
I bypassed all raise ValueError("Received {} from command {} with wrong PEC checksum" errors, and the output looked quite meaningful:
Opening i2c:1
Serial port COM6 opened
Importing comm_sbs_chips/BQ30z554.py
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.Voltages: 113>}
Query ManufacturerAccess.Voltages: 00 WORD=0x71
Write ManufacturerAccess: CMD=00 WORD=71 00
Raw ManufacturerAccess.Voltages response: 0c e4 0e f6 0e 00 00 00 00 4e 1c 8d 31 09
MA.Voltages: hex:e40ef60e000000004e1c8d31 struct Outputs voltage data values
CellVoltage0: 3812 mV Cell Voltage 0
CellVoltage1: 3830 mV Cell Voltage 1
CellVoltage2: 0 mV Cell Voltage 2
CellVoltage3: 0 mV Cell Voltage 3
BATVoltage: 7246 mV BAT Voltage
PACKVoltage: 1268500 mV PACK Voltage
Readings on Cell2, Cell3 and PACK looks strange...
This is a 3S battery, I've manually measured around 3.8V on each cell.
If I remove external power, I have few seconds before the SBS turns off, Pack voltage reads normal in this instant:
Raw ManufacturerAccess.Voltages response: 0c e3 0e f2 0e 00 00 00 00 2a 1c 7b 00 ca
MA.Voltages: hex:e30ef20e000000002a1c7b00 struct Outputs voltage data values
CellVoltage0: 3811 mV Cell Voltage 0
CellVoltage1: 3826 mV Cell Voltage 1
CellVoltage2: 0 mV Cell Voltage 2
CellVoltage3: 0 mV Cell Voltage 3
BATVoltage: 7210 mV BAT Voltage
PACKVoltage: 12300 mV PACK Voltage
The battery only has 422 cycles, which is not that much!
But no surprise these batteries fail quickly, they don't have balancing circuitry!
python comm_sbs_bqctrl.py -vvv --dev_address 0xb --chip BQ30z55 read CycleCount
Raw CycleCount response: a6 01 d5
CycleCount: 422 cycles Number of cycles the battery has experienced
python comm_sbs_bqctrl.py -vvv --dev_address 0xb --chip BQ30z55 monitor BQStatusBitsMA
Raw ManufacturerAccess.SafetyAlert response: 04 00 00 00 00 ce
MA.SafetyAlert: 0x00000000 bitfields Safety Alert bits
CELL_UNDERVOLTAGE: 0=Inactive [CUV] Cell Undervoltage
CELL_OVERVOLTAGE: 0=Inactive [COV] Cell Overvoltage
OVERCURRENT_CHG_TIER1: 0=Inactive [OCC1] Overcurrent in Charge 1st Tier
OVERCURRENT_CHG_TIER2: 0=Inactive [OCC2] Overcurrent in Charge 2nd Tier
OVERCURRENT_DIS_TIER1: 0=Inactive [OCD1] Overcurrent in Discharge 1st Tier
OVERCURRENT_DIS_TIER2: 0=Inactive [OCD2] Overcurrent in Discharge 2nd Tier
OVERLOAD_DIS: 0=Inactive [OLD] Overload in discharge
SHORT_CIRCUIT_CHG: 0=Inactive [SCC] Short circuit in charge
SHORT_CIRCUIT_DIS: 0=Inactive [SCD] Short circuit in discharge
OVERTEMPERATURE_CHG: 0=Inactive [OTC] Overtemperature in charge
OVERTEMPERATURE_DIS: 0=Inactive [OTD] Overtemperature in discharge
IR_COMPENSATED_CUV: 0=Inactive [CUVC] I*R compensated CUV
FET_OVERTEMPERATURE: 0=Inactive [OTF] FET overtemperature
HOST_WATCHDOG_TIMEOUT: 0=Inactive [HWD] SBS Host watchdog timeout
PRECHARGING_TIMEOUT: 0=Inactive [PTO] Pre-charging timeout
PRECHG_TIMEOUT_SUSPEND: 0=Inactive [PTOS] Pre-charging timeout suspend
CHARGING_TIMEOUT: 0=Inactive [CTO] Charging timeout
CHG_TIMEOUT_SUSPEND: 0=Inactive [CTOS] Charging timeout suspend
OVERCHARGE: 0=Inactive [OC] Overcharge
CHG_CURRENT_ABOVE_REQ: 0=Inactive [CHGC] Charging Current higher than requested
CHG_VOLTAGE_ABOVE_REQ: 0=Inactive [CHGV] Charging Voltage higher than requested
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.SafetyStatus: 81>}
Query ManufacturerAccess.SafetyStatus: 00 WORD=0x51
Write ManufacturerAccess: CMD=00 WORD=51 00
Raw ManufacturerAccess.SafetyStatus response: 04 01 00 00 00 d8
MA.SafetyStatus: 0x00000001 bitfields Safety Status bits
CELL_UNDERVOLTAGE: 1=Detected [CUV] Cell Undervoltage
CELL_OVERVOLTAGE: 0=Inactive [COV] Cell Overvoltage
OVERCURRENT_CHG_TIER1: 0=Inactive [OCC1] Overcurrent in Charge 1st Tier
OVERCURRENT_CHG_TIER2: 0=Inactive [OCC2] Overcurrent in Charge 2nd Tier
OVERCURRENT_DIS_TIER1: 0=Inactive [OCD1] Overcurrent in Discharge 1st Tier
OVERCURRENT_DIS_TIER2: 0=Inactive [OCD2] Overcurrent in Discharge 2nd Tier
OVERLOAD_DIS: 0=Inactive [OLD] Overload in discharge
OVERLOAD_DIS_LATCH: 0=Inactive [OLDL] Overload in discharge latch
SHORT_CIRCUIT_CHG: 0=Inactive [SCC] Short circuit in charge
SHORT_CIRC_CHG_LATCH: 0=Inactive [SCCL] Short circuit in charge latch
SHORT_CIRCUIT_DIS: 0=Inactive [SCD] Short circuit in discharge
SHORT_CIRC_DIS_LATCH: 0=Inactive [SCDL] Short circuit in discharge latch
OVERTEMPERATURE_CHG: 0=Inactive [OTC] Overtemperature in charge
OVERTEMPERATURE_DIS: 0=Inactive [OTD] Overtemperature in discharge
IR_COMPENSATED_CUV: 0=Inactive [CUVC] I*R compensated CUV
FET_OVERTEMPERATURE: 0=Inactive [OTF] FET overtemperature
HOST_WATCHDOG_TIMEOUT: 0=Inactive [HWD] SBS Host watchdog timeout
PRECHARGING_TIMEOUT: 0=Inactive [PTO] Pre-charging timeout
CHARGING_TIMEOUT: 0=Inactive [CTO] Charging timeout
OVERCHARGE: 0=Inactive [OC] Overcharge
CHG_CURRENT_ABOVE_REQ: 0=Inactive [CHGC] Charging Current higher than requested
CHG_VOLTAGE_ABOVE_REQ: 0=Inactive [CHGV] Charging Voltage higher than requested
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.PFAlert: 82>}
Query ManufacturerAccess.PFAlert: 00 WORD=0x52
Write ManufacturerAccess: CMD=00 WORD=52 00
Raw ManufacturerAccess.PFAlert response: 04 00 00 00 00 ce
MA.PFAlert: 0x00000000 bitfields Permanent Fail Alert bits
CELL_UNDERVOLTAGE: 0=Inactive [CUV] Cell Undervoltage
CELL_OVERVOLTAGE: 0=Inactive [COV] Cell Overvoltage
COPPER_DEPOSITION: 0=Inactive [CUDEP] Copper deposition
OVERTEMPERATURE: 0=Inactive [OTCE] Overtemperature in charge
OVERTEMPERATURE_FET: 0=Inactive [OTF] Overtemperature of FET
QMAX_IMBALANCE: 0=Inactive [QIM] QMAX Imbalance
CELL_BALANCING: 0=Inactive [CB] Cell balancing
CELL_IMPEDANCE: 0=Inactive [IMP] Cell impedance
CAPACITY_DETERIORATION: 0=Inactive [CD] Capacity Deterioration
VOLTAGE_IMBALANCE_REST: 0=Inactive [VIMR] Voltage imbalance at Rest
VOLTAGE_IMBALANCE_ACTV: 0=Inactive [VIMA] Voltage imbalance at Active
CHARGE_FET: 0=Inactive [CFETF] Charge FET
DISCHARGE_FET: 0=Inactive [DFET] Discharge FET
THERMISTOR: 0=Inactive [THERM] Thermistor
FUSE: 0=Inactive [FUSE] Fuse
AFE_REGISTER: 0=Not avail. [AFER] AFE Register
AFE_COMMUNICATION: 0=Inactive [AFEC] AFE Communication
FUSE_TRIGGER_2ND_LEVEL: 0=Inactive [2LVL] FUSE input trigger by external protection
OPEN_VCX: 0=Not avail. [OCECO] Open VCx
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.PFStatus: 83>}
Query ManufacturerAccess.PFStatus: 00 WORD=0x53
Write ManufacturerAccess: CMD=00 WORD=53 00
Raw ManufacturerAccess.PFStatus response: 04 04 08 00 00 c7
MA.PFStatus: 0x00000804 bitfields Permanent Fail Status bits
CELL_UNDERVOLTAGE: 0=Inactive [CUV] Cell Undervoltage
CELL_OVERVOLTAGE: 0=Inactive [COV] Cell Overvoltage
COPPER_DEPOSITION: 1=Detected [CUDEP] Copper deposition
OVERTEMPERATURE: 0=Inactive [OTCE] Overtemperature in charge
OVERTEMPERATURE_FET: 0=Inactive [OTF] Overtemperature of FET
QMAX_IMBALANCE: 0=Inactive [QIM] QMAX Imbalance
CELL_BALANCING: 0=Inactive [CB] Cell balancing
CELL_IMPEDANCE: 0=Inactive [IMP] Cell impedance
CAPACITY_DETERIORATION: 0=Inactive [CD] Capacity Deterioration
VOLTAGE_IMBALANCE_REST: 1=Active [VIMR] Voltage imbalance at Rest
VOLTAGE_IMBALANCE_ACTV: 0=Inactive [VIMA] Voltage imbalance at Active
CHARGE_FET: 0=Inactive [CFETF] Charge FET
DISCHARGE_FET: 0=Inactive [DFET] Discharge FET
THERMISTOR: 0=Inactive [THERM] Thermistor
FUSE: 0=Inactive [FUSE] Value of the FUSE pin, designed to ignite the chemical fuse if one of the various safety criteria is violated
AFE_REGISTER: 0=Not avail. [AFER] AFE Register
AFE_COMMUNICATION: 0=Inactive [AFEC] AFE Communication
FUSE_TRIGGER_2ND_LEVEL: 0=Inactive [2LVL] FUSE input trigger by external protection
PTC_BY_AFE: 0=Inactive [PTC] Detected overtemperature using Positive Temperature Coefficient resistor connected to AFE PTC pin
OPEN_VCX: 0=Not avail. [OCECO] Open VCx
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.OperationStatus: 84>}
Query ManufacturerAccess.OperationStatus: 00 WORD=0x54
Write ManufacturerAccess: CMD=00 WORD=54 00
Raw ManufacturerAccess.OperationStatus response: 04 21 7b 50 00 91
MA.OperationStatus: 0x00507b21 bitfields Operational Status bits
SYS_PRESENT_LOW: 1=Active [PRES] System present input state low
DSG_FET_STATUS: 0=Inactive [DSG] DSG FET status
CHG_FET_STATUS: 0=Inactive [CHG] CHG FET Status
PCHG_FET_STATUS: 0=Inactive [PCHG] PCHG FET Status
GPOD_FET_STATUS: 0=Inactive [GPOD] GPOD FET Status
FUSE_STATUS: 1=Active [FUSE] FUSE input status
CELL_BALANCING: 0=Inactive [CB] Cell Balancing
LED_ENABLE: 0=Inactive [LED] LED Enable
SECURITY_MODE: 3=Sealed [SEC] Security Mode
CAL_RAW_ADC_CC: 0=Inactive [CAL] Calibration Raw ADC/CC output active
SAFETY_STATUS: 1=Active [SS] Safety Status
PERMANENT_FAILURE: 1=Active [PF] Permanent Failure
DISCHARGING_DISABLED: 1=Active [XDSG] Discharging Disabled
CHARGING_DISABLED: 1=Active [XCHG] Charging Disabled
SLEEP_MODE: 0=Inactive [SLEEP] Sleep mode condition met
SHUTDOWN_BY_MA: 0=Inactive [SDM] Shutdown activated by ManufacturerAccess()
SHIP_MODE_BY_MA: 0=Inactive [SHPM] SHIP mode activated with ManufacturerAccess()
AUTH_ONGOING: 0=Inactive [AUTH] Authentication ongoing
AFE_WATCHDOG_FAIL: 0=Inactive [AWD] AFE Watchdog failure
FAST_VOLTAGE_SAMP: 1=Active [FVS] Fast Voltage Sampling
RAW_ADC_CC_OUTPUT: 0=Inactive [CALO] Raw ADC/CC offset calibration output
SHUTDOWN_BY_VOLTAGE: 1=Active [SDV] SHUTDOWN activated by voltage
SLEEP_BY_MA: 0=Inactive [SLEPM] SLEEP mode activated by ManufacturerAccess()
INIT_AFTER_RESET: 0=Inactive [INIT] Initialization after full reset
SMB_CAL_ON_LOW: 0=Cal starts [SLCAL] Auto CC offset calibration on low
QMAX_UPDATE_IN_SLEEP: 0=Inactive [SLEPQM] QMax update in SLEEP mode
CURRENT_CHK_IN_SLEEP: 0=Inactive [SLEPC] Checking current in SLEEP mode
XLOW_SPEED_STATE: 0=Inactive [XLSBS] Fast Mode
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.ChargingStatus: 85>}
Query ManufacturerAccess.ChargingStatus: 00 WORD=0x55
Write ManufacturerAccess: CMD=00 WORD=55 00
Raw ManufacturerAccess.ChargingStatus response: 03 00 00 00 21
MA.ChargingStatus: 0x000000 bitfields Charging Status bits
UNDER_TEMPERATURE: 0=Inactive [UT] Under Temperature Range
LOW_TEMPERATURE: 0=Inactive [LT] Low Temperature Range
STD_TEMPERATURE_LOW: 0=Inactive [STL] Standard Temperature Low Range
RECOMMENDED_TEMPERATURE: 0=Inactive [RT] Recommended Temperature Range
STD_TEMPERATURE_HIGH: 0=Inactive [STH] Standard Temperature High Range
HIGH_TEMPERATURE: 0=Inactive [HT] High Temperature Range
OVER_TEMPERATURE: 0=Inactive [OT] Over Temperature Range
PRECHARGE_VOLTAGE: 0=Inactive [PV] Precharge Voltage Range
LOW_VOLTAGE: 0=Inactive [LV] Low Voltage Range
MID_VOLTAGE: 0=Inactive [MV] Mid Voltage Range
HIGH_VOLTAGE: 0=Inactive [HV] High Voltage Range
CHARGE_INHIBIT: 0=Inactive [IN] Charge Inhibit
CHARGE_SUSPEND: 0=Inactive [SU] Charge Suspend
CHARGING_CURRENT_RATE: 0=Inactive [CCR] ChargingCurrent() Rate
CHARGING_VOLTAGE_RATE: 0=Inactive [CVR] ChargingVoltage() Rate
CHARGING_CURRENT_COMPNS: 0=Inactive [CCC] ChargingCurrent() Compensation
VALID_CHARGE_TERMINATN: 0=Inactive [VCT] Valid Charge Termination
MAINTENANCE_CHARGE: 0=Inactive [MCHG] Maintenance charge
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.GaugingStatus: 86>}
Query ManufacturerAccess.GaugingStatus: 00 WORD=0x56
Write ManufacturerAccess: CMD=00 WORD=56 00
Raw ManufacturerAccess.GaugingStatus response: 02 32 28 d8
MA.GaugingStatus: 0x2832 bitfields Gauging Status bits
OCV_QMAX_UPDATED: 0=Not upd. [RESTD0] OCV and QMax Updated
DISCHARGE_DETECTED: 1=Discharging [DSG] Discharge Detected
RESISTANCE_UPDATE: 0=Inactive [RU] Resistance update
VOLTAGE_OK_FOR_QMAX: 0=Inactive [VOK] Cell Voltage OK for QMax
QMAX_UPDATES: 1=Enabled [QEN] QMax updates
FULLY_DISCHARGED: 1=Enabled [FD] Fully Discharged Detected by gauge algorithm
FULLY_CHARGED: 0=Disabled [FC] Fully Charged Detected by gauge algorithm
NEG_SCALE_FACTOR: 0=Disabled [NSFM] Negative scale factor mode
DISCHARGE_QUALIFIED: 0=Disabled [VDQ] Discharge qualified for learning
QMAX_UPDATED_T: 0=Toggle0 [QMax] QMax updated toggle
RESISTANCE_UPDATE_T: 0=Disabled [RX] Resistance update toggle
LOAD_MODE: 1=C.Power [LDMD] Load Mode, constant current or power
OCV_FLAT_REGION: 0=Outside [OCVFR] OCV in flat region
TERMNT_DISCHG_ALARM: 1=Enabled [TDA] Terminate Discharge Alarm
TERMNT_CHARGE_ALARM: 0=Disabled [TCA] Terminate Charge Alarm
LIPH_RELAX_MODE: 0=Disabled [LPFRlx] LiPh Relax Mode
Reading write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.ManufacturingStatus: 87>}
Query ManufacturerAccess.ManufacturingStatus: 00 WORD=0x57
Write ManufacturerAccess: CMD=00 WORD=57 00
Raw ManufacturerAccess.ManufacturingStatus response: 02 f8 01 68
MA.ManufacturingStatus: 0x01f8 bitfields Manufacturing Status bits
PCHG_FUNCTION: 0=Disabled [PCHG] PCHG Function, only available with FET=0
CHG_FET: 0=Disabled [CHG] CHG FET, only available with FET=0
DSG_FET: 0=Disabled [DSG] DSG FET, only available with FET=0
GAUGING: 1=Enabled [GAUGE] Gauging
FET_ACTION: 1=Enabled [FET] FET action
LIFETIME_DT_COLL: 1=Enabled [LF] Lifetime data collection
PERMANENT_FAIL: 1=Enabled [PF] Permanent Failure functionality
BLACK_BOX_REC: 1=Enabled [BBR] Black box recorder
FUSE_ACTION: 1=Enabled [FUSE] FUSE action
LED_DISPLAY: 0=Disabled [LED] LED Display
CAL_ADC_CC_ON_MD: 0=Disabled [CAL] CAL ADC or CC output on ManufacturerData()
python comm_sbs_bqctrl.py -vvv --dev_address 0xb --chip BQ30z55 sealing Unseal
Opening i2c:1
Serial port COM6 opened
Importing comm_sbs_chips/BQ30z554.py
Write ManufacturerAccess: CMD=00 WORD=31 00
Raw ManufacturerAccess.UnSealDevice response: 02 1d 8d c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7 c7
Error: ValueError: Algorithm broken, length of challenge message M is 2 instead of 20 bytes
The output is different everytime, here're few more :
Raw ManufacturerAccess.UnSealDevice response: 02 96 02 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42
Raw ManufacturerAccess.UnSealDevice response: 02 d8 b1 df df df df df df df df df df df df df df df df df df df
Raw ManufacturerAccess.UnSealDevice response: 02 03 4e 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
Raw ManufacturerAccess.UnSealDevice response: 02 97 03 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50
Raw ManufacturerAccess.UnSealDevice response: 02 02 af bd bd bd bd bd bd bd bd bd bd bd bd bd bd bd bd bd bd bd
This makes nothing:
python comm_sbs_bqctrl.py -vvv --dev_address 0xb --chip BQ30z55 trigger ManufacturerAccess.PermanentFailDataReset
Writing write_word_subcommand command at addr=0xb, cmd=0x0, type=uint16, v=b'', opts={'subcmd': <MANUFACTURER_ACCESS_CMD_BQ30.PermanentFailDataReset: 41>}
Store ManufacturerAccess.PermanentFailDataReset: 00 WORD=0x29
Write ManufacturerAccess: CMD=00 WORD=29 00
MA.PermanentFailDataReset: trigger SUCCESS Trigger switch write accepted