Skip to main content
Mohan1
Associate III
Dec 18, 2019 3:46 PM UTC
Solved

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

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.
Piranha
PiranhaBest answer
Principal III
Dec 22, 2019 7:53 AM UTC

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.
Dec 18, 2019 10:37 PM UTC

0690X00000BunD5QAJ.png

Mohan1
Mohan1Author
Associate III
Dec 19, 2019 3:37 AM UTC

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
Dec 22, 2019 7:53 AM UTC

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
Dec 22, 2019 9:30 AM UTC

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

Piranha
Principal III
Dec 22, 2019 9:40 AM UTC

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

Mohan1
Mohan1Author
Associate III
Dec 23, 2019 5:03 AM UTC

@Piranha​ Thanks sir.