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.

[参考译文] BQ25703A:所有 ADC 读数均为零

Guru**** 2457760 points
Other Parts Discussed in Thread: BQ25703A

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

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1518431/bq25703a-all-adc-readouts-are-reading-zero

器件型号:BQ25703A

工具/软件:

大家好、能否帮助我使用这款 BQ25703A 充电器芯片?

我正在尝试让它正常工作、但无法读取任何电压或电流值。  

这是我的 Arduino 源代码、我正在使用此库读取/写入寄存器: https://github.com/Lawmate/BQ25703A/tree/master

#include <Arduino.h>
#include <Wire.h>



#include "i2c_scanner.h"    
#include "usb_pd.h"
#include "io_expander.h"

// Define I2C pins 
const int I2C_SDA_PIN = 1; 
const int I2C_SCL_PIN = 0;


#include <Lorro_BQ25703A.h>
#define BQ25703ADevaddr    0x6B

//Initialise the device and library
Lorro_BQ25703A BQ25703A;
const byte Lorro_BQ25703A::BQ25703Aaddr = BQ25703ADevaddr;

//Instantiate with reference to global set
extern Lorro_BQ25703A::Regt BQ25703Areg;

void setup() {
  Serial.begin(115200);
  while (!Serial); // Wait for serial port to connect (optional)
  Serial.println(F("\nSystem Booting Up..."));

  // Initialize I2C bus - This is critical and should be done once.
  // The BQ25703A init function will use these pins if specified,
  // or assume Wire is already configured if pins are passed as -1 (default in charger.h)
  // For clarity, bq25703a_init can take these pins.
  Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN); 
  Serial.print(F("I2C Initialized with SDA: ")); Serial.print(I2C_SDA_PIN);
  Serial.print(F(", SCL: ")); Serial.println(I2C_SCL_PIN);
  
  Serial.println(F("Scanning I2C bus..."));
  scan(); // Call your I2C scanner function
  delay(100);


  setup_usb();
  //setup_io_expander();

  //Set the watchdog timer to not have a timeout
  BQ25703Areg.chargeOption0.set_WDTMR_ADJ( 0 );
  BQ25703A.writeRegEx( BQ25703Areg.chargeOption0 );
  delay( 15 );

  //Set the ADC on IBAT and PSYS to record values
  //When changing bitfield values, call the writeRegEx function
  //This is so you can change all the bits you want before sending out the byte.
  BQ25703Areg.chargeOption1.set_EN_IBAT( 1 );
  BQ25703Areg.chargeOption1.set_EN_PSYS( 1 );
  BQ25703A.writeRegEx( BQ25703Areg.chargeOption1 );
  delay( 15 );

  //Set ADC to make continuous readings. (uses more power)
  BQ25703Areg.aDCOption.set_ADC_CONV( 0 );
  BQ25703Areg.aDCOption.set_ADC_START( 1 );
  //Set individual ADC registers to read. All have default off.
  BQ25703Areg.aDCOption.set_EN_ADC_VBUS( 1 );
  BQ25703Areg.aDCOption.set_EN_ADC_PSYS( 1 );
  BQ25703Areg.aDCOption.set_EN_ADC_IDCHG( 1 );
  BQ25703Areg.aDCOption.set_EN_ADC_ICHG( 1 );
  BQ25703Areg.aDCOption.set_EN_ADC_VSYS( 1 );
  BQ25703Areg.aDCOption.set_EN_ADC_VBAT( 1 );
  //Once bits have been twiddled, send bytes to device
  BQ25703A.writeRegEx( BQ25703Areg.aDCOption );
  delay( 15 );

  
}

unsigned long lastChargerStatusTime = 0;


