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.

[参考译文] BQ27441-G1:尝试设置设计容量时出现问题

Guru**** 2406390 points


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

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/658708/bq27441-g1-problem-trying-to-set-the-design-capacity

器件型号:BQ27441-G1

大家好、

我编写了一个 python 代码、如下所示、尝试将设计容量设置为1200mAh、但当我尝试写入地址 0x60时、我收到以下错误消息

"bus.write_byte_data (地址、0x60、0x1f)

IOError:[errno 121] Remote I/O error"(IOError:[errno 121]远程 I/O 错误)

我能够读取0x60;就在我尝试写入它时、我会收到 该消息。  是否有人知道导致此错误的原因?

谢谢!

导入 smbus
导入时间
import struct

bus=smbus.SMBus (1)

address = 0x55

e=bus.read_i2c_block_data (address、0x0a、2)
(full_cap、)=struct.unpackt ('h'、bytearray (e)[0:2])
打印"完全可用容量为"、full_cap、unpackt、 'ma'

#timing to write the Nominal capacity
bus.write_byte_data (address、0x00、0x00)
bus.write_byte_data (address
、0x00b、0x00)
bus.write_byte_data (address、0x00、0x00) bus.write_byte (byte_data













) 0x04、0xbyte_datace.byte (write、0x00、0x42)、byte_datace.byte_datace.byte_datace.byte (write、0x00、0x04、0xbyte_datace.byte_datace.byte (b)、0x00、0x00、0x00、0xbyte_datace.byte_datace.byte_datace.byte_datace.byte_datace.byte.byte.byte_datas.b、0x00、0x00、0x00、0x42、0x00、0x00、写入

(write_datace.byte_datace.byte.byte_datace.byte.byte.byte.byte.b












  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    尊敬的 Arthur:
    我咨询了我们的固件工程师、因为我不是软件专家、这里是收到的反馈。


    "错误听起来像是 NACKing、这是有道理的、因为如果您写入错误的校验和、监测计就会变黑。 如果没有该块中的其他数据、很难判断正确的校验和是什么、因此我无法确定0x1f 是否不正确、但可能是这样。 以下(未经测试的)之类的东西应该能达到目的。

    导入 smbus
    导入时间
    导入结构

    bus=smbus.SMBus (1)

    地址= 0x55

    e=bus.read_i2c_block_data (地址、0x0a、2)
    (full_cap、)=struct.unpackt ('h'、bytearray (e)[0:2])
    打印"完全可用容量为"、full_cap、'ma'

    #正在尝试写入标称容量
    BUS.WRITE_BYTE_DATA (地址、0x00、0x00)
    BUS.WRITE_BYTE_DATA (地址、0x01、0x80)
    BUS.WRITE_BYTE_DATA (地址、0x00、0x00)
    BUS.WRITE_BYTE_DATA (地址、0x01、0x80)

    BUS.WRITE_BYTE_DATA (地址、0x00、0x13)
    BUS.WRITE_BYTE_DATA (地址、0x01、0x00)

    BUS.WRITE_BYTE_DATA (地址、0x61、0x00)
    BUS.WRITE_BYTE_DATA (地址、0x3E、0x52)
    BUS.WRITE_BYTE_DATA (地址、0x3f、0x00)

    block=bus.read_i2c_block_data (地址、0x40、32)
    block=list (struct.unpackt ('32B'、bytearray (block)[0:32])
    块[0x0A]= 0x04
    block[0x0B]= 0xb0
    new_CHECKSUM =~SUM (BLOCK)& 0xFF

    bus.write_byte_data (address、0x4a、0x04)#writing new capacity
    bus.write_byte_data (address、0x4b、bbb0)#writing new capacity

    时间睡眠(1)

    bus.write_byte_data (地址、0x60、new_checksum)#正在尝试写入 BlockDataChecksum ()

    时间睡眠(1)
    BUS.WRITE_BYTE_DATA (地址、0x00、0x42)
    BUS.WRITE_BYTE_DATA (地址、0x01、0x00)

    BUS.WRITE_BYTE_DATA (地址、0x00、0x20)
    BUS.WRITE_BYTE_DATA (地址、0x01、0x00)



    f=bus.read_i2c_block_data (address、0x3c、2)用于设计容量的#address
    (DES_CAP、)=struct.unpackt ('h'、bytearray (f)[0:2])
    打印(DES_CAP)


    谢谢
    Onyx