Post Go back to editing

LTC2942 Incorrect ACR Value Shutdown Mode

Category: Software
Product Number: LTC2942

Hi ADI

  We use LTC2942 for our project to calculate the battery discarge value. Our battery is a 4000mAh chargable Li Battery. We init LTC2942 at the beginning of the codes to set the Prescaler as 32. When we use Automatic Mode in Control Reg it works well and calculated right. As our device is designed for low power consumption purpose, we need to make LTC2942 shutdown when our MCU (MSP430) sleep. Then we set LTC2942 to Automatic Mode when MSP430 wakeup. But the value it measured is not right. It is 6 times way faster consumption speed then not Shutdown Mode. Like in shutdown mode it consumption 12mAh but in Normal(not shutdown) mode it consumption only 2 mAh.

  So do you have any idea that if there is anything wrong we configured? Thanks.

Attach is our schematic and code.

//before enter sleep
Gps_close();
Uart0_close();
Uart1_close();
//Uart2_close();
W25QXX_Flash_End();
LCD_BACKLIGHT_OFF();
setBATFET_Disable();
BQ25896_end();
ltc2942_acr = LTC2942_getRawAccumulatedValue();
LTC2942_setShutdown(1);
RtcChargeDisable();
Ht16c23_ClrScr();
Ht16c23_Off();
Ht16c23_end();
FRAMPow_off();

powerdown_setup();

__bis_SR_register(LPM3_bits+GIE);
__no_operation();

//wakeup
system_setup(1);//8ms
Bluetooth_Init(BTTRANSBAUD);
Ht16c23_init();//4ms
Uart0_init(USBCOMMBAUD,LOWCLK_DEF); //USB400us
InitDma();//2.7ms
W25QXX_Flash_Init();//4.11ms
confTempMode(workMode); //429us
LTC2942_setShutdown(2);//auto mode
LTC2942_setRawAccumulatedValue(ltc2942_acr);

the LTC2942 driver codes as follows:

void LTC2942_setRawAccumulatedValue(uint16_t value) 
{
uint16_t ret = 0;

uint8_t reg;
LTC2942_read(LTC2942_I2C_ADDRESS,LTC2942_CONTROL_REG,&reg);
LTC2942_write(LTC2942_I2C_ADDRESS,LTC2942_CONTROL_REG,reg | SHUTDOWN);

LTC2942_write_16_bits(LTC2942_I2C_ADDRESS,LTC2942_ACCUM_CHARGE_MSB_REG,value);

LTC2942_write(LTC2942_I2C_ADDRESS,LTC2942_CONTROL_REG,reg);
}

uint16_t LTC2942_getRawAccumulatedValue(void) 
{
uint16_t adc_code = 0;
LTC2942_read_16_bits(LTC2942_I2C_ADDRESS, LTC2942_ACCUM_CHARGE_MSB_REG, &adc_code);
return adc_code;
}

//0-sleep 1-shutdown 2-auto 3-manual
void LTC2942_setShutdown(uint8_t flag)
{
uint8_t ret;

if(flag == 1)
{
LTC2942_read(LTC2942_I2C_ADDRESS,LTC2942_CONTROL_REG,&ret);
LTC2942_write(LTC2942_I2C_ADDRESS,LTC2942_CONTROL_REG,ret | SHUTDOWN);
LTC2942_read(LTC2942_I2C_ADDRESS,LTC2942_CONTROL_REG,&ret);
if((ret & 0x01) == 0x01)
{
ret = 1;
}
}
else if(flag == 0)
{
LTC2942_setMode((LTC2942_SLEEP_MODE | LTC2942_PRESCALAR_M_32 | LTC2942_ALERT_MODE) & 0xFE);
}
else if(flag == 2)
{
LTC2942_setMode((LTC2942_AUTOMATIC_MODE | LTC2942_PRESCALAR_M_32 | LTC2942_ALERT_MODE) & 0xFE);
}
else if(flag ==3)
{
LTC2942_setMode((LTC2942_MANUAL_VOLTAGE | LTC2942_PRESCALAR_M_32 | LTC2942_ALERT_MODE) & 0xFE);
}
}