2018-02-13 08:22 AM
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 #stc31152018-02-13 08:39 AM
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:
the gas gauge always fails to initialize
So what, exactly, does that mean?
How have you proven basic I2C comms ?
2018-02-13 10:25 AM
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
2018-02-13 10:46 AM
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 ?
Have you studied the evaluation resources I linked above?
Have you
studied the support documents on the Product Page, linked above?
2018-02-13 11:24 AM
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');2018-02-13 11:28 AM
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
2018-02-13 12:19 PM
Again, have you studied the evaluation resources I linked above?
And have you
studied the support documents on the Product Page, linked above?