This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ76952: OTP

Part Number: BQ76952
Other Parts Discussed in Thread: EV2400

Dear:

      I have a question, want to consult you;

     Purpose: Because EV2400 does not have CRC check, I want to write OTP configuration through software programming;

      Method: In fullAccess mode, write control commands to OTP;

  code:    

setting_data[0] = (uint8_t)(UNSEAL_KEY_STEP1 & 0xFF);
setting_data[1] = (uint8_t)((UNSEAL_KEY_STEP1 & 0xFF00)>>8);
setting_data[2] = (uint8_t)(UNSEAL_KEY_STEP2 & 0xFF);
setting_data[3] = (uint8_t)((UNSEAL_KEY_STEP2 & 0xFF00)>>8);
setting_data[4] = (uint8_t)(FULL_ACCESS_KEY_STEP1 & 0xFF);
setting_data[5] = (uint8_t)((FULL_ACCESS_KEY_STEP1 & 0xFF00)>>8);
setting_data[6] = (uint8_t)(FULL_ACCESS_KEY_STEP2 & 0xFF);
setting_data[7] = (uint8_t)((FULL_ACCESS_KEY_STEP2 & 0xFF00)>>8);
I2C_WriteSubRegNoCRC(BQ_SUBCOMMAND_ADDR, SECURITY_KEYS, setting_data, 8); //set FULL ACCESS Mode


setting_data[0] = 0x01;
I2C_WriteSubRegNoCRC(BQ_SUBCOMMAND_ADDR, SET_CFGUPDATE, setting_data, 0); //set CONFIG UPDATE Mode

I2C_ReadReg(BATTERY_STATUS, (uint8_t *)&(Registers1.BatteryStatus.StatusByte), 2);

if(1 == Registers1.BatteryStatus.StatusBit.SEC) // Determine whether it is in FULL_ACCESS mode;
{
     I2C_ReadSubRegNoCrc(OTP_WR_CHECK, (uint8_t *)OTP_WR_CHECK_Status, 3); // Judge whether the self-check is completed; 

if((OTP_WR_CHECK_Status[0]&0x80) != 0) // Programming OK
{
     I2C_WriteSubRegNoCRC(BQ_SUBCOMMAND_ADDR, OTP_WRITE, setting_data, 3); // otp write
}
if((OTP_WR_CHECK_Status[0]&0x80) != 0) // Programming OK
{
      g_otp_writeToRomSuccess_flag =1;
}
else
{
      g_otp_writeToRomSuccess_flag = 0;
}

}
else
{
     g_otp_writeToRomSuccess_flag = 0;
}

Problem: Debug mode can configure parameters, indicating that FULLACCESS has been entered. But Registers1.BatteryStatus.StatusBit.SEC is always 0.

              Replace the bq chip, supply 3.3V separately, but Registers1.BatteryStatus.StatusBit.SEC cannot be set to 1 either;

   Looking forward to your feedback and suggestions.

  • Hi Che,

    There are 2 bits for the security state: SEC1 and SEC0. Are you reading both bits? 

    The device will power up in FULLACCESS mode, so you should not need to unseal the device unless you have sent the command to seal the device previously. Did you previously seal the device?

    Best regards,

    Matt

  •  hi    Matt:

         First of all, thank you for your reply. The above problem has been solved, but a new problem has been encountered.

          After reading SEC =1 and CFGUPDATA =1, I read 00A0, 3 bytes, and found that the subcommand of this address cannot write the address. The write address of reading 0x3E, 0x3F is always FF, resulting in the data read by 00A0 as FF, FF, 00.
          What will cause the subcommand to become unable to write the address? Or does this address have special requirements?

        Looking forward to your feedback and suggestions.

        Che

  • Hi Che,

    If you send 0x00A0 to 0x3E, wait 2ms, and then read from 0x40, what do you see? 

    Regards,

    Matt