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.

Accessing Data Flash on bq27541-G1

Other Parts Discussed in Thread: BQ27541-G1

Hi everybody,

I'm currently working on trying to access the data flash of bq27541-G1 through the i2c interface.

I managed to access the data block (subclass ID 48 in the datasheet) and read the Device Name, but I'm having some problems with the "offset" to index the BlockData() command.

I can read the whole block when I issue 0x40 as the reading address, but as I try to use the offset to only read the DeviceName it appears as if I'm not using it at all, and I keep reading the same data (some bytes that I see as "thrash", as they are not related on the datasheet - the block starts at the 8th byte of the 32 byte block as I see things - and then the bytes with the offset 40,42,43,44 and 45 according to Table 7 page 21) 

What I'm currently doing is:

- write BlockDataControl() and 0x00

- write DataFlashClass() and 0x30 (Class ID 48 in hexa)

- write DataFlashBlock() and 0x01 (2nd block of the Class)

- write BlockData() (0x40) for the whole block and (0x4D) to try to read only the Device Name

- read the i2c bus (as many as 32 bytes for the block and the 11 bytes default for Device Name)

Am I missing something here? Can anybody shed a light in this matter? Did I misintepret the offset of BlockData()?

Sorry if I misplaced this topic,

att.

Diogo Furukawa 

  • Ok, so just after spending a day trying to make this work, and then deciding to post here I found out I was forgeting the delay between writing and reading...

    I can now read specific regions, but still have a question:

    To write to the flash, instead of writing a "read" command after the repeated start on the i2c bus, should I just swap it to "write" and then proceed to write the respective bytes?

    And about the BlockDataChecksum(), if I'm just writing a small portion of the 32 byte block, should the checksum also account for the bytes I don't change? (for example, if I just want to change the Device Name to bqAAAAA-BB, and I just write these bytes, do the other bytes also count for the checksum?)

    And  if the block is smaller than the 32 bytes, the "thrash" bytes also count for the checksum?

  • This thread has become a monologue, but anyways...

    just for the record, the checksum really uses the 32 bytes of the block, even if they aren't even "used"...

    if I post another question here, will I get an answer? =) as the saying goes, the third one is a charm...

    Can I just rewrite "Update Status" to 0x04 to "restart" the learning cycle process?

  • Yes, the checksum uses all 32 bytes.

    To restart the learning process, set Update Status to 0x00, reset the device, then send the IT enable command

  • Thanks! I'll try to make this work now.