Other Parts Discussed in Thread: BQSTUDIO
Hi Ti Team,
I am using BQ7695202 BMS IC for battery managment with STM32 host microcontroller. Currently i am facing a problem regarding PRECHARGE & PREDISCHARGE. Precharge & Predischarge is not on while device is in charging or discharging mode
I configure the BQ7695202 as mentioned below:-
void BQ769x2_Init() {
// Configures all parameters in device RAM
// Enter CONFIGUPDATE mode (Subcommand 0x0090) - It is required to be in CONFIG_UPDATE mode to program the device RAM settings
// See TRM for full description of CONFIG_UPDATE mode
CommandSubcommands(SET_CFGUPDATE);
//precharge start voltage
//BQ769x2_SetRegister(PrechargeStartVoltage, 0x0960, 2);//0x0960=2400mv
BQ769x2_SetRegister(PrechargeStartVoltage, 0x0C1C, 2);//0x0C1C=3100mv
//precharge stop voltage
//BQ769x2_SetRegister(PrechargeStopVoltage, 0x0a28, 2);//0x0a28=2600mv
BQ769x2_SetRegister(PrechargeStopVoltage, 0x0D48, 2);//0x0D48=3400mv
//predischarge Timeout
//BQ769x2_SetRegister(PredischargeTimeout, 0x32, 1);//0x32=50. 50*10ms(units)=500ms//0xc8=200*10ms=2000ms
//TO CHECK THE PREDISCHARGE IS WORKING OR NOT WE SET TIME TO 2.550 SECOND
BQ769x2_SetRegister(PredischargeTimeout, 0xFF, 1);//0xFF=255. 255*10ms(units)=2550ms
//PredischargeStopDelta
BQ769x2_SetRegister(PredischargeStopDelta, 0x00, 1);//0=Predischarge voltage check disabled
//DA configuration
BQ769x2_SetRegister(DAConfiguration, 0X06, 1);//SET THE CURRENT RECEIVED IN 10ma units not the 1ma units
//TS1 OFFSET
BQ769x2_SetRegister(TS1TempOffset, -0x2D, 1);
//TS3 OFFSET
BQ769x2_SetRegister(TS3TempOffset, -0x2D, 1);
//HDQ TEMPERATURE PIN OFFSET
BQ769x2_SetRegister(HDQTempOffset, -0x2D, 1);
//TOSGain/stack voltage calibration
BQ769x2_SetRegister(TOSGain, 34268, 2);//for the pcb in which ground is sEPERATED BY RESISTANCE for BQ IC & STM32.
//CCGain
BQ769x2_SetRegister(CCGain, 0x417650b1, 4);//for the pcb in which ground is sEPERATED BY RESISTANCE for BQ IC & STM32.
// After entering CONFIG_UPDATE mode, RAM registers can be programmed. When programming RAM, checksum and length must also be
// programmed for the change to take effect. All of the RAM registers are described in detail in the BQ769x2 TRM.
// An easier way to find the descriptions is in the BQStudio Data Memory screen. When you move the mouse over the register name,
// a full description of the register and the bits will pop up on the screen.
// 'Power Config' - 0x9234 = 0x2D80
// Setting the DSLP_LDO bit allows the LDOs to remain active when the device goes into Deep Sleep mode
// Set wake speed bits to 00 for best performance
BQ769x2_SetRegister(PowerConfig, 0x2c80, 2);//for non sleep mode
// 'REG0 Config' - set REG0_EN bit to enable pre-regulator
BQ769x2_SetRegister(REG0Config, 0x00, 1);//BY DEFAULT IT IS 0X00//DISABLE
// 'REG12 Config' - Enable REG1 with 3.3V output (0x0D for 3.3V, 0x0F for 5V)
BQ769x2_SetRegister(REG12Config, 0x00, 1);//BY DEFAULT IT IS 0X00//DISABLE
// Set DFETOFF pin to control DSG FET - 0x92FB = 0x02 (set to 0x00 to disable)
BQ769x2_SetRegister(DFETOFFPinConfig, 0x02, 1);
// Set CFETOFF pin to control CHG FET - 0x92FA = 0x02 (set to 0x00 to disable)
BQ769x2_SetRegister(CFETOFFPinConfig, 0x02, 1);
// Set up ALERT Pin - 0x92FC = 0x2A
// This configures the ALERT pin to drive high (REG1 voltage) when enabled.
// The ALERT pin can be used as an interrupt to the MCU when a protection has triggered or new measurements are available
BQ769x2_SetRegister(ALERTPinConfig, 0x2A, 1);//PREVIOUSLY SET 0X2A
BQ769x2_SetRegister(SFAlertMaskA, 0xfc, 1);//SFAlertMaskA FOR ALERT PIN INTERRUPT
BQ769x2_SetRegister(SFAlertMaskB, 0xf7, 1);//SFAlertMaskB FOR ALERT PIN INTERRUPT
//FETOptions used for predischarge
BQ769x2_SetRegister(FETOptions, 0x0D, 1);//ENABLE BY DEFAULT AT VALUE 0x0D
// Set TS1 to measure Cell Temperature - 0x92FD = 0x07
BQ769x2_SetRegister(TS1Config, 0x07, 1);
// Set TS3 to measure FET Temperature - 0x92FF = 0x0F
BQ769x2_SetRegister(TS3Config, 0x0F, 1);
// Set HDQ to measure Cell Temperature - 0x9300 = 0x07
BQ769x2_SetRegister(HDQPinConfig, 0x07, 1); // No thermistor installed on EVM HDQ pin, so set to 0x00
// 'VCell Mode' - Enable 16 cells - 0x9304 = 0x0000; Writing 0x0000 sets the default of 16 cells
//we set 0x7fff for 15 cell. cell 15 & 16 are shorted
BQ769x2_SetRegister(VCellMode, 0x7fff, 2);
// Enable protections in 'Enabled Protections A' 0x9261 = 0xBC
// Enables SCD (short-circuit), OCD1 (over-current in discharge), OCC (over-current in charge),
// COV (over-voltage), CUV (under-voltage)
BQ769x2_SetRegister(EnabledProtectionsA, 0x0C, 1);//ONLY COV,CUV PROTECTION
// Enable all protections in 'Enabled Protections B' 0x9262 = 0xF7
// Enables OTF (over-temperature FET), OTINT (internal over-temperature), OTD (over-temperature in discharge),
// OTC (over-temperature in charge), UTINT (internal under-temperature), UTD (under-temperature in discharge), UTC (under-temperature in charge)
BQ769x2_SetRegister(EnabledProtectionsB, 0xF7, 1);
// Enable all protections in 'Enabled Protections C' 0x9263 =0X00;
//enables Host Watchdog Fault(HWDF),precharge timeout(PTO),COV latch,CUV latch,SCD latch,OCD3 latch
//we are not using protection C
//BQ769x2_SetRegister(EnabledProtectionsC, 0x00, 1);
// 'Default Alarm Mask' - 0x..82 Enables the FullScan and ADScan bits, default value = 0xF800
BQ769x2_SetRegister(DefaultAlarmMask, 0xF882, 2);
//BQ769x2_SetRegister(AlarmEnable, 0xF882, 2);
// Set up Cell Balancing Configuration - 0x9335 = 0x03 - Automated balancing while in Relax or Charge modes
// Also see "Cell Balancing with BQ769x2 Battery Monitors" document on ti.com
BQ769x2_SetRegister(BalancingConfiguration, 0x0C, 1);//HOST CONTROLED CELL BALANCING
// Set up CUV (under-voltage) Threshold - 0x9275 = 0x31 (2479 mV)
// CUV Threshold is this value multiplied by 50.6mV
BQ769x2_SetRegister(CUVThreshold, BQCUVThreshold_Remainder, 1);//0X60 FOR CUV//OTHERWISE 0X31
// CUV Delay is this value multiplied by 3.3mV
BQ769x2_SetRegister(CUVDelay, 0x012F, 2);//0X012F=303(303*3.3MS=1000ms)
// Set up CUV (under-voltage) RecoveryHysteresis - 0x927B = 0x03 (50.6*3=151.8 mV)
// CUV RecoveryHysteresis is this value multiplied by 50.6mV
BQ769x2_SetRegister(CUVRecoveryHysteresis, BQCUVRecoveryHysteresis_Remainder, 1);
// Set up COV (over-voltage) Threshold - 0x9278 = 0x55 (4301 mV)
// COV Threshold is this value multiplied by 50.6mV
BQ769x2_SetRegister(COVThreshold, BQCOVThreshold_Remainder, 1);//30 FOR COV
// COV Delay is this value multiplied by 3.3mV
BQ769x2_SetRegister(COVDelay, 0x025E, 2);//0X025E=606(606*3.3MS=2000ms)
// Set up COV (over-voltage) RecoveryHysteresis - 0x927C = 0x03 (50.6*3=151.8 mV)
// COV RecoveryHysteresis is this value multiplied by 50.6mV
BQ769x2_SetRegister(COVRecoveryHysteresis, BQCOVRecoveryHysteresis_Remainder, 1);
// Set up OTC (Overtemperature in Charge) Threshold - 0x929A
BQ769x2_SetRegister(OTCThreshold, BQOTCThreshold_Value, 1);//60 DEGREE CELCIUS
// Set up OTC (Overtemperature in Charge) Delay - 0x920B
BQ769x2_SetRegister(OTCDelay, BQOTCDelay_Value, 1);//1 SECOND
// Set up OTC (Overtemperature in Charge) Recovery - 0x929C
BQ769x2_SetRegister(OTCRecovery, BQOTCRecover_Value, 1);//50 DEGREE CELCIUS
// Set up OTD (Overtemperature in DisCharge) Threshold - 0x929D
BQ769x2_SetRegister(OTDThreshold, BQOTDThreshold_Value, 1);//62 DEGREE CELCIUS
// Set up OTD (Overtemperature in DisCharge) Delay - 0x929E
BQ769x2_SetRegister(OTDDelay, BQOTDDelay_Value, 1);//1 SECOND
// Set up OTD (Overtemperature in DisCharge) Recovery - 0x929F
BQ769x2_SetRegister(OTDRecovery, BQOTDRecover_Value, 1);//55 DEGREE CELCIUS
// Set up OTF (Overtemperature in FET/PCB) Threshold - 0x92A0
BQ769x2_SetRegister(OTFThreshold, BQOTFThreshold_Value, 1);//90 DEGREE CELCIUS
// Set up OTF (Overtemperature in FET/PCB) Delay - 0x92A2
BQ769x2_SetRegister(OTFDelay, BQOTFDelay_Value, 1);//2 SECOND
// Set up OTF (Overtemperature in FET/PCB) Recovery - 0x92A2
BQ769x2_SetRegister(OTFRecovery, BQOTFRecover_Value, 1);//70 DEGREE CELCIUS
// Set up UTC (Undertemperature in Charge) Threshold - 0x92A6
BQ769x2_SetRegister(UTCThreshold, BQUTCThreshold_Value, 1);//-5 DEGREE CELCIUS
// Set up UTC (Undertemperature in Charge) Delay - 0x92A7
BQ769x2_SetRegister(UTCDelay, BQUTCDelay_Value, 1);//1 SECOND
// Set up UTC (Undertemperature in Charge) Recovery - 0x92A8
BQ769x2_SetRegister(UTCRecovery, BQUTCRecover_Value, 1);//0 DEGREE CELCIUS
// Set up UTD (Undertemperature in DisCharge) Threshold - 0x92A9
BQ769x2_SetRegister(UTDThreshold, BQUTDThreshold_Value, 1);//-8 DEGREE CELCIUS
// Set up UTD (Undertemperature in DisCharge) Delay - 0x92AA
BQ769x2_SetRegister(UTDDelay, BQUTDDelay_Value, 1);//1 SECOND
// Set up UTD (Undertemperature in DisCharge) Recovery - 0x92AB
BQ769x2_SetRegister(UTDRecovery, BQUTDRecover_Value, 1);//2 DEGREE CELCIUS
// Exit CONFIGUPDATE mode - Subcommand 0x0092
CommandSubcommands(EXIT_CFGUPDATE);
}
In int main()
{
CommandSubcommands(BQ769x2_RESET); // Resets the BQ769x2 registers
delayUS(60000);
BQ769x2_Init(); // Configure all of the BQ769x2 register settings
delayUS(10000);
CommandSubcommands(FET_ENABLE); // Enable the CHG and DSG FETs
delayUS(10000);
CommandSubcommands(SLEEP_DISABLE); // Sleep mode is enabled by default. For this example, Sleep is disabled to
// demonstrate full-speed measurements in Normal mode.
delayUS(60000); delayUS(60000); delayUS(60000); delayUS(60000); //wait to start measurements after FETs close
Please help me to resolve this issue.
Thanks with regards
Deepak