Log AXP192 I2C errors in TTGO-T-BEAM

Hi there, many thanks in advance, i’m starting with Platformio. Please sorry my bad english.

I trying to see what AXP192 chip of my lilygo ttgo-tbeam t22_v1.0 (20190612) board not initialized.
I pasted this piece of code of github project ESP-32 Paxcounter of Cyberman54 ESP32-Paxcounter/src at master · cyberman54/ESP32-Paxcounter · GitHub

But fails in the line
if (pmu.begin(Wire, (AXP192_PRIMARY_ADDRESS)))
I have in platformio.ini:
build_flags = -DCORE_DEBUG_LEVEL=5
But no se any errors in debug terminal or console terminal

Any idea?
Thanks!

// Basic config
#include "Arduino.h"
#include "axp20x.h"
AXP20X_Class pmu;
void AXP192_power(bool on) {
  if (on) {
    pmu.setPowerOutPut(AXP192_LDO2, AXP202_ON);  // Lora on T-Beam V1.0
    pmu.setPowerOutPut(AXP192_LDO3, AXP202_ON);  // Gps on T-Beam V1.0
    pmu.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // OLED on T-Beam v1.0
    // pmu.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
    pmu.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
  } else {
    pmu.setChgLEDMode(AXP20X_LED_OFF);
    pmu.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
    pmu.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
    pmu.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
  }
}
void AXP192_init() {      
    if (pmu.begin(Wire, (0x34))) {
      Serial.println("AXP192 PMU initialization failed");
    }
    else {
Serial.println("Initialzation...");
      // configure AXP192
      pmu.setDCDC1Voltage(3500);              // for external OLED display
      pmu.setTimeOutShutdown(false);          // no automatic shutdown
      pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE); // TS pin mode off to save power

      // switch ADCs on
      pmu.adc1Enable(AXP202_BATT_VOL_ADC1, true);
      pmu.adc1Enable(AXP202_BATT_CUR_ADC1, true);
      pmu.adc1Enable(AXP202_VBUS_VOL_ADC1, true);
      pmu.adc1Enable(AXP202_VBUS_CUR_ADC1, true);

      // switch power rails on
      AXP192_power(true);

      Serial.println("AXP192 PMU initialized");
    }
}
void setup() {
  Serial.begin(115200);
  // put your setup code here, to run once:
 AXP192_init();
AXP192_power(true);
}
void loop() {}

No errors can also mean that it the chip simply won’t answer / ACK the I2C packages.

What is the output of the standard I2C scanner sketch? Are any addresses detected, and if yes which? If not, then we would need to know how exactly you’ve wired the chip, so a schematic would help.

1 Like

Some things to check might be (since you’re basing this from ESP32-Paxcounter:

Then, as maxgerhardt said, try the I2C scanner to see if the onboard AXP192 is responding properly.

Hi! thanks for replying.
problem is solved
Only replacing this line
if (pmu.begin(Wire, AXP192_PRIMARY_ADDRESS)) {
by those 2 lines:
Wire.begin(21, 22);
if (pmu.begin(Wire, AXP192_SLAVE_ADDRESS))

AXP intialized and ¡3.5v on 3V3 pin!!!