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.

change the offset when accessing BQ27510-g2 a specific data flash subcalss

Other Parts Discussed in Thread: BQ27510

Hi,

I'm trying to access the data flash subclass ID 36. the offset of the first parameter is 2, so how to change the offset after selecting the sub class.

this is what I'm doing:

bq27510_write(0x61,0); //access general data flash
bq27510_write(0x3E,36); // set DataFlashClass
bq27510_write(0x3F,0); // set DataFlashBlock

now if I issue a read command I have the correct data value according to the datasheet but I have to start from offset 0 so I'm reading

0x0000 0x0064 0x0019 0x0064 ...

so if I want to change just one field do I have to read the whole 32bytes modify the field and rewrite the whole 32bytes block?

thanks

  • Here’s an example of the process to update Op Config value from 0x0973 to 0x0972. Make note that the calculations are based on 1 byte result. Results that are more than 1 byte you only use the LSB to move forward in steps. 

    1. Identify Subclass and Offset based on dataflash table in datasheet. 
    2. Write to register address 0x3E the subclass. In this example it is 0x40.
    3. Write to register address 0x3F the offset. In this example it is 0x00. The offset as used in address 0x3F is to refer to which block of 32 bytes is to be accessed. Once set addresses 0x40 - 0x5F provide access to the 32 bytes within the block designated by address 0x3F.
    4. Data in dataflash is stored most significant byte first. That means that in this example we will update address 0x41 from 0x73 to 0x72. Read address 0x41. It will be confirmed that 0x73 is currently there.
    5. Read current checksum by reading register address 0x60. For this example I’ll use 0x94 as the checksum read back given that this value is likely to be different for every user.
    6. Invert current checksum by subtracting 0xFF – 0x94 = 0x6B.
    7. Subtract current value in register 0x41 from result in step 6. 0x6B – 0x73 = 0xF8
    8. Add new value for register 0x41 to value obtained in step 7. 0xF8 + 0x72 = 0x6A
    9. Invert value from step 8. 0xFF – 0x6A = 0x95. This is the new value for checksum after programming is complete.
    10. Write new value 0x72 to register 0x41.
    11. Write checksum obtained in step 9 to register address 0x60. This is 0x95. This completes the data flash write of updating LSB of Op Config from 0x73 to 0x72.
  • Thanks for the detailed description.

    it's working now.