Skip to content

Commit 4cd4f99

Browse files
committed
BMS: force bench pack voltage to 60V under ADBMS master override
With no cell monitor attached the snapshot total voltage stays 0 and the precharge completion gate (IVT >= 90% of pack, pack > 0) can never pass, so bench precharge always timed out to FAULT_BMS. With FEB_BMS_DISABLE_ADBMS_CHECKS=1 both pack-voltage getters now return FEB_BMS_BENCH_PACK_VOLTAGE_V (default 60.0f, overridable) so precharge completes once the IVT reads >= 54V from the bench supply. Per-cell readings stay real; boot warning announces the forced value. IVT freshness, the 10s precharge timeout, and all other gates unchanged.
1 parent 54afa7a commit 4cd4f99

5 files changed

Lines changed: 25 additions & 3 deletions

File tree

BMS/Core/User/Inc/FEB_Const.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@
184184
// three enforcement overrides above (temp + primary/secondary voltage) and
185185
// additionally bypasses the cell-monitor data-staleness fault in
186186
// FEB_SM evaluate_faults() — the one check the per-domain macros don't cover.
187-
// Readings and diagnostics remain visible; only enforcement is suppressed.
187+
// Also forces the reported pack total voltage to FEB_BMS_BENCH_PACK_VOLTAGE_V
188+
// so precharge can complete against a low-voltage bench supply. Per-cell
189+
// readings and diagnostics remain visible; only enforcement is suppressed.
188190
// Logs warnings at boot while enabled. NEVER enable with a real pack.
189191
#ifndef FEB_BMS_DISABLE_ADBMS_CHECKS
190192
#define FEB_BMS_DISABLE_ADBMS_CHECKS 0
@@ -199,6 +201,15 @@
199201
#define FEB_BMS_DISABLE_SECONDARY_VOLT_CHECKS 1
200202
#endif
201203

204+
// With the master override enabled, both pack-voltage getters return this
205+
// value (volts) instead of the (absent) cell-monitor sum, so the precharge
206+
// completion gate (IVT >= 90% of pack) can pass with a bench supply: at the
207+
// default 60 V the IVT must read >= 54 V. Has no effect when the master
208+
// override is 0.
209+
#ifndef FEB_BMS_BENCH_PACK_VOLTAGE_V
210+
#define FEB_BMS_BENCH_PACK_VOLTAGE_V 60.0f
211+
#endif
212+
202213
// ********************************** Accumulator Structure **********************
203214

204215
typedef struct

BMS/Core/User/Src/FEB_ADBMS6830B.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,15 @@ void FEB_ADBMS_Temperature_Process()
673673

674674
float FEB_ADBMS_GET_ACC_Total_Voltage()
675675
{
676+
#if FEB_BMS_DISABLE_ADBMS_CHECKS
677+
/* Bench: no cell monitor — report the forced pack voltage (see FEB_Const.h) */
678+
return FEB_BMS_BENCH_PACK_VOLTAGE_V;
679+
#else
676680
osMutexAcquire(ADBMSMutexHandle, osWaitForever);
677681
float voltage = FEB_ACC.total_voltage_V;
678682
osMutexRelease(ADBMSMutexHandle);
679683
return voltage;
684+
#endif
680685
}
681686

682687
float FEB_ADBMS_GET_ACC_MIN_Voltage()
@@ -1001,7 +1006,12 @@ uint32_t FEB_ADBMS_Get_Last_Update_Tick(void)
10011006

10021007
float FEB_ADBMS_Snapshot_Total_Voltage(void)
10031008
{
1009+
#if FEB_BMS_DISABLE_ADBMS_CHECKS
1010+
/* Bench: no cell monitor — report the forced pack voltage (see FEB_Const.h) */
1011+
return FEB_BMS_BENCH_PACK_VOLTAGE_V;
1012+
#else
10041013
return adbms_snap_total_V;
1014+
#endif
10051015
}
10061016

10071017
float FEB_ADBMS_Snapshot_Max_Cell_Voltage(void)

BMS/Core/User/Src/FEB_Main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void FEB_Init(void)
109109
LOG_W(TAG_MAIN, "ALL ADBMS CHECKS DISABLED (FEB_BMS_DISABLE_ADBMS_CHECKS=1)");
110110
LOG_W(TAG_MAIN, "Bench mode: voltage/temp enforcement AND the cell-monitor");
111111
LOG_W(TAG_MAIN, "data-timeout fault are BYPASSED. Do NOT run a real pack.");
112+
LOG_W(TAG_MAIN, "Pack voltage FORCED to %.1fV for bench precharge", (double)FEB_BMS_BENCH_PACK_VOLTAGE_V);
112113
#endif
113114

114115
#if FEB_BMS_DISABLE_TEMP_CHECKS

BMS/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.7.12
1+
1.7.13

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.7.28
1+
1.7.29

0 commit comments

Comments
 (0)