BQ27426 GMFS Quick file modification

source: Shenzhen bangbanghao Technology Co., Ltd popularity:387 Time of publication:2021/12/14 10:41:44 small middle big

In mobile phones, tablets and other personal mobile products, we often pay attention to the battery capacity. Ti's bq27426, bq27z561 and other battery power monitoring chips can calculate the battery capacity by detecting the battery voltage, current and temperature. Both are single battery meters, which are widely used in the above scenarios. In actual use, you need to configure various parameters, generate GMFs files, and then submit them to customers for generation The H file is incorporated into the customer's code.

1.1 introduction to modification process

Generally speaking, when customers need to modify the configuration and generate new GMFs files, they need to submit chemid and GMFs files to the product line for modification, which takes a long time. Especially when customers only need to modify 1-2bit, this process may delay the project development progress and affect the customer experience. In the following, take the most common dmcode modification as an example to introduce how to modify it quickly. The modification process is mainly: find the dmcode register position - > find the check bit position and quickly calculate - > Modify and verify.

1.2 quickly modify dmcode

In the customer's program, we usually distinguish different configuration programs by judging the bit of dmcode built in bq27426. If the dmcode is consistent, there may be conflicts in the customer's software, so we need to help the customer modify it quickly.

This paper is based on the GMFs file, and it is not modified in the upper computer interface. After the modification in the upper computer interface, it may also involve the problem that the newly generated GMFs file does not contain chemid. Similarly, the product line needs to help us add chemid information to the GMFs file. The specific method is not repeated.

Before making changes, we need to understand the GMFs file. You can refer to GMFs file analysis for a brief understanding of GMFs files.

Dmcode is described in TRM as follows, but our bqstudio software does not open this bit register. After confirmation with the product line, our DM code is located in bit 5 of subclass ID. That is, the position of subclass 64 and offset 5 in table 7-2. (table 7-2 does not fully display all registers)



Figure 1.1 dmcode definition

Subclass 64 here is 64 under Dec. if you switch to hex, it is 0x40 Then we need to find the instruction written by 0x40 in the GMFs file:


Figure 1.2 code routine

Similarly, according to GMFs file analysis, the first line represents the address of subclass 64, the second line represents writing data, the third line represents writing checksum, the fourth line represents waiting, and the fifth and sixth lines are checksum related verification.

The offset of our dmcode is 5. In the above code, find the position with offset 5, that is, the position of 01 (marked in red in the figure for ease of understanding).

The next step is to find the position of the check bit and how to calculate it quickly. Here, the code has been marked in red, that is, 0d in the third line and 0d in the sixth line. Next, how to quickly modify.

For the calculation of checksum, see Chapter 4 of bq27426 TRM, which is described in detail:


Figure 1.3 checksum calculation process

If complete calculation is required every time, it will take more time. The quick modification method here is to compare the value to be modified with the value before modification, and add the negative sign of the changed value to the checksum.

For example, it can be seen from the above figure that our dmcode is 01. If we change it to 02, the changed value is + 1. Therefore, the value of checksum needs - 1. At present, the value of checksum is 0d. After dmcode is modified, the value of checksum should be 0C

The screenshot here is a comparison table modified by the upper computer. It can be found that after dmcode is changed to 2, the checksum value changes from 0d to 0C.


Figure 1.4 comparison of dmcode results

This article provides a method to directly modify dmcode based on GMFs file. If you need to modify the value of other registers, please consult FAE to confirm whether you can modify the value. Some modified values may affect gauge's prediction algorithm.

Product Message Telephone