Hello Sirs,
Would you pls help to reply how BQ27421 enter hibernate mode ? TKS !
Attach file is test code .
void Amba_Gauge_Config(){ //sealed to unsealed // Amba_I2C_Write_Word(0x00, 0x8000, 100); // Amba_I2C_Write_Word(0x00, 0x8000, 100); _gauge_enabled = true; Amba_I2C_Read_Word(0x06, &flags, 100); while(1){ Amba_I2C_Write_Word(0x00, 0x0013, 100); Amba_I2C_Read_Word(0x06, &flags, 100); if(flags & 0x10) break; } Amba_Gauge_Standard_Data_Config(BATTERY_DESIGN_CAPACITY, BATTERY_DESIGN_ENERGY, BATTERY_TERMINATE_VOLTAGE, BATTERY_TAPER_RATE); Amba_Gauge_Fast_Hibernate_Config(); while(1){ Amba_I2C_Write_Word(0x00, 0x0042, 100); Amba_I2C_Read_Word(0x06, &flags, 100); if(!(flags & 0x10)) break; } return; } //refer to Quickstart Guide for bq27421-G1, Figure 2.Configure Standard Data Memory Parameters void Amba_Gauge_Standard_Data_Config(uint16_t design_capacity, uint16_t design_energy, uint16_t terminate_voltage, uint16_t taper_rate){ if(!_gauge_enabled) return; uint8_t old_checksum; uint8_t new_checksum; uint16_t old_dc; uint16_t old_de; uint16_t old_tv; uint16_t old_tr; uint16_t new_dc = (design_capacity<<8) + (design_capacity>>8); uint16_t new_de = (design_energy<<8) + (design_energy>>8); uint16_t new_tv = (terminate_voltage<<8) + (terminate_voltage>>8); uint16_t new_tr = (taper_rate<<8) + (taper_rate>>8); Amba_I2C_Write_Byte(0x61, 0x00, 100); Amba_I2C_Write_Byte(0x3E, 0x52, 100); Amba_I2C_Write_Byte(0x3F, 0x00, 100); while(1){ Amba_I2C_Read_Byte(0x60, &old_checksum, 100); old_checksum = 0xFF - old_checksum; Amba_I2C_Read_Word(0x4A, &old_dc, 100); Amba_I2C_Read_Word(0x4C, &old_de, 100); Amba_I2C_Read_Word(0x50, &old_tv, 100); Amba_I2C_Read_Word(0x5B, &old_tr, 100); old_checksum = old_checksum - (old_dc&0xFF) - (old_dc>>8) - (old_de&0xFF) - (old_de>>8) - (old_tv&0xFF) - (old_tv>>8) - (old_tr&0xFF) - (old_tr>>8); Amba_I2C_Write_Word(0x4A, new_dc, 100); old_checksum += (design_capacity&0xFF) + (design_capacity>>8); Amba_I2C_Write_Word(0x4C, new_de, 100); old_checksum += (design_energy&0xFF) + (design_energy>>8); Amba_I2C_Write_Word(0x50, new_tv, 100); old_checksum += (terminate_voltage&0xFF) + (terminate_voltage>>8); Amba_I2C_Write_Word(0x5B, new_tr, 100); old_checksum += (taper_rate&0xFF) + (taper_rate>>8); new_checksum = 0xFF - old_checksum; Amba_I2C_Write_Byte(0x60, new_checksum, 100); Amba_I2C_Write_Byte(0x3E, 0x52, 100); Amba_I2C_Write_Byte(0x3F, 0x00, 100); Amba_I2C_Read_Byte(0x60, &old_checksum, 100); if(old_checksum == new_checksum) break; } return; } //refer to Quickstart Guide for bq27421-G1, Figure 5.Configure HIBERNATE Mode Data Memory Parameters void Amba_Gauge_Fast_Hibernate_Config(){ if(!_gauge_enabled) return; uint8_t old_checksum; uint8_t new_checksum; Amba_I2C_Write_Word(0x00, 0x0011, 100); Amba_I2C_Write_Byte(0x61, 0x00, 100); Amba_I2C_Write_Byte(0x3E, 0x44, 100); Amba_I2C_Write_Byte(0x3F, 0x00, 100); while(1){ uint16_t hibernate_v; Amba_I2C_Read_Byte(0x60, &old_checksum, 100); old_checksum = 0xFF - old_checksum; Amba_I2C_Read_Word(0x49, &hibernate_v, 100); old_checksum = old_checksum - (hibernate_v&0xFF) - (hibernate_v>>8); hibernate_v = 0x8813;//5000 Amba_I2C_Write_Word(0x49, hibernate_v, 100); old_checksum = old_checksum + (hibernate_v&0xFF) + (hibernate_v>>8); new_checksum = 0xFF - old_checksum; Amba_I2C_Write_Byte(0x60, new_checksum, 100); Amba_I2C_Write_Byte(0x3E, 0x44, 100); Amba_I2C_Write_Byte(0x3F, 0x00, 100); Amba_I2C_Read_Byte(0x60, &old_checksum, 100); if(new_checksum == old_checksum){ break; } } Amba_I2C_Write_Byte(0x61, 0x00, 100); Amba_I2C_Write_Byte(0x3E, 0x50, 100); Amba_I2C_Write_Byte(0x3F, 0x00, 100); while(1){ uint16_t fh_setting0; uint16_t fh_setting1; uint16_t fh_setting2; Amba_I2C_Read_Byte(0x60, &old_checksum, 100); old_checksum = 0xFF - old_checksum; Amba_I2C_Read_Word(0x4B, &fh_setting0, 100); Amba_I2C_Read_Word(0x58, &fh_setting1, 100); Amba_I2C_Read_Word(0x5A, &fh_setting2, 100); old_checksum = old_checksum - (fh_setting0&0xFF) - (fh_setting0>>8) - (fh_setting1&0xFF) - (fh_setting1>>8) - (fh_setting2&0xFF) - (fh_setting2>>8); fh_setting0 = 0x0;//0 fh_setting1 = 0x100;//1 fh_setting2 = 0x0;//0 Amba_I2C_Write_Word(0x4B, fh_setting0, 100); Amba_I2C_Write_Word(0x58, fh_setting1, 100); Amba_I2C_Write_Word(0x5A, fh_setting2, 100); old_checksum = old_checksum + (fh_setting0&0xFF) + (fh_setting0>>8) + (fh_setting1&0xFF) + (fh_setting1>>8) + (fh_setting2&0xFF) + (fh_setting2>>8); new_checksum = 0xFF - old_checksum; Amba_I2C_Write_Byte(0x60, new_checksum, 100); Amba_I2C_Write_Byte(0x3E, 0x50, 100); Amba_I2C_Write_Byte(0x3F, 0x00, 100); Amba_I2C_Read_Byte(0x60, &old_checksum, 100); if(new_checksum == old_checksum){ break; } } Amba_I2C_Write_Byte(0x61, 0x00, 100); Amba_I2C_Write_Byte(0x3E, 0x50, 100); Amba_I2C_Write_Byte(0x3F, 0x01, 100); while(1){ uint8_t fh_setting3; Amba_I2C_Read_Byte(0x60, &old_checksum, 100); old_checksum = 0xFF - old_checksum; Amba_I2C_Read_Byte(0x43, &fh_setting3, 100); old_checksum = old_checksum - fh_setting3; fh_setting3 = 0x0;//0 Amba_I2C_Write_Byte(0x43, fh_setting3, 100); old_checksum = old_checksum + fh_setting3; new_checksum = 0xFF - old_checksum; Amba_I2C_Write_Byte(0x60, new_checksum, 100); Amba_I2C_Write_Byte(0x3E, 0x50, 100); Amba_I2C_Write_Byte(0x3F, 0x01, 100); Amba_I2C_Read_Byte(0x60, &old_checksum, 100); if(new_checksum == old_checksum){ break; } } return; }
==========================================================================================================================
Refer to bq27421 Technical Reference Documentation Section [2.4.6 HIBERNATE Mode], the steps to make the chip enter hibernation mode are as followed:
l Power on
l SET_CFGUPDATE()
l Set Hibernate V = 5000 mV
l Set FH Setting 0 = 0
l Set FH Setting 1 = 1
l Set FH Setting 2 = 0
l Set FH Setting 3 = 0
l SOFT_RESET()
After that, the chip should enter hibernation mode when the voltage is less than 5000mv.
So we test it with the code in attached file.
Then we met the issue. There are two signs to make us infer that it did not enter hibernation mode but was in sleep mode:
1. In the specification, the supply current of hibernation is about 9ua higher than shutdown, but we found that the actual test chip supply current is about 21ua higher than that in shutdown mode, which is just like the current in sleep mode.
2. In the sleep and wait_hibernate state, the chip will update data every 20 seconds, which will cause the supply current value rise in the jump, and it happened.
In order to eliminate the possibility that the configuration error or conditions do not match, we did a few tests to reread the configuration.
The configuration is actually written correctly, and some status values are as follows:
Averagecurrent () 0x1 (mostly less than 1ma) Voltage () 0xe39 CONTROL_STATUS () 0x5e Flags () 0 0x18e |
So, pls help us to check:
- Is there any direct way to check if the IC is in hibernation mode?
- Is our test method right to make the IC enter hibernation mode?