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.

[参考译文] BQ28Z620:电压和 SOC 值读取不正确

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

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1524960/bq28z620-incorrect-reading-of-voltage-and-soc-values

器件型号:BQ28Z620

工具/软件:

您好团队:

您好团队:
我们目前在项目中遇到以下问题
(1)当多个驱动器同时工作时、逻辑分析仪捕获的波形不正确、在此过程中时钟存在延迟、并且在读取寄存器之前和之后、SDA 和 SCL 电平均为低电平、如 gaute.kvdat 中所示
(2)仅保留电量监测计驱动器时、时序图正确、如 fuel-gAUGE_comrRECT.kvdat 中所示
(3)读取数据时出错
Current:128;Cyclec_count:0;voltage:32768;temperature:128;soc:128;status:128
另一个读取结果为电流:0;cyclec_count:0;voltage:32768;temperature:0;soc:0;status:0;在 EVK 测试期间、我们使用大端模式来读取电压(小端模式未正确读取数据)其余数据在小端模式下读取

(4)我是否要与您确认 bq28z620的寄存器地址是16位?

此致!

光圈

typedef struct __attribute__((packed)) {
    uint8_t high_byte;  /*buf[0] */
    uint8_t low_byte;  /*buf[1] */
} bq28z620_voltage_t;

typedef struct __attribute__((packed)) {
    uint8_t low_byte;
    uint8_t high_byte;
} bq28z620_reg_t;

static int read_voltage(const msdk_device_t *dev, uint16_t *milli_volts)
{
    bq28z620_voltage_t voltage_data = {0};
    int res = MSDK_STATUS__ERROR;

    res = read_reg(dev, BQ28Z620_CMD__VOLTAGE, (uint8_t *)&voltage_data);

    if (MSDK_STATUS__OK == res){

        *milli_volts = (voltage_data.high_byte << 8) | voltage_data.low_byte;
    }
    MSDK_LOG_DBG("milli_volts: %d", *milli_volts);

    return res;
}

static int read_relative_soc(const msdk_device_t *dev, uint16_t *percent)
{
    bq28z620_reg_t soc_data = {0};
    int res = MSDK_STATUS__ERROR;

    res = read_reg(dev, BQ28Z620_CMD__RELATIVE_STATE_OF_CHARGE,(uint8_t *)&soc_data);
    MSDK_LOG_DBG("read_relative_soc:0x%02x, 0x%02x", soc_data.high_byte, soc_data.low_byte);
    if (MSDK_STATUS__OK == res){

        *percent = (soc_data.high_byte << 8) | soc_data.low_byte;
        MSDK_LOG_DBG("read_relative_soc:%d", *percent);
    }

    return res;
}