Quantcast
Channel: Power management forum - Recent Threads
Viewing all articles
Browse latest Browse all 35901

BQ34Z110, I2C- How to write with command. (Coding Step)

$
0
0

Hello everyone.

Bq34z110 I2C

- How to write with command???

I was did the below steps.

1.Read PackConfiguration() : 0x961 .

2.Write 0x00 to 61

3.Write 40H (64 subclass ID) to 3E

4.Write 0x00 (Offset) to 3F

5.Read 20 bytes of data from 40

6.Read the checksum from 60. I read 97H.

7.Calculate new checksum. I calculated it to be A7.

8.Write 0x00 to 61

9.Write 40H (64 subclass ID) to 3E

10.Write 0x00(Offset) to 3F

11.Write 20 bytes of data to 40. I changed the Pack Cfg A from 961 to 951

12.Write A7H to 60.

13.Read the Pack Cfg A and it was 951.

And coding as follows.

<Pack Configuration Write>

1.   HAL_I2C_Mem_Read ( &hi2c2, BATT_CHK_I2C_ADDRESS, 0x3a, 1, RxData, 2, 10 );

2.   TxData[0] = 0x00;
      HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x61, 1, TxData, 1, 10);

3.   TxData[0] = 0x40;
      HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x3E, 1, TxData, 1, 10);

4.    TxData[0] = 0x00;
       HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x3F, 1, TxData, 1, 10);

5.    HAL_I2C_Mem_Read ( &hi2c2, BATT_CHK_I2C_ADDRESS, 0x40, 1, RxData, 20, 10 );

6.    HAL_I2C_Mem_Read ( &hi2c2, BATT_CHK_I2C_ADDRESS, 0x60, 1, RxData, Size, 10 );

7. ??

8.    TxData[0] = 0x00;
       HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x61, 1, TxData, 1, 10);

9.     TxData[0] = 0x40;
        HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x3E, 1, TxData, 1, 10);

10.   TxData[0] = 0x00;
         HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x3F, 1, TxData, 1, 10);

11.   TxData_write[0] = 0x09;
         TxData_write[1] = 0x61;
         HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x40, 2, TxData_write, 2, 10);

12.    TxData[0] = 0xA7;

HAL_I2C_Mem_Write( &hi2c2, 0xAA, 0x60, 1, TxData, 1, 10);

13.    HAL_I2C_Mem_Read ( &hi2c2, BATT_CHK_I2C_ADDRESS, 0x3a, 1, RxData, 2, 10 );

Where something wrong?

I don't know the Step.

How to use it to coding?

Many Thanks


Viewing all articles
Browse latest Browse all 35901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>