This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] BQ27220:为什么从数据存储器读取 CC 增益和 CC 差值?

Guru**** 2587365 points
Other Parts Discussed in Thread: BQSTUDIO, BQ27220

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1224106/bq27220-why-can-t-i-read-cc-gain-and-cc-delta-from-data-memory

器件型号:BQ27220
主题中讨论的其他器件:BQSTUDIO

我尚未尝试所有数据存储器地址、但尽管已尝试相同的地址、但我可以读取除 CC Gain @ 0x9184和 CC Delta @ 0x9188之外的任何其他地址。 每当我尝试读取这些内容时、返回的数据与最后一个成功读取地址的数据相同。

请不要让我尝试探查 bqStudio 的功能、然后复制该功能。

我用示波器查看了 I2C 流量、没有看到有任何问题。 到目前为止、所有其他组件都正常工作。 我也用调试器单步执行代码、结果是一样的。 所以我认为这不是因为操作之间的延迟不够。 当然、除非某个地方需要极长的延迟。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Sauli:

    如果您可以读取此前的地址中的数据、那么只需读取一个更长的块。 数据字节按照地址返回。 如果您使用该方法获得良好的效果、请告诉我。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    该问题实际上适用于所有地址0x918x。 读取该区域中的单个参数或将所有4个参数作为单个12字节块将返回之前读取的地址中的数据。 看起来将地址0x918x 写入3E/3F 没有任何效果。 使用之前在该处写入的地址。

    地址0x9180是在0x9xxx 地址范围内使用的最低地址、所以我不能从低于该地址的地址开始块读取?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我认为0x9xxx 是 OTP 地址。 写 OTP 的过程需要特定的电压

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我没有尝试写入 OTP。

    如果我错了、请更正我、但这是我对它如何工作的理解:

    电量计复位时-即连接电池时-默认参数从 ROM/OTP 读取到数据存储器(RAM)。 可以使用 TRM (sluubd4.pdf)的第3.4章中列出的地址从数据存储器中读取该数据。 由于从未对 OTP 进行编程、因此在读取时所有这些参数均为0。 读取时、ROM 中的参数具有默认值。

    第3.4章中的数据存储器表具有"Class"、"Subclass"、"Address"等列。 读取时、"Class"列中所有具有注释(存在 OTP)的参数都会返回值0。  它们的地址范围为0x40xx 和0x41xx。   读取时、"Class"列中所有具有注释(ROM 默认值)的参数都会返回列出的默认值。   它们的地址范围为0x48xx 和0x49xx。 其余参数在地址范围0x91xx 和0x92xx 中。 这些是电量监测时实际使用的参数。

    所以、问题是、我可以读取除地址0x918x 处的所有参数之外的所有参数。 我甚至可以写入至少一些参数(仅尝试了几个参数)。 例如、我可以在地址0x9274 (平滑 Delta 电压)处编写参数。 当我读回它时、会返回更改后的值。 即使我在从0x9274读取某些其他参数时、也是如此。  如果我写入地址0x918x、则如果我立即读回该写入值、将返回写入值。 但如果我先读取其他地址、则不会。 在这种情况下、将返回来自该另一个地址的数据。 我的结论是、实际上我无法读取或写入地址0x918x。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Sauli:

    您的理解是正确的。 我现在没有 EVM。 我将在获取 EVM 的同时尝试这些步骤。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Sauli:

    我认为您可能没有完全解封 bq27220。 我尝试了一下、结果如下

    UNSEALED 状态确认-检查 SEC0、SEC1

    读取数据存储器以用作参考(与要读取的数据进行交叉检查)

    事务日志-也读取0x91b4、以确保值没有卡住

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我看到 bqStudio 读取了0x9184之外的数据、但这似乎不是 CC Gain 的默认值。 但是、这不能解决我的问题。 我无法在器件中集成 bqStudio! 那么、问题是 bqStudio 的作用有哪些不同呢?

    我已将一些日志记录添加到我的代码中。 根据这种说法、我在阅读时电量监测计是解封的。 你说"完全解封"是什么意思? 我希望不是"完全访问"、因为这不是必需的(除非地址0x918x 属于某种例外情况)。

    // The device has a debug interface to execute debug commands.
    // One of the commands is 'GAUGE' and it reads / modifies the
    // given gauge Data Memory address.
    //
    // The sequence:
    // 1. Read two bytes from 0x91D4
    // 2. Read four bytes from 0x9184
    // 3. Read two bytes from 0x9232
    // 4. Read four bytes from 0x9184
    //
    // A <GAUGE> line is a response from the debug task that it started executing the GAUGE command.
    // A line starting with a Data Memory address is the result of the GAUGE command.
    // All other lines are I2C transactions as seen by the I2C driver.
    // -> means write
    // <- means read
    // -> AA xx AB means write xx/repeated Start for read
    // ; is a comment added by me
    
    <GAUGE>
    -> AA 3A AB <- B6 00	; Check current security status: Sealed
    -> AA 00 14 04 			; Unseal 1st write
    -> AA 00 72 36 			; Unseal 2nd write
    -> AA 3A AB <- B4 00 	; Check if Unsealed: Yes
    -> AA 3E D4 91 			; Set address 0x91D4
    -> AA 40 AB <- 1C 98 	; Read 2 bytes
    0x91D4: Voltage Comp Coefficient 1 = 7320 (0x00001C98)	; Yes, this is the default value of 0x91D4
    -> AA 3A AB <- B4 00	; Check current security status: Unsealed
    -> AA 00 30 00 			; Seal
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    <GAUGE>
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    -> AA 00 14 04 			; Unseal 1st write
    -> AA 00 72 36 			; Unseal 2nd write
    -> AA 3A AB <- B4 00 	; Check if Unsealed: Yes
    -> AA 3E 84 91 			; Set address 0x9184
    -> AA 40 AB <- 1C 98 02 D3 	; Read 4 bytes
    0x9184: CC Gain = 0x1C9802D3 ; Wrong, the first two bytes are the same as in the previous read.
    -> AA 3A AB <- B4 00 	; Check current security status: Unsealed
    -> AA 00 30 00 			; Seal
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    <GAUGE>
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    -> AA 00 14 04 			; Unseal 1st write
    -> AA 00 72 36 			; Unseal 2nd write
    -> AA 3A AB <- B4 00 	; Check if Unsealed: Yes
    -> AA 3E 32 92 			; Set address 0x9232
    -> AA 40 AB <- 02 26 	; Read 2 bytes
    0x9232: OT Chg = 550 (0x00000226) * 0.1°C  ; Yes, this is the default value of 0x9232
    -> AA 3A AB <- B4 00 	; Check current security status: Unsealed
    -> AA 00 30 00 			; Seal
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    <GAUGE>
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    -> AA 00 14 04 			; Unseal 1st write
    -> AA 00 72 36 			; Unseal 2nd write
    -> AA 3A AB <- B4 00 	; Check if Unsealed: Yes
    -> AA 3E 84 91 			; Set address 0x9184
    -> AA 40 AB <- 02 26 02 01 	; Read 4 bytes
    0x9184: CC Gain = 0x02260201 ; Wrong, the first two bytes are the same as in the previous read.
    -> AA 3A AB <- B4 00 	; Check current security status: Unsealed
    -> AA 00 30 00 			; Seal
    -> AA 3A AB <- B6 00 	; Check current security status: Sealed
    

    如果有任何线索、我还注意到、从0x9184读取后、电量监测计不会为下一次读取解封、直到经过最多4-5秒的延迟。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Sauli:

    bqStudio 高级通信选项卡是用于演示命令工作的低级选项卡。 其他屏幕截图供参考。 您可以实现来自任何微控制器的通信。

    我认为您的问题是因为 bq27220不处于完全访问解封模式。 0x9184是校准数据

    来自 TRM 的代码段

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、这样解决了问题。 但这是令人困惑和不合逻辑的,你可以读取大多数参数没有完全访问,但需要它的几个。