Skip to main content
Mohan1
Associate III
December 18, 2019
Solved

Read current of Li-ion battery from fuel gauge(bq40z50r2) in stm32cubeIDE.

  • December 18, 2019
  • 11 replies
  • 4427 views

Hello,

I am trying to get data of battery in stm32cubeIDE,I have taken voltage and temperature of battery successfully but when i was trying to get current of battery, it shows value like 65535 or 65473....like a garbage value.I am reading current in milli ampere.I also checked value on bqstudio as shown below image and it is (-1103mA),negative sign because it is discharging current.0690X00000BumPPQAZ.jpg

But when i send the register address of current in this same bqstudio,it shows garbage value FBB2 i.e.64434 same as showing in stm32cubeIDE. I have connected load of 5ohm and battery voltage is 3.5v .Please give me any suggestion.0690X00000BumRpQAJ.jpg

This topic has been closed for replies.
Best answer by Piranha

TRM in section 14.11 clearly states Min = –32767 mA, Max = 32768 mA, Word protocol and I2 data type, which is explained in section 15.1.2.

11 replies

Pavel A.
December 18, 2019

0690X00000BunD5QAJ.png

Mohan1
Mohan1Author
Associate III
December 19, 2019

Thanks for your response sir,means i am getting current data in 2's complement form .Am i right sir?

Piranha
PiranhaBest answer
Principal III
December 22, 2019

TRM in section 14.11 clearly states Min = –32767 mA, Max = 32768 mA, Word protocol and I2 data type, which is explained in section 15.1.2.

Mohan1
Mohan1Author
Associate III
December 22, 2019

@Piranha​ Thanks for your reply sir, and negative sign for discharge current ?

Piranha
Principal III
December 22, 2019

Current has a direction. Obviously the sign indicates direction of the current.

Mohan1
Mohan1Author
Associate III
December 23, 2019

@Piranha​ Thanks sir.