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.

BQ34110: Intervals between I2C transactions

Part Number: BQ34110
Other Parts Discussed in Thread: BQSTUDIO,

To put things in context, this is also a follow-up of a thread I recently created:

https://e2e.ti.com/support/power-management/f/power-management-forum/991009/bq34110-mfg-status-init-not-directly-writable

As mentioned in the thread above, the factory parameters are built into my firmware and they will be written to DF during the in-factory configuration process. I monitored the I2C bus with an analyzer while performing the parameters programming. It turns out at some point a bus error occurs. For example:

Notice the time the transaction takes (343). Different runs make the error to occurr at different points of the writing data stream. I also notice there were some transactions that were lengthened, for example #135 above where it took 18ms to send the bytes. The driver is polled, no RTOS and only one ISR that increments a counter every ms so extremely short. I am assuming the longer transaction is caused by stretching by the fuel gauge.

I made a capture of the I2C bus while BqStudio was writing the defaults back to the fuel gauge DF. I obtained this (partial):

Needless to say no error occurred.

What stood out when I was analyzing the capture above was the time interval between transactions. For example, between transaction 1 (write MAC and MAC_DATA) and 2 (write checksum and length), there is an interval of ~15ms. Between 2 and 3 (BqStudio sends the address to read back data it just wrote), ~141ms. Between 3 and 4 (read MAC/MAC_DATA/checksum/length), ~15ms.

I repeated the analysis with the following transactions and I noticed a pattern: between two transactions (with one exception), there is an interval of around 15ms. The exception is when a write operation is triggered by writing the checksum/length registers, there is an interval of ~140ms before a new transaction starts.

The probable cause of the errors with my firmware is timing related, the time interval between transactions if of the order of a few milliseconds and after a write, I add an interval but it is only of a couple of tens of milliseconds. On a previous inquiry about this matter, it was suggested I read back the control_status register but in my tests it did not work, and as you can see, BqStudio does not do it.

I could not find information about the time interval between I2C transactions of BQ34110. The only information on Data Sheet, TRM and application notes is about the protocol; I was not able to find information about timing. So, my first BIG question is if there is such an information somewhere that I may have missed. If not, what are the recommended timing? I may try to change my firmware to mimic BqStudio timings, but I would rather use a document source instead of an ad-hoc one.

  • Hello Elder,

    You can use the flash stream files to reference the delays, using the slua801 document which explains the formatting. The flash stream files if what we recommend using to program the gauges.

    If you modify your code to increase the time to match bqStudio does everything run correctly?

    Sincerely,

    Wyatt Keller

  • Hello, Wyatt

    Thank you for the tips. I missed the flash stream files thing, I had to dig a little deeper to find info on the format (I found it on a reply to another thread like this). I assumed programming the FG with the golden image would need an external tool, it did not occurred to me it was possible to implement it in my firmware.

    I see it uses the memory mode (address x16). From inspecting the FSF, timings seem to be shorter than those of BqStudio. Perhaps it does not need the FG's  internal processor to work so it may work faster. Or BqStudio uses very conservative timings Slight smile

    Anyway, for my case, FSF is not an option so I will adjust the driver to do something similar to what BqStudio does. Luckily the firmware code is structured in such a way that it will not require a huge effort to do so.

    I will report back once I have had done the changes and tested them.