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.

[参考译文] BQ4050:BQ4050读取失败

Guru**** 2539500 points
Other Parts Discussed in Thread: BQ4050

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

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1046493/bq4050-bq4050-reading-fail

器件型号:BQ4050

您好!

我使用了 BQ4050和 nRF52832。 我从 BQ4050获得了以下损坏的数据。

最后一个标记的值、即 DAStatus2Reg (0x72)的温度。 它运行良好、但随机运行、故障。   

如何解决此问题? 请帮帮我。

APP:BMS (3:37:57):11178 12400 2679
APP:BMS (3:37:58): 11178 12400 2679
APP:BMS (3:37:59):11179 12400 2679
APP:BMS (3:38:0):11178 12400 2679
应用程序:BMS (3:38:1):11178 12400 2679
应用程序:BMS (3:38:2):11178 12400 2679
应用程序:BMS (3:38:3):11178 12400 2679
应用程序:BMS (3:38:4):11178 12400 2679
应用程序:BMS (3:38:5):11178 12400 2679
应用程序:BMS (3:38:6):11178 12400 2679
应用程序:BMS (3:38:7):11178 12400 2679
应用程序:BMS (3:38:8):11178 12400 -275
应用程序:BMS (3:38:9):11178 12400 -275

我的读取代码如下所示、

void read_BQ4050_data (uint8_t regAddress、uint8_t size)

RET_CODE_t ERR_code;
uint8_t reg[1]={regAddress};
uint8_t buf[2]={0};

ERR_code = nrf_drv_twi_TX (&m_twi、BQ4050_wher_am_i、reg、sizeof (reg)、false);
APP_ERROR_CHECK (ERR_code);

tWI_done ();


开关(尺寸)

案例1:
ERR_code = nrf_drv_twi_Rx (&m_twi、BQ4050_wher_am_i、m_buf8、size);
中断;

案例2:
ERR_code = nrf_drv_twi_Rx (&m_twi、BQ4050_wher_am_i、(uint8_t *) m_buf16、size);
中断;

案例4:
ERR_code = nrf_drv_twi_Rx (&m_twi、BQ4050_wher_am_i、m_buf、size);
中断;

默认值:
ERR_code = nrf_drv_twi_Rx (&m_twi、BQ4050_wher_am_i、m_buf、size);
中断;



APP_ERROR_CHECK (ERR_code);

tWI_done ();

switch (regAddress)

Case StateOfChargeReg:
m_bms_measurement1->realSOC =(uint8_t) m_buf8[0];
中断;

Case CellVoltageOne:
m_bms_measurement1->cellV[0]= m_buf16[0];
//ERR_CHECK_READ (&m_BMS_measurement1->CELLV[0]、&PRE_CV1、1);
中断;

Case CellVoltageTwo:
m_bms_measurement1->cellV[1]= m_buf16[0];
//ERR_CHECK_READ (&m_BMS_measurement1->CELLV[1]、&PRE_CV2、1);
中断;

Case CellVoltageThree:
m_bms_measurement1->cellV[2]= m_buf16[0];
//ERR_CHECK_READ (&m_BMS_measurement1->CELLV[2]、&PRE_CV3、1);
中断;

Case CellVoltageFour:
m_bms_measurement1->cellV[3]= m_buf16[0];
//ERR_CHECK_READ (&m_BMS_measurement1->CELLV[3]、&PRE_cV4、1);
nrf_log_info ("单元格 V:%d %d %d %d %d %d %d %d "、m_bms_measurement1->cellV[0]、m_bms_measurement1->cellV[1]、m_BMS_measurement1->cellV[2]、m_BMS_cellurement1->V[3];
中断;

案例电流寄存器:
m_bms_measurement1->packCurrent = m_buf16[0];
//m_BMS_measurement1->packCurrent = 21000;
//ERR_CHECK_READ (&m_BMS_measurement1->CELLV[2]、&PRE_CV3、1);
//nrf_log_info ("Pack C:%d"、m_BMS_measurement1->packCurrent);
中断;

案例卷注册:
m_bms_measurement1->packVoltage = m_buf16[0];
ERR_CHECK_READ (&m_BMS_measurement1->packVoltage、&pre_PV、1);
//nrf_log_info ("Pack V:%d"、m_BMS_measurement1->packVoltage);
中断;

实例操作状态注册器:
m_status_bq4050->OperationStatus = byte2short (m_buf[1]、m_buf[2]);
中断;

案例制造商状态注册器:
m_status_bq4050->ManufacturingStatus = byte2short (m_buf[1]、m_buf[2]);
中断;

案例状态2注册:
m_bms_measurement2->temperature [0]= byte2short (m_buf[3]、m_buf[4])-KTEMP_PARAM;
m_bms_measurement2->temperature [1]= byte2short (m_buf[5]、m_buf[6])-KTEMP_PARAM;
m_bms_measurement2->temperature [2]= byte2short (m_buf[7]、m_buf[8])-KTEMP_PARAM;
m_bms_measurement2->temperature [3]= byte2short (m_buf[9]、m_buf[10])-KTEMP_PARAM;
//nrf_log_info ("Pack Temp:%d"、m_bms_measurement2->temperature [0]);
中断;

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

    尊敬的 David:

    如果没有完整的信息、很难在代码中找到错误。 我建议您监控总线并查看是否存在导致数据损坏的干扰。 如果总线报告的数据正确、则代码可能是原因。