Hi all,
目前使用bq27441作电池充放电管理,参数配置根据quick start手册中的流程配置的,参数设置如下:
#define BM_CONF_DESIGN_CAPACITY1200// Design Capacity = 1200mAh #define BM_CONF_DESIGN_ENERGY(int)(BM_CONF_DESIGN_CAPACITY * 3.8) //DesignEnergy = DesignCapacity(mAh) * 3.8V #define BM_CONF_TERMINATE_VOLTAGE3200//Terminate Voltage = 3200mV #define BM_CONF_TAPER_CURRENT115//TaperCurrent = 115mA #define BM_CONF_TAPER_RATE(int)(BM_CONF_DESIGN_CAPACITY / (0.1 * BM_CONF_TAPER_CURRENT))
设置成功后,放电过程中,每隔10秒钟读一次电池电量百分比数据(StateOfCharge),除了开机后变化一次,以后数值一直保持不变(实际上电量已经降低了)。
而充电过程中读取该数值是有变化的(根据时间数值增加)。
请问各位是什么原因导致放电过程中电量百分比数值不更新的?
这是我们的原理图
这是使用的电池
Star Xu:
ROSC值不变您看一下RC和FCC的值是多少
您是否配置CHEM ID
Paul Tron:
回复 Star Xu:
RC和FCC的值略有变化,但是变化很小。
CHEM ID没有配置,读出来是0x0312,是否需要设置?
每次重新开机的时候电量会刷新一次,其他时间就不再更新了。只有重启才能得到最新的电量。
下图是我打印的日志,开机后半个小时以内ROSC保持12%不变化,RC变化了三个数值136、131和127,同时FCC也变化了三个值1160、1155、1151然后就不再变化,最后一组值维持了20多分钟。
然后重启设备,ROSC直接降到3%,RC变成了27,
这是我的配置方式,按照quickstart的流程图来写的。
void bq27441Config(void) {uint16_t result;uint16_t version;bmControlRead(BM_BQ27441_CTRL_DEVICE_TYPE, &version);if(version == 0x0421){/*Steps to unseal the fuel gauge*/bmControl(0x8000);bmControl(0x8000);/* Instructs fuel gauge to enter CONFIG UPDATE mode. */bmControl(BM_BQ27441_CTRL_SET_CFGUPDATE);HalWaitMs(1);result = 0;/* Check if CFGUPMODE bit is set in FLAGS */while(!(result & 0x0010)){bmRead16(BM_BQ27441_CMD_FLAGS, &result);}/* Enable Block data memory control */bmCommand(BM_BQ27441_CMD_BLOCK_DATA_CONTROL, 0x00);/* Set the data class to be accessed */bmCommand(BM_BQ27441_CMD_DATA_CLASS, 0x52);/* Write the block offset loaction */bmCommand(BM_BQ27441_CMD_DATA_BLOCK, 0x00);HalWaitMs(1);uint8_t old_chksum = 0;uint8_t new_chksum = 0;uint8_t tmp_chksum = 0;uint8_t chksum = 0;do{/* Read Block Data Checksum */bmReadChecksum(&old_chksum);tmp_chksum = 0xFF - old_chksum;HalWaitMs(1);uint8_t i;uint8_t old[8];//read valueHalI2CReadBytes(BM_BQ27441_ADDR, 0x4A, 2, &old[0]);HalI2CReadBytes(BM_BQ27441_ADDR, 0x4C, 2, &old[2]);HalI2CReadBytes(BM_BQ27441_ADDR, 0x50, 2, &old[4]);HalI2CReadBytes(BM_BQ27441_ADDR, 0x5B, 2, &old[6]);for(i = 0; i < sizeof(old); i++){tmp_chksum = tmp_chksum - old[i];}/* Write new design capacity */bmWrite16(0x4A, numSwap(BM_CONF_DESIGN_CAPACITY));tmp_chksum = tmp_chksum + (uint8_t)(BM_CONF_DESIGN_CAPACITY >> 8) + (uint8_t)(BM_CONF_DESIGN_CAPACITY & 0x00ff);/* Write new design energy */bmWrite16(0x4C, numSwap(BM_CONF_DESIGN_ENERGY));tmp_chksum = tmp_chksum + (uint8_t)(BM_CONF_DESIGN_ENERGY >> 8) + (uint8_t)(BM_CONF_DESIGN_ENERGY & 0x00ff);/* Write new terminate voltage */bmWrite16(0x50, numSwap(BM_CONF_TERMINATE_VOLTAGE));tmp_chksum = tmp_chksum + (uint8_t)(BM_CONF_TERMINATE_VOLTAGE >> 8) + (uint8_t)(BM_CONF_TERMINATE_VOLTAGE & 0x00ff);/* Write new taper rate */bmWrite16(0x5B, numSwap(BM_CONF_TAPER_RATE));tmp_chksum = tmp_chksum + (uint8_t)(BM_CONF_TAPER_RATE >> 8) + (uint8_t)(BM_CONF_TAPER_RATE & 0x00ff);/* Checksum calculation */new_chksum = 0xff - tmp_chksum;/* Write new taper rate */bmCommand(BM_BQ27441_CMD_BLOCK_DATA_CHECKSUM, new_chksum);HalWaitMs(1);/* Steps to verify RAM update completed correctly *//* Set the data class to be accessed */bmCommand(BM_BQ27441_CMD_DATA_CLASS, 0x52);/* Write the block offset loaction */bmCommand(BM_BQ27441_CMD_DATA_BLOCK, 0x00);bmReadChecksum(&chksum);HalWaitMs(1);}while(new_chksum != chksum);/* Write new terminate voltage */bmControl(BM_BQ27441_CTRL_SOFT_RESET);HalWaitMs(2);result = 0;/* Check if CFGUPMODE bit is cleared in FLAGS */while(result & 0x0010){bmRead16(BM_BQ27441_CMD_FLAGS, &result);}bmControl(BM_BQ27441_CTRL_SEALED);//Step to seal the fuel gauge} }3755.log.txt
Star Xu:
回复 Paul Tron:
您需要配置CHEM ID
如果在CHEM ID列表中没有找到对应的ID您可以使用GPCCHEM TOOL 帮助您计算对应的ID。
www.ti.com.cn/…/GPCCHEM
Paul Tron:
回复 Star Xu:
计算出来的CHEM ID的值是直接写Control()里面的CHEM_ID寄存器吗?
BR.
Star Xu:
回复 Paul Tron:
在BQSTUDIO 的Chemistry中选ID