您好!
我将 BQ76952芯片与 Arduino 相结合用于电池监控。 BQ 芯片与 Arduino 之间的通信通过 I2C 得以促进。 我将利用 DFETOFF、DCHG、DDSG、TS1和 TS3引脚在180k 温度模型中进行温度测量。 遗憾的是、测量无法正常工作、我只在定义的寄存器上读取到0值。 如果有任何帮助,我将不胜感激。 电池电压和电流测量效果良好。 我将使用的配置设置代码如下所示。
谢谢!
#include "bq769x2.h" // Library header for TI BQ76952
#include <CAN.h>
#define BMS_ALERT_PIN 7 // attached to interrupt INT0
#define BMS_BOOT_PIN 8 // connected to TS1 input
#define BMS_I2C_ADDRESS 0x08 //
#define SET_CFGUPDATE 0x0090
#define EXIT_CFGUPDATE 0x0092
#define RESET_BQ 0x0012
#define RESET_COULOMBS 0x0082
bq769x2 BMS(bq76952, BMS_I2C_ADDRESS); // BMS object
BMS.CommandSubcommands(RESET_BQ);
BMS.CommandSubcommands(SET_CFGUPDATE);
//****Battery Configuration****
BMS.SetRegister(0x9304,0x81FF,2);
delay(10);
//****Temperature Measurement****
//Pin Config
//DFETOFF
BMS.SetRegister(0x92FB,0x5B,1); //0b01011011 for 180k pull-up
delay(10);
//DCHG
BMS.SetRegister(0x9301,0x5B,1); //0b01011011 for 180k pull-up
delay(10);
//DDSG
BMS.SetRegister(0x9302,0x5B,1); //0b01011011 for 180k pull-up
delay(10);
//TS1
BMS.SetRegister(0x92FD,0x5B,1); //0b01011011 for 180k pull-up
delay(10);
//TS3
BMS.SetRegister(0x92FF,0x5B,1); //0b01011011 for 180k pull-up
delay(10);
//180k Temp Model Coefficient Config
//Coeff a1
BMS.SetRegister(0x9200,0x8000,2);
delay(10);
//Coeff a2
BMS.SetRegister(0x9202,0xFFFF,2);
delay(10);
//Coeff a3
BMS.SetRegister(0x9204,0xFFFF,2);
delay(10);
//Coeff a4
BMS.SetRegister(0x9206,0x7FFF,2);
delay(10);
//Coeff a5
BMS.SetRegister(0x9208,0x3FFF,2);
delay(10);
//Coeff b1
BMS.SetRegister(0x920A,0xEA5A,2);
delay(10);
//Coeff b2
BMS.SetRegister(0x920C,0x2670,2);
delay(10);
//Coeff b3
BMS.SetRegister(0x920E,0xE5B3,2);
delay(10);
//Coeff b4
BMS.SetRegister(0x9210,0x1281,2);
delay(10);
//Adc0
BMS.SetRegister(0x9214,0x435E,2); // Defaul 17246 (0x435E)
delay(10);
Serial.println("Initializing BQ76952...30%...");
//Offset Calibration
//Default 0x00. Range 0x80 to 0x7F (8-bit signed integer --> from -128 [0.1degreeC] to 127 [0.1degreeC])
//DFETOFF
BMS.SetRegister(0x91CC,0x00,1);
delay(10);
//DCHG
BMS.SetRegister(0x91D2,0x00,1);
delay(10);
//DDSG
BMS.SetRegister(0x91D3,0x00,1);
delay(10);
//TS1
BMS.SetRegister(0x91CE,0x00,1);
delay(10);
//TS3
BMS.SetRegister(0x91D0,0x00,1);
delay(10);
//****Current Measurement Calibration****
//CC Gain
BMS.SetRegister(0x91A8,0x40EF41F2,4); //Default 0x40EF41F2. Range from 0x3C23D70A to 0x447A0000 (32-bit single precision floating point)
delay(10);
//Capacity Gain
BMS.SetRegister(0x91AC,0x4A081C6A,4); //Default 0x4A081C6A. Range from 0x453A69EC to 0x4DC7F0A5 (32-bit single precision floating point)
delay(10);
//Board Offset
BMS.SetRegister(0x91C8,0x0000,2);
delay(10);
//
//****Protection****
//all protections disabled!
//Min Blow Fuse Voltage
BMS.SetRegister(0x9231,0x7FFF,2);
delay(10);
//Enabled Protections A
BMS.SetRegister(0x9261,0x00,1);
delay(10);
//Enabled Protections B
BMS.SetRegister(0x9262,0x00,1);
delay(10);
//Enabled Protections C
BMS.SetRegister(0x9263,0x00,1);
delay(10);
//CHG FET Protections A
BMS.SetRegister(0x9265,0x00,1);
delay(10);
//CHG FET Protections B
BMS.SetRegister(0x9266,0x00,1);
delay(10);
//CHG FET Protections C
BMS.SetRegister(0x9267,0x00,1);
delay(10);
//DSG FET Protections A
BMS.SetRegister(0x9269,0x00,1);
delay(10);
//DSG FET Protections B
BMS.SetRegister(0x926A,0x00,1);
delay(10);
//DSG FET Protections C
BMS.SetRegister(0x926B,0x00,1);
delay(10);
//****DA Configuration****
//User defined units to report stack voltage and battery current are configured as CentiVolt and CentiAmp respectively to prevent 16-bit CAN signal overflow. (refer to message BATT in BMS_Teststand.dbc)
BMS.SetRegister(0x9303,0x06,1);
delay(10);
// Power Config: Disable Sleep
BMS.SetRegister(0x9234,0x2882,2); // Default 0x2982
delay(10);
BMS.CommandSubcommands(EXIT_CFGUPDATE);
}
