I designed a test board for the BQ25798 TI. Here I am going to write about the test.
For checking the i2c, I am using 20230921 - i2C tools on ESP32
Things that I need to test to validate the component:
- Is capable to charge batteries?
- In order to test this. I put a Input source, something like 5V, and see if there is output current, and see the voltage of the battery.
- Is capable to do MPPT?
Some details
- The device has the i2c address 0x6B
- When the light is on it means that is not charging. You need to enable charging with i2C, but it seems that even tho is charging.
Load resistor
I want to have an output of 100mAh. The output of vsys is going to be 4.2V =>
$$ V = I \cdot R \Rightarrow R = \frac{V}{I} = \frac{4.2}{0.1} = 42 \ 4.2 V \cdot 0.1 = 0,42 Watts $$
The axial resistors are normally 0.125:
$$ \frac{0.5 Watts}{1/8} = 4 Resistors $$
Just in case I am going to use 5 resistors, so none of them are going to be burned:
$$ R_T = 42 = \frac{R}{4} \Rightarrow R = 170 $$
Known errors
- The footprint and the schematic is good regarding to the schottky, however I ocnfused the orientation when I soldered it.
- Put testpoints in the shunt resistors (R4)
Test one Battery
This test is going to be:
- Put a load resistor of 42 ohm as stated before
- Plug a battery
- See the output
- See the i2c
The i2c output:
i2c-tools> i2cdetect
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- 6b -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
i2c-tools> i2cdump -c 0x6b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 04 01 a4 00 64 24 01 2c c3 05 23 00 dc 4b 3d a2 ???.d$?,??#.?K=?
10: 85 40 00 01 1e aa c0 7a 54 00 32 20 00 01 c0 00 ?@.????zT.2 .??.
20: 00 00 20 02 00 00 00 00 00 00 00 00 00 00 30 00 .. ?..........0.
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 19 ff ff ff ff ff ff ff ........?.......
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
Registers lookup
The interesting registers for debugging are:
- REG1B_Charger_Status_0 -> 1B
- REG1C_Charger_Status_1 -> 1C
- REG1D_Charger_Status_2 -> 1D
- REG1E_Charger_Status_3 -> 1E
- REG1F_Charger_Status_4 -> 1F
- REG2E_ADC_Control -> 2E
- REG3B_VBAT_ADC -> 3B
And the values with just a battery connected with 4.2V are:
- REG1B_Charger_Status_0 -> 1B. CONTENT: 20
- REG1C_Charger_Status_1 -> 1C. CONTENT: 00
- REG1D_Charger_Status_2 -> 1D. CONTENT: 01
- REG1E_Charger_Status_3 -> 1E. CONTENT: c0
- REG1F_Charger_Status_4 -> 1F. CONTENT: 00
I am going to enable the ADC to get the value of the battery. Is like this:
i2cset -c 0x6b -r 0x2e 0xb0
After this the dump changed to:
i2c-tools> i2cdump -c 0x6b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 04 01 a4 00 64 24 01 2c c3 05 23 00 dc 4b 3d a2 ???.d$?,??#.?K=?
10: 85 40 00 01 1e aa c0 7a 54 00 32 00 00 01 c0 00 ?@.????zT.2..??.
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 00 ..............?.
30: 00 00 00 00 00 00 00 00 00 00 00 10 36 10 42 02 ...........?6?B?
40: 9c 00 1e 00 00 00 00 00 19 ff ff ff ff ff ff ff ?.?.....?.......
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
Get voltage battery:
i2cset -c 0x6b -r 0x2e 0xb0
i2cget -c 0x6b -r 0x3b -l 2
- REG3B_VBAT_ADC -> 3B. CONTENT: 10 36 (4150DEC)
OUTPUT I changed the voltage of the battery and then the adc’s values change. That means that the adc works perfectly. The only thing is that is necessary to set the register of adc enable all the times you want to sample the voltage.
TEST: Is capable to charge batteries?
I put a battery with 3.79V, then a input voltage of 5Volts.
What happen after that is:
- The output VSYS is the battery voltage, that is 3.76. And then the led is powered on. The power suppy is giving 5V and 0.39A. The output voltage changed to 4.08V (Battery voltage) And te led is powered on.
When the light is on is that is not charging, and this is due there is no thermistor, I am going to ignore it with i2c:
i2cget -c 0x6b -r 0x18
That gives 0x54. I am going to se 0x55
i2cset -c 0x6b -r 0x18 0x55
Get battery stat:
i2cget -c 0x6b -r 0x1c