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.

BQ27542-G1: can not write Data Flash on bq27542-G1 through the i2c interface

Part Number: BQ27542-G1

Dear Sir:
I am working on bq27542-g1. I want to change "Design Energy Scale " through I2c interface.

According to MSP430's exsample . I wrote my code. but it can not work.
My code is as follows:


#define bq27541CMD_DFCLS 0x3E
#define bq27541CMD_DFBLK 0x3F
#define bq27541CMD_ADF 0x40
#define bq27541CMD_ACKSDFD 0x54
#define bq27541CMD_DFDCKS 0x60
#define bq27541CMD_DFDCNTL 0x61
#define bq27541CMD_DNAMELEN 0x62
#define bq27541CMD_DNAME 0x63

IIC_Write_One_Byte(bq27541CMD_DFDCNTL, 0);// BlockDataControl() = 0x00
IIC_Write_One_Byte(bq27541CMD_DFCLS, 48); // Write the subclass value
IIC_Write_One_Byte(bq27541CMD_DFBLK, 0);// Select offset within the flash
IIC_Read_Bytes(bq27541CMD_ADF, &TxData[0],32); // Read the contents of the block
TxData[23]=10;                          //set Design Energy scale=10 for support 20Ah, P90 
for (i = 0,sum=0; i < 32; i++) // Compute the checksum of the block
{
sum += TxData[i]; // Calculate the sum of the values
}
checksum = (0xFF - (sum & 0x00FF)); // Compute checksum based on the sum
IIC_Write_One_Byte(bq27541CMD_DFDCKS, checksum); // Write checksum value
for (i = 0; i < 32; i++) // Write 32 bytes to
{
IIC_Write_One_Byte((bq27541CMD_ADF+i), TxData[i]);
}

  • Hi, I apologize that no one has followed up with your question posted last year due to the large number of questions we got towards the end of 2016, please feel free to post a brand new question should you still need an answer instead of replying to this post. We will do our very best to respond in a timely manner to any new post you might have :-)
    Best Regards,
    Haidar