How to run I2C communication between STM32L476RC controller and BQ40Z50R2?
I am trying to do I2C communication between STM32L476RC and Fuel gauge IC(BQ40Z50R2),for that i am using following components:
1) STM32L476RC Controller
2) BQ40Z50R2 Fuel gauge IC
3) STM32 CubeMx software
4) Keil software
The datasheet of fuel gauge is http://www.ti.com/lit/ds/symlink/bq40z50-r2.pdf and datasheet of STM32L476RC is https://www.st.com/resource/en/datasheet/stm32l476rc.pdf.
I tried to write a code to take data(voltage,current and temperature) from fuel gauge where 3.7v Li-Ion battery is connected.To writting a code of I2C communication with Stm32l476 is getting little bit tough because nowhere given a single I2C program with this STM32L476 controller.
I initialise I2C pins in CubeMx and code is generated in keil. Then in while loop i used HAL_I2C_Master_Transmit and HAL_I2C_Master_Receive but not getting output in watch window ,also i checked it on oscilloscope but scl and sdl line shows just a dc horizontal line. Also I used HAL_I2C_Mem_Read,but not working.
I edited the code only in while ,rest of the code is generated by CubeMx.I am facing following problems: 1) My code is not giving any output 2) I am checking output on watch window in keil,is it right or wrong?
