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.