Other Parts Discussed in Thread: BQSTUDIO
Hi team,
My customer now use BQ27220 and they want to calibrate the gauge.
First they try to get full access according to slubbd4 section 6.1.After access getting code is executed, they wait for maximum 1.6 second to make sure the device is put into stable full access mode. Then read SEC[1:0]. But they find sometimes SEC[1:0] is equal to 11(sealed access) or 10(unsealed access) other than 01(full access) . Is there something wrong with the configuration?
Please help me with this issue, any comment will be welcomed. Thank you.
Below is the access getting code:
----------------------------get access------------------------------------------------------------------
//step1 unsealed device
RSH_Bq27220Write(0x00, 0x14);
RSH_Bq27220Write(0x01, 0x04);
RSH_Bq27220Write(0x00, 0x72);
RSH_Bq27220Write(0x01, 0x36);
//step2 enter full access
RSH_Bq27220Write(0x00, 0xff);
RSH_Bq27220Write(0x01, 0xff);
RSH_Bq27220Write(0x00, 0xff);
RSH_Bq27220Write(0x01, 0xff);
//step3 enter cfg update
RSH_Bq27220Write(0x00, 0x90);
RSH_Bq27220Write(0x01, 0x00);
--------------------------read access satus----------------------------------------
while(1)
{
usleep(200*1000);
//step4 flag.cfgupdate is set or not
RSH_Bq27220Read(0x3a, &val_3a);
RSH_Bq27220Read(0x3b, &val_3b);
DcmPrintf("val_3a:%x, val_3b:%x\n", val_3a, val_3b);
if((val_3a & (1 << 1)) && (!(val_3a & (1 << 2))))
{
DcmPrintf("unseal success! val_3a = [%x] cnt = [%d]\n",val_3a,cnt);
break;
}
else
{
cnt++;
if(cnt > 8)
{
DcmPrintf("unseal failed!\n");
break;
}
}
}