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.

BQ34Z100EVM: bq34z100-G1 .c driver for stm32

Part Number: BQ34Z100EVM
Other Parts Discussed in Thread: BQ34Z100-G1, BQSTUDIO, EV2400, BQ34Z100

Hi

I will use the bq34z100-g1 gauge IC in a project and I will communicate it with the stm32 microprocessor over i2c. But I couldn't find any .c code about it. There is a driver written for Linux, but not at the microcontroller level and since it will take time to translate it, do you have such a code? I will be very glad if you can help.

  • Hi,

    I am not aware of any such code unfortunately. Although it is for a different gauge, maybe referencing this could be helpful? And here is another document that may be helpful. Best of luck.

    thanks,

    Alex M.

  • Thank you for your early reply, but my problem is not solved. There is no other driver other than the linux system. Isn't there a study done at the microcontroller level? Texas int. Do you have any way or a technical friend to suggest in this regard?
    good work...

  • Hello,

    The TRM has information on how to communicate to the gauge via I2C. How your system sends those I2C signals to the gauge is up to you. I am not familiar with the STM32 microcontroller's API, and I don't believe we have any material for that specifically. This document explains the entire gauge communication process and even has some example code in C, so it may be more helpful for you. 

    Try searching for "STM32 HAL I2C example code" or something along those lines. Overall, different microcontrollers will all have different libraries so it is impossible for us to have a generic code that will work with all hosts. Here is some material from STM about their HAL drivers:

    https://www.st.com/resource/en/user_manual/dm00105879-description-of-stm32f4-hal-and-ll-drivers-stmicroelectronics.pdf

    Page 482 has the I2C info

    If this isn't what you are looking for, could you please elaborate on what code exactly you are looking for? 

    thanks,

    Alex M.

  • Hi

    Thanks again for your quick replies.
    My first question:
    What I want to tell you is that I use your ICs in many projects. I am currently using both monitoring and Gauge in the current project. A very nice C code has been shared with Monitoring:
    training.ti.com/microcontroller-programming-bq769x2-battery-monitor-family
    Microcontroller Code Examples for BQ769x2 Battery Monitors

    What I mean is, do you have a software C code like this in Gauge? Because you tested this Gauge IC over i2c with microcontrollers or another system. It is controlled by BQ studio for now, but I will not be able to use Bq studio because I will make my own circuit. This means that I will have to make software like bq studio because I make special designs for my customers.

    My second question is:

    If I don't use bq studio how will I introduce it to promote battery chemistry. That's why I'm looking for the C code.

  • Hello,

    Thanks for elaborating more. The main reason we don't have code like the monitor you listed is the difference in memory. This monitor works with ROM/OTP memory, while this gauge is flash-based. So while this monitor would need the host to initialize and configure the configuration on reset, there would be no such need on a flash gauge. For the gauge, many people's host code may be as simple as monitoring SOC and any flags.

    As for programming the data memory, that is a bit more complicated and I think may be more what you are looking for. The gauge communication document I linked previously does have some example code in c for that though. 

    As for the chemid, that data is proprietary so you will need at least one EV2400 and BQstudio for that. The usual flow is:

    1. Find chemid
    2. Program it to gauge via EV2400 and BQstudio
    3. Configure other settings and do calibration and learning cycle
    4. export the flashstream file/ "golden image" 
    5. in mass production, use a uC that can parse the flashstream and program each gauge (does not require EV2400 or BQstudio)
    6. Once in the system, an entirely different code running on the host uC reads parameters like SOC or temp

    So to be clear, at least one EV2400 will be needed to generate the flashstream file that contains all of the configuration data including the chemid. I also suggest configuring the data memory and sealing at this stage as well. If you want an experience similar to the monitor you linked, you would need to use one of our ROM gauges, as those don't require an EV2400 since they have pre-programmed chemids.  

    I looked at the monitor code and it should still be good reference material for the system host once programming is done. The gauge and monitor work very similarly and the code should work for the BQ34Z100 with just a few changes.  

    thanks,

    Alex M.