void loop() {


  //handle_io_expander();
  BQ25703Areg.aDCOption.set_ADC_START( 1 );
  BQ25703A.writeRegEx( BQ25703Areg.aDCOption );
  delay( 15 );

   Serial.print( "Voltage of VBUS: " );
    Serial.print( BQ25703Areg.aDCVBUSPSYS.get_VBUS() );
    Serial.println( "mV" );
    delay( 15 );

    Serial.print( "System power usage: " );
    Serial.print( BQ25703Areg.aDCVBUSPSYS.get_sysPower() );
    Serial.println( "W" );
    delay( 15 );

    Serial.print( "Voltage of VBAT: " );
    Serial.print( BQ25703Areg.aDCVSYSVBAT.get_VBAT() );
    Serial.println( "mV" );
    delay( 15 );

    Serial.print( "Voltage of VSYS: " );
    Serial.print( BQ25703Areg.aDCVSYSVBAT.get_VSYS() );
    Serial.println( "mV" );
    delay( 15 );

    Serial.print( "Charging current: " );
    Serial.print( BQ25703Areg.aDCIBAT.get_ICHG() );
    Serial.println( "mA" );
    delay( 15 );

    Serial.print( "Voltage of VSYS: " );
    Serial.print( BQ25703Areg.aDCIBAT.get_IDCHG() );
    Serial.println( "mA" );
    delay( 15 );

  Serial.println("----------------");
  Serial.println();
  Serial.println();

    delay(10); // Small delay between reads to ensure bus stability, adjust if needed


     
  delay(5000);
}


此代码基本上是库中的 readVoltages 示例

以下是串行控制台的输出:

System Booting Up...
I2C Initialized with SDA: 1, SCL: 0
Scanning I2C bus...
Scanning...
I2C device found at address 0x27  !  -> PCF IO Expander
I2C device found at address 0x28  !  -> USB_PD
I2C device found at address 0x40  !  -> INA3221 ADC
I2C device found at address 0x6B  !  -> Charger
I2C device found at address 0x75  !  -> Buck converter
done


Initializing STUSB4500...
Connected to STUSB4500!
STUSB4500: Set to request 9V if possible

Voltage of VBUS: 3200mV
System power usage: 0.00W
Voltage of VBAT: 2880mV
Voltage of VSYS: 2880mV
Charging current: 0mA
Voltage of VSYS: 0mA
----------------



有人知道问题是什么? 可能是硬件问题? I2C 扫描仪正确检测到芯片、因此芯片应该能正常工作。 VBUS 输入端为5V、但 ADC 没有读取任何电压

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

    您好 Vojtech、

    根据您的代码、似乎您将 ADC 设置为运行一次(ADC_CONV=0)、然后读取 ADC 值(ADC_START=1)、再启用 ADC。 在设置 ADC_START=1之前、如果启用了 ADC、您会看到任何差异吗?

    此致、

    基督教。

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

    你好 Christian,谢谢你的答复

    在启动 ADC 之前启用 ADC 没有任何区别。 我还尝试了连续模式(ADC_CONV=1)、该模式也没有执行任何操作。

    我尝试的另一个方法是直接使用 I2C 写入寄存器、而不使用 GitHub 上的该库。 结果相同、但我确认 I2C 接口工作正常(ManufacturerID 和 DeviceID 正确读取、写入寄存器、然后读回也有效)

    为完整起见、这是电路板的原理图、我认为不存在任何错误、因为这与数据表中的示例应用非常接近

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

    您好 Vojtech、

     您还必须禁用低功耗模式:

    此致、

    基督教

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

    您好、谢谢您的回复、这解决了 ADC 的问题。

    但现在我正在尝试让充电工作、我没有太大的成功。

    除了最大充电电压和充电电流外、我需要设置哪些寄存器才能开始充电? 我还尝试禁用 EN_EXTILIM 和 IDWM_AUTO_DISABLE、但这没有任何帮助

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

    您好 Vojtech、

    您是否能够提供寄存器转储?

    此致、

    基督教

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

    -- BQ25703A 寄存器转储--
    寄存器0x00:0x020E
    寄存器0x02:0x01C0
    寄存器0x04:0x2000
    寄存器0x30:0x9210
    寄存器0x32:0x0237
    寄存器0x34:0x0000
    寄存器0x3A:0xE06F
    寄存器0x20:0xA000
    寄存器0x22:0x0000
    寄存器0x24:0x4100
    寄存器0x26:0x1C00
    寄存器0x28:0x0000
    寄存器0x2A:0x0000
    寄存器0x2C:0x4D4D
    寄存器0x06:0x0000
    寄存器0x08:0x0000
    寄存器0x0A:0x0000
    寄存器0x0C:0x1800
    寄存器0x0E:0x4100
    寄存器0x2E:0x7840

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

    尊敬的 Vojtech:

    请按照我们的用户指南执行三个步骤来初始化充电。  

    请在执行该过程之前进行上电复位。  

    此致、

    Tiger

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

    我发现了错误、这是 ILIM_HIZ 上不正确的分压器
    我通过1k 电阻将引脚拉至3V3