cancel
Showing results for 
Search instead for 
Did you mean: 

Gas Gauge(STC3115) Initialization on a custom board

Srinivas Gopal
Associate II
Posted on February 13, 2018 at 17:22

I am trying to get STC3115 working on a custom board based on STM32L476VX MCU. The battery used for the custom board is RJD3555. After initializing the I2C interface, the gas gauge always fails to initialize. Any help on this matter would be greatly appreciated

Thanks,

Srinivas

#stm32l4 #stc3115
6 REPLIES 6
Posted on February 13, 2018 at 17:39

http://www.st.com/en/power-management/stc3115.html

 

So, before starting on your custom board, have you built basic familiarity & functionality with one of the listed evaluation options:

http://www.st.com/content/st_com/en/products/evaluation-tools/solution-evaluation-tools/psu-and-converter-solution-eval-boards/steval-isb014v2.html

 

http://www.st.com/content/st_com/en/products/evaluation-tools/solution-evaluation-tools/sensor-solution-eval-boards/steval-wesu1.html

 

the gas gauge always fails to initialize

So what, exactly, does that mean?

How have you proven basic I2C comms ?

Posted on February 13, 2018 at 18:25

The first I2C communication is for initialization of STC3115, there is no other peripheral connected to the MCU via I2C, Is there a way to test I2C comms before initializing the gas gauge?

Thanks,

Srinivas

Posted on February 13, 2018 at 18:46

Srinivas Gopal wrote:

I2C, Is there a way to test I2C comms before initializing the gas gauge?

Go on - this is basic I2C stuff.

Have you read and understood chapter 7 of the datasheet - which describes the I2C interface, Register Map, etc ?

  • Does the chip correctly ACK its address?
  • Can you read the ID register?
  • Can you write to a register, and read-back what you wrote?

Have you studied the evaluation resources I linked above?

Have you 

studied the support documents on the Product Page, linked above?

Posted on February 13, 2018 at 19:24

  printf('Scanning I2C bus:\r\n');

  HAL_StatusTypeDef result;

  uint8_t i;

  for (i=1; i<128; i++)

  {

    /*

     * the HAL wants a left aligned i2c address

     * &hi2c1 is the handle

     * (uint16_t)(i<<1) is the i2c address left aligned

     * retries 2

     * timeout 2

     */

    result = HAL_I2C_IsDeviceReady(&hi2c1, (uint16_t)(i<<1), 2, 2);

    if (result != HAL_OK) // HAL_ERROR or HAL_BUSY or HAL_TIMEOUT

    {

            printf('.'); // No ACK received at that address

    }

    if (result == HAL_OK)

    {

            printf(' 0x%X ', i); // Received an ACK at that address

    }

  }

  printf('\r\n');
Posted on February 13, 2018 at 19:28

You were right, the problem was with I2C configuration, the clock source was incorrect, After changing that the STC3115 initializes properly. STC3115 is able to detect the battery and returns presence as 1, but the voltage and state of charge(SOC) is returned as zero. Any ideas about what may be causing this?

Thanks,

Srinivas

Posted on February 13, 2018 at 20:19

Again, have you studied the evaluation resources I linked above?

And have you 

studied the support documents on the Product Page, linked above?