cancel
Showing results for 
Search instead for 
Did you mean: 

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

Mohan1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

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.

View solution in original post

11 REPLIES 11
Pavel A.
Evangelist III

0690X00000BunD5QAJ.png

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

Please reply sir.

How about reading the Technical Reference Manual instead of asking questions, which have already been answered?

Yes, the device returns signed 16-bit number.

Sorry, I haven't noticed your reply earlier.

-- pa

Thank you so much sir.

@Piranha​ Thanks for your reply sir. I already read technical reference manual,in technical reference manual,value of discharge current is given like - Min= -32768mA and max=0mA.

Piranha
Chief II

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
Associate III

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