-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_flash_access.h
728 lines (591 loc) · 21 KB
/
data_flash_access.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
/**
@file data_flash_access.h
@brief 12.2.45 Data Flash Access() 0x4000–0x5FFF headers
Accessing data flash (DF) is only supported by the AltManufacturerAccess() by addressing the physical address.
@warning [!] Not Available in SEALED Mode.
UNSEALED Mode is enough for both: reading and writing.
If you try to read the DF in SEALED mode, you'll just get an array of zeros.
<pre>
BQ28Z610
Technical Reference Manual
(c) Texas Instruments
Literature Number: SLUUA65E
</pre>
@see https://www.ti.com/lit/ug/sluua65e/sluua65e.pdf
@see 13 Data Flash Values
@see 14 Data Flash Summary
MIT License
Copyright (c) 2024 Oleksii Sylichenko
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include <Arduino.h>
#include "globals.h"
#include "utils.h"
#include "alt_manufacturer_access.h"
#include "service.h"
/**
@brief Data Flash addresses
*/
class DF_ADDR {
public:
static const word MIN = 0x4000; ///< Minimum Data Flash address.
static const word MAX = 0x5FFF; ///< Maximum Data Flash address.
/**
@retval JBL: XTREME2
*/
static const word MANUFACTURER_NAME = 0x406B; ///< I2C Configuration; Data; Manufacturer Name; S21
/**
@retval JBL: ID1019-A-M26-28z610
*/
static const word DEVICE_NAME = 0x4080; ///< I2C Configuration; Data; Device Name; S21
/**
@retval JBL: 1352 - this is ID of the type for the Li-Ion battery
*/
static const word DEVICE_CHEMISTRY = 0x4095; ///< I2C Configuration; Data; Device Chemistry; S5
static const word GAS_GAUGING_CYCLE_COUNT = 0x4240; ///< Gas Gauging; State; Cycle Count; U2
/**
@retval Default: 0x0E
*/
static const word GAS_GAUGING_UPDATE_STATUS = 0x420E; ///< Gas Gauging; State; Update Status; H1
static const word FET_OPTIONS = 0x4600; ///< Settings; Configuration; FET Options; H1
/**
@retval JBL: 5100 (mAh)
*/
static const word DESIGN_CAPACITY_MAH = 0x462A; ///< Gas Gauging; Design; Design Capacity mAh; I2
/**
@retval JBL: 3672 (cWh)
*/
static const word DESIGN_CAPACITY_CWH = 0x462C; ///< Gas Gauging; Design; Design Capacity cWh; I2
static const word SOC_FLAG_CONFIG_A = 0x4632; ///< Settings; Configuration; 0x4632; SOC Flag Config A; H2
/**
@retval Default: 100
*/
static const word TC_SET_RSOC_THRESHOLD = 0x464B; ///< Gas Gauging; TC; Set % RSOC Threshold; U1
/**
@retval Default: 95
*/
static const word TC_CLEAR_RSOC_THRESHOLD = 0x464C; ///< Gas Gauging; TC; Clear % RSOC Threshold; U1
static const word DA_CONFIGURATION = 0x469B; ///< Settings; Configuration; DA Configuration; H1
/**
@retval JBL 330 (mA)
*/
static const word CHARGE_TERM_TAPER_CURRENT = 0x4693; ///< Advanced Charge Algorithm; Termination Config; Charge Term Taper Current; I2
static const word OCC_THRESHOLD = 0x46C9; ///< 13.10.3 OCC- Overcurrent In Charge: Protections; OCC; 0x46C9; Threshold; I2
/**
@retval JBL: 46.0 °C
*/
static const word OTC_THRESHOLD = 0x46D8; ///< 13.10.8 OTC - Overtemperature in Charge: Protections; OTC; 0x46D8; Threshold; I2
static const word OTC_RECOVERY = 0x46DB; ///< 13.10.8 OTC - Overtemperature in Charge: Protections; OTC; 0x46DB; Recovery; I2
/**
@retval JBL 4965
*/
static const word Q_MAX_CELL_1 = 0x4206; ///< Gas Gauging; State; Qmax Cell 1; I2
/**
@retval JBL 4931
*/
static const word Q_MAX_CELL_2 = 0x4208; ///< Gas Gauging; State; Qmax Cell 2; I2
/**
@retval JBL 4931
*/
static const word Q_MAX_PACK = 0x420A; ///< Gas Gauging; State; Qmax Pack; I2
/**
Ra Table; R_a0; 0x4100; Cell0 R_a flag; H2
High Byte:
- 0x00 - Cell impedance and QMax updated
- 0x05 - RELAX mode and QMax update in progress
- 0x55 - DISCHARGE mode and cell impedance updated
- 0xFF - Cell impedance never updated
Low Byte:
- 0x00 - Table not used and QMax updated
- 0x55 - Table being used
- 0xFF - Table never used, neither QMax nor cell impedance updated
Following it are 15 two-byte (I2) values of the corresponding row of the table.
@retval Default 0xFF55
@see 6.4.5 Ra Table Initial Values
*/
static const word CELL0_RA_FLAG = 0x4100;
/**
High Byte:
- 0x00 - Cell impedance and QMax updated
- 0x05 - RELAX mode and QMax update in progress
- 0x55 - DISCHARGE mode and cell impedance updated
- 0xFF - Cell impedance never updated
Low Byte:
- 0x00 - Table not used and QMax updated
- 0x55 - Table being used
- 0xFF - Table never used, neither QMax nor cell impedance updated
Following it are 15 two-byte (I2) values of the corresponding row of the table.
@retval Default 0xFF55
@see 6.4.5 Ra Table Initial Values
*/
static const word CELL1_RA_FLAG = 0x4140; ///< Ra Table; R_a1; 0x4140; Cell1 R_a flag; H2
/**
The initial x-values are a copy of the non-x data set.
Two sets of Ra tables are used alternatively when gauging
is enabled to prevent wearing out the data flash.
High Byte:
- 0x00 - Cell impedance and QMax updated
- 0x05 - RELAX mode and QMax update in progress
- 0x55 - DISCHARGE mode and cell impedance updated
- 0xFF - Cell impedance never updated
Low Byte:
- 0x00 - Table not used and QMax updated
- 0x55 - Table being used
- 0xFF - Table never used, neither QMax nor cell impedance updated
Following it are 15 two-byte (I2) values of the corresponding row of the table.
@retval Default 0xFFFF
@see 6.4.5 Ra Table Initial Values
*/
static const word X_CELL0_RA_FLAG = 0x4180; ///< Ra Table; R_a0x; 0x4180; xCell0 R_a flag; H2
/**
The initial x-values are a copy of the non-x data set.
Two sets of Ra tables are used alternatively when gauging
is enabled to prevent wearing out the data flash.
High Byte:
- 0x00 - Cell impedance and QMax updated
- 0x05 - RELAX mode and QMax update in progress
- 0x55 - DISCHARGE mode and cell impedance updated
- 0xFF - Cell impedance never updated
Low Byte:
- 0x00 - Table not used and QMax updated
- 0x55 - Table being used
- 0xFF - Table never used, neither QMax nor cell impedance updated
Following it are 15 two-byte (I2) values of the corresponding row of the table.
@retval Default 0xFFFF
@see 6.4.5 Ra Table Initial Values
*/
static const word X_CELL1_RA_FLAG = 0x41C0; ///< Ra Table; R_a1x; 0x41C0; xCell1 R_a flag; H2
};
/**
@brief Read array of bytes from the Data Flash by address.
Address should be fit into Data Flash addresses region, otherwise error message will be printed.
Requested length should be in the range [1; 32]
@see AltManufacturerAccess()
@see DF_ADDR::MIN
@see DF_ADDR::MAX
@see BlockProtocol
*/
void dfReadBytes(word addr, byte *retval, int len);
/**
@brief Write array of data to the Data Flash.
The byte order should be as it should be written in the data flash.
The Data length should be in the range [1; 32]
Some addresses within the standard region are prohibited from writing,
I am not sure about the exact ranges of such addresses.
For example, around the address 0x5A5A, there are data 0xFF and they cannot be overwritten.
Special thanks for providing the accurate definition of the DF writing algorithm
to the user "silomilo" from the Texas Intruments forum:
- https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/738029/bq28z610-data-flash-access-issues/2726302#2726302
> Write to 0x3E ( AltManufacturingAccess) the MAC address (little endian)
> followed by the data to write ( Note: Minimum data is 1 and maximum is 32 )
>
> Write to 0x60 ( MacDataChecksum ) the checksum calculated as per below
>
> Write to 0x61 ( MacDataLength ) the total number of bytes written
> including the MAC address, data bytes, checksum, and MACDataLength itself
>
> Read back from MAC address to verify (Write address to read to 0x3E and read back desired number of bytes)
@param addr - Address of the Data Flash to write data.
@param data - Array of data bytes.
@param len - Length of the data.
@see StdCommands::ALT_MANUFACTURER_ACCESS
@see StdCommands::MAC_DATA_CHECKSUM
*/
void dfWriteBytes(word addr, byte *data, int len);
/**
@see dfReadBytes()
*/
byte dfReadByte(word addr);
/**
@see dfReadByte()
*/
byte dfReadU1(word addr);
/**
@see dfWriteBytes()
*/
void dfWriteByte(word addr, byte value);
/**
@brief Read a word value (two bytes) from the Data Flash by address.
Result is in the Normal Order.
@param addr - two-byte address
@returns two byte in normal order: 0x4321
@see dfReadBytes()
@see composeWord()
*/
word dfReadWord(word addr);
/**
@brief Write a word value (two bytes) to the Data Flash by address.
Order of bytes should be Normal.
@see dfWriteBytes()
*/
void dfWriteWord(word addr, word value);
/**
@brief Read Two-byte Integer value from the Data Flash by address.
@see dfReadWord()
*/
int dfReadI2(word addr);
/**
@brief Write int value to the Data Flash by address.
@see dfWriteWord()
*/
void dfWriteI2(word addr, int value);
/**
@brief Read Two-byte unsigned integer value from the Data Flash by address.
@see dfReadWord()
*/
word dfReadU2(word addr);
/**
@brief Write unsigned int value to the Data Flash by address.
@see dfWriteWord()
*/
void dfWriteU2(word addr, word value);
/**
@brief Read String value from the Data Flash by address.
@see AltManufacturerAccess()
*/
String dfReadString(word addr);
/**
@brief Read the Device Name from the Data Flash.
I2C Configuration; Data; 0x4080; Device Name; S21
@see DF_ADDR::DEVICE_NAME
*/
String dfDeviceName();
/**
@brief Read the Design Capacity in mAh from the Data Flash.
Gas Gauging; Design; 0x462A; Design Capacity mAh; I2
Is used for LOAD mode = Constant Current.
@see DF_ADDR::DESIGN_CAPACITY_MAH
*/
int dfReadDesignCapacityMah();
/**
@brief Write Design Capacity in mAh to the Data Flash.
Gas Gauging; Design; 0x462A; Design Capacity mAh; I2
- JBL: 5100
@see DF_ADDR::DESIGN_CAPACITY_MAH
*/
void dfWriteDesignCapacityMah(int designCapacityMah);
/**
@brief Read the Design Energy in cWh from the Data Flash.
Gas Gauging; Design; 0x462C; Design Capacity cWh; I2
Is used for LOAD mode = Constant Power.
@see DF_ADDR::DESIGN_CAPACITY_CWH
*/
int dfReadDesignCapacityCwh();
/**
@brief Write Design Energy in cWh to the Data Flash.
Gas Gauging; Design; 0x462C; Design Capacity cWh; I2
- JBL: 3672
Design Energy = Nominal Voltage * Capacity
7.2 V * 5100 mAh = 36'720 mWh = 3672 cWh
@see DF_ADDR::DESIGN_CAPACITY_CWH
*/
void dfWriteDesignCapacityCwh(int designCapacityCwh);
/**
@brief Settings; Configuration; 0x4600; FET Options; H1
<pre>
Bit 0: Reserved
Bit 1: Reserved
Bit 2: OTFET—FET action in OVERTEMPERATURE mode
0 = No FET action for overtemperature condition
1 = CHG and DSG FETs will be turned off for overtemperature conditions.
Bit 3: CHGSU—FET action in CHARGE SUSPEND mode
0 = FET active
1 = Charging or precharging disabled, FET off
Bit 4: CHGIN—FET action in CHARGE INHIBIT mode
0 = FET active
1 = Charging or precharging disabled, FET off
Bit 5: CHGFET—FET action on valid charge termination
0 = FET active
1 = Charging or precharging disabled, FET off
Bit 6: SLEEPCHG—CHG FET enabled during sleep
0 = CHG FET off during sleep
1 = CHG FET remains on during sleep.
Bit 7: Reserved
</pre>
@see DF_ADDR::FET_OPTIONS
@see FetOptionsFlags
*/
byte dfReadFetOptions();
/**
@brief Settings; Configuration; FET Options; H1
Bit 5: CHGFET - FET action on valid charge termination
- 0 = FET active
- 1 = Charging or precharging disabled, FET off
@see DF_ADDR::FET_OPTIONS
@see FetOptionsFlags::CHGFET()
*/
void dfWriteFetOptionsCHGFET(bool chgFetBitValue);
/**
@brief Settings; Configuration; 0x469B; DA Configuration; H1
<pre>
Bit 0: CC0—Cell Count
0 = 1 cell
1 = 2 cell
Bit 1: Reserved
Bit 2: Reserved
Bit 3: IN_SYSTEM_SLEEP—In-system SLEEP mode
0 = Disables (default)
1 = Enables
Bit 4: SLEEP—SLEEP Mode
0 = Disables SLEEP mode
1 = Enables SLEEP mode (default)
Bit 5: Reserved
Bit 6: CTEMP—Cell Temperature protection source
0 = MAX (default)
1 = Average
Bit 7: Reserved
</pre>
@see DF_ADDR::DA_CONFIGURATION
@see DaConfigurationFlags
*/
byte dfReadDaConfiguration();
/**
@brief Gas Gauging; Update Status; 0x420E; H1
<pre>
Bit 1:0: Update1, Update0 - Update Status:
0,0 = Impedance Track gauging and lifetime updating is disabled.
0,1 = QMax updated
1,0 = QMax and Ra table have been updated
Bit 2: Impedance Track gauging and lifetime updating:
0 = Disabled
1 = Enabled
Bit 3: QMax update:
0 = Not updated
1 = Updated
Bit 7:4: Reserved
</pre>
@warning [!] If any Reserved bit is set then check whether security mode is Unsealed, otherwise Unseal the Device.
- 0x00 = 0000 - Impedance Track gauging and lifetime updating is disabled.
- 0x01 = 0001
- 0x02 = 0010
- 0x04 = 0100 - Neither QMax nor Ra table are updated. Learning is in progress.
- 0x05 = 0101 - QMax is updated.
- 0x06 = 0110 - QMax and Ra table are updated.
- 0x0E = 1110 - QMax is updated in field (in real conditions).
@see DF_ADDR::GAS_GAUGING_UPDATE_STATUS
@see GasGaugingUpdateStatusFlags
*/
byte dfReadGasGaugingUpdateStatus();
/**
@brief Gas Gauging; Update Status; 0x420E; H1
<pre>
Bit 1:0: Update1, Update0 - Update Status:
0,0 = Impedance Track gauging and lifetime updating is disabled.
0,1 = QMax updated
1,0 = QMax and Ra table have been updated
Bit 2: Impedance Track gauging and lifetime updating:
0 = Disabled
1 = Enabled
Bit 3: QMax update:
0 = Not updated
1 = Updated
Bit 7:4: Reserved
</pre>
@warning [!] If any Reserved bit is set then check whether security mode is Unsealed, otherwise Unseal the Device.
- 0x00 = 0000 - Impedance Track gauging and lifetime updating is disabled.
- 0x01 = 0001
- 0x02 = 0010
- 0x04 = 0100 - Neither QMax nor Ra table are updated. Learning is in progress.
- 0x05 = 0101 - QMax is updated.
- 0x06 = 0110 - QMax and Ra table are updated.
- 0x0E = 1110 - QMax is updated in field (in real conditions).
@see DF_ADDR::GAS_GAUGING_UPDATE_STATUS
*/
void dfWriteGasGaugingUpdateStatus(byte updateStatus);
/**
@brief Read and print all data from the Data Flash.
@see DF_ADDR::MIN
@see DF_ADDR::MAX
@see BlockProtocol::PAYLOAD_MAX_SIZE
*/
void dfReadAllData();
/**
@brief Print data from R_a table.
Cell 0, Cell 1, xCell 0, xCell 1:
- R_a flag
- 15 rows
@see DF_ADDR::CELL0_RA_FLAG
@see DF_ADDR::CELL1_RA_FLAG
@see DF_ADDR::X_CELL0_RA_FLAG
@see DF_ADDR::X_CELL1_RA_FLAG
*/
void dfPrintRaTable();
/**
@brief Advanced Charge Algorithm; Termination Config; 0x4693; Charge Term Taper Current; I2
@see DF_ADDR::CHARGE_TERM_TAPER_CURRENT
*/
int dfReadTaperCurrent();
/**
@brief Advanced Charge Algorithm; Termination Config; 0x4693; Charge Term Taper Current; I2
@see DF_ADDR::CHARGE_TERM_TAPER_CURRENT
*/
void dfWriteTaperCurrent(int taperCurrent);
/**
@brief Reset "R_a flags" in the Data Flash to the Default values:
- Cell0 R_a flag: addr = 0x4100, data = 0xFF55 - Cell impedance never updated; Table being used;
- Cell1 R_a flag: addr = 0x4140, data = 0xFF55 - Cell impedance never updated; Table being used;
- xCell0 R_a flag: addr = 0x4180, data = 0xFFFF - Cell impedance never updated; Table never used;
- xCell0 R_a flag: addr = 0x41C0, data = 0xFFFF - Cell impedance never updated; Table never used;
@see DF_ADDR::CELL0_RA_FLAG
@see DF_ADDR::CELL1_RA_FLAG
@see DF_ADDR::X_CELL0_RA_FLAG
@see DF_ADDR::X_CELL1_RA_FLAG
*/
void dfResetRaTableFlags();
/**
@brief Settings; Configuration; 0x4632; SOC Flag Config A; H2
<pre>
Bit 0: TDSETV—Enables the TD flag set by the cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 1: TDCLEARV—Enables the TD flag clear by cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 2: TDSETRSOC—Enables the TD flag set by RSOC threshold
0 = Disabled
1 = Enabled (default)
Bit 3: TDCLEARRSOC—Enables the TD flag cleared by the RSOC threshold
0 = Disabled
1 = Enabled (default)
Bit 4: TCSETV—Enables the TC flag set by cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 5: TCCLEARV—Enables the TC flag clear by cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 6: TCSETRSOC—Enables the TC flag set by the RSOC threshold
0 = Disabled (default)
1 = Enabled
Bit 7: TCCLEARRSOC—Enables the TC flag cleared by the RSOC threshold
0 = Disabled
1 = Enabled (default)
Bit 8: Reserved
Bit 9: Reserved
Bit 10: FCSETVCT—Enables the FC flag set by primary charge termination
0 = Disabled
1 = Enabled (default)
Bit 11: TCSETVCT—Enables the TC flag set by primary charge termination
0 = Disabled
1 = Enabled (default)
Bit 15: 12: Reserved
</pre>
@returns
- Default: 0x0C8C;
- JBL: 0001 0011 1000 0011;
@see DF_ADDR::SOC_FLAG_CONFIG_A
@see SOCFlagConfigAFlags
*/
word dfReadSocFlagConfigA();
/**
@brief Settings; Configuration; 0x4632; SOC Flag Config A; H2
<pre>
Bit 0: TDSETV—Enables the TD flag set by the cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 1: TDCLEARV—Enables the TD flag clear by cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 2: TDSETRSOC—Enables the TD flag set by RSOC threshold
0 = Disabled
1 = Enabled (default)
Bit 3: TDCLEARRSOC—Enables the TD flag cleared by the RSOC threshold
0 = Disabled
1 = Enabled (default)
Bit 4: TCSETV—Enables the TC flag set by cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 5: TCCLEARV—Enables the TC flag clear by cell voltage threshold
0 = Disabled (default)
1 = Enabled
Bit 6: TCSETRSOC—Enables the TC flag set by the RSOC threshold
0 = Disabled (default)
1 = Enabled
Bit 7: TCCLEARRSOC—Enables the TC flag cleared by the RSOC threshold
0 = Disabled
1 = Enabled (default)
Bit 8: Reserved
Bit 9: Reserved
Bit 10: FCSETVCT—Enables the FC flag set by primary charge termination
0 = Disabled
1 = Enabled (default)
Bit 11: TCSETVCT—Enables the TC flag set by primary charge termination
0 = Disabled
1 = Enabled (default)
Bit 15: 12: Reserved
</pre>
@returns
- Default: 0x0C8C;
- JBL: 0001 0011 1000 0011;
@see DF_ADDR::SOC_FLAG_CONFIG_A
*/
void dfWriteSocFlagConfigA(word socFlagConfigA);
/**
@brief Gas Gauging; TC; 0x464B; Set % RSOC Threshold
@see DF_ADDR::TC_SET_RSOC_THRESHOLD
*/
byte dfReadTcSetRsocThreshold();
/**
@brief Gas Gauging; TC; 0x464B; Set % RSOC Threshold
@see DF_ADDR::TC_SET_RSOC_THRESHOLD
*/
void dfWriteTcSetRsocThreshold(byte setThreshold);
/**
@brief Gas Gauging; TC; 0x464C; Clear % RSOC Threshold
@see DF_ADDR::TC_CLEAR_RSOC_THRESHOLD
*/
byte dfReadTcClearRsocThreshold();
/**
@brief Gas Gauging; TC; 0x464C; Clear % RSOC Threshold
@see DF_ADDR::TC_CLEAR_RSOC_THRESHOLD
*/
void dfWriteTcClearRsocThreshold(byte clearThreshold);
/**
@brief Gas Gauging; State; 0x4206; Qmax Cell 1; I2
@see DF_ADDR::Q_MAX_CELL_1
*/
int dfReadQmaxCell1();
/**
@brief Gas Gauging; State; 0x4208; Qmax Cell 2; I2
@see DF_ADDR::Q_MAX_CELL_2
*/
int dfReadQmaxCell2();
/**
@brief Gas Gauging; State; 0x420A; Qmax Pack; I2
@see DF_ADDR::Q_MAX_PACK
*/
int dfReadQmaxPack();
/**
@brief Qmax Pack = min(Qmax Cell 1, Qmax Cell 2)
- Gas Gauging; State; 0x4206; Qmax Cell 1; I2
- Gas Gauging; State; 0x4208; Qmax Cell 2; I2
- Gas Gauging; State; 0x420A; Qmax Pack; I2
@see DF_ADDR::Q_MAX_CELL_1
@see DF_ADDR::Q_MAX_CELL_2
@see DF_ADDR::Q_MAX_PACK
*/
void dfWriteQmax(word qMaxCell0, word qMaxCell1);
/**
@brief Gas Gauging; State; 0x4240; Cycle Count; U2
@see DF_ADDR::GAS_GAUGING_CYCLE_COUNT
*/
word dfReadCycleCount();
/**
@brief Gas Gauging; State; 0x4240; Cycle Count; U2
@see DF_ADDR::GAS_GAUGING_CYCLE_COUNT
*/
void dfWriteCycleCount(word cycleCount);