cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement LTC4015 with Stm32L072 MCU, I want to charge the battery through LTC4015 using I2C. Can you please suggest me how to use this in stm32 microcontroller.

jm.2
Associate II

How to implement LTC4015 with Stm32L072 MCU, I want to charge the battery through LTC4015 using I2C. Can you please suggest me how to use this in stm32 microcontroller. 

1 ACCEPTED SOLUTION

Accepted Solutions
Foued_KH
ST Employee

Hello @jm.2​ ,

If we look at the datasheet of the LTC4015 :

  • The address : " I2C Address :1101_000[R/W]"
  • The LTC4015 serial port is compatible with the 400kHz speed

Finally, open STM32CubeMx and start the configuration. :D

I recommend you this WIKI : Getting started with I2C - stm32mcu ,It will help you for the configuration.

Hope my answer helped you!

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

8 REPLIES 8
Foued_KH
ST Employee

Hello @jm.2​ ,

If we look at the datasheet of the LTC4015 :

  • The address : " I2C Address :1101_000[R/W]"
  • The LTC4015 serial port is compatible with the 400kHz speed

Finally, open STM32CubeMx and start the configuration. :D

I recommend you this WIKI : Getting started with I2C - stm32mcu ,It will help you for the configuration.

Hope my answer helped you!

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

JM S.1
Associate

Thank you. But no useful =)​

Hi sir,

Can you please tell me how to send the LTC4015 commands in stm32. If you have any sample code means send me. Please help me on this.

Thanks in advance.

Hello ,

Battery charge voltage is pin selectable and I 2C adjustable. Input current limit and charge current can be accurately programmed with sense resistors and can be individually adjusted via the I2C serial port

So you can try to manage your application via I2C commands :

/* Write an amount of data in blocking mode to a specific memory address*/
HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout);
 
/*Read an amount of data in blocking mode from a specific memory address*/
HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress,uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout);

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

jm.2
Associate II

How to implement this, can you please tell me.

First of all, please

  • check sensor pins : (SCL / SDA)
  • The address : " I2C Address :1101_000[R/W]"
  • The LTC4015 serial port is compatible with the 400kHz speed

Open STM32CubeMx and start the configuration.

Generate code (choose your IDE)

  1. Define your address and buffers for reception and transmission
  2. Start the communication : ( for example to read data from register address (0x15) which is

0693W00000aHbGOQA0.png

HAL_I2C_Mem_Read(&hi2c1, DevAddress, 0x15,1, (uint8_t*)(&register_value), 1, 1000);

Hope my answer helped you!

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

jm.2
Associate II

Thanks for quick response.

Yeah I understood, how to implement, but I have one more doubts please help me don't take mistake, my doubt is what registers and all I have to use to charge the battery, please help me.

jm.2
Associate II

Hi,

I am waiting for your reply.