cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between stm32l476rc and fuel gauge(bq40z50r2) through I2C.

Mohan1
Associate III

Hello sir, i am trying to send command to fuel gauge from stm32l476 to get data like voltage,current and temperature of battery but not getting sir.Even sda or scl line unable to see on oscilloscope. i written a code for i2c but not working .please give me suggestion.

5 REPLIES 5
S.Ma
Principal

Did you put the pull-up resistors on the bus? the obvious first check.

Then find a SW GPIO bit bang I2C driver (I shared one on this forum, just not too sure how easy it is to retrieve it), and run it with a debugger.

To check if the GPIO SDA and SCL works, just try it manually through the GPIO registers on the debug watch window.

Mohan1
Associate III

thanks for your reply sir ,pull up resistor already i checked,it is there. you said that 'To check if the GPIO SDA and SCL works, just try it manually through the GPIO registers on the debug watch window' can you tell me more about this?

Configure the pins as GPIO outputs, and drive the pins alternately high and low, like you would with an LED

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

Yes sir ,I already done led blinking program on board with the help of Visual GDB in Visual studio.

Amel NASRI
ST Employee

dup https://community.st.com/s/question/0D50X0000BOtNGHSQ3/how-to-run-i2c-communication-between-stm32l476rc-controller-and-bq40z50r2

This discussion is closed.

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.