Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery charge #9

Closed
bmorcelli opened this issue Nov 6, 2024 · 2 comments
Closed

Battery charge #9

bmorcelli opened this issue Nov 6, 2024 · 2 comments

Comments

@bmorcelli
Copy link

Hello,

I can´t get the battery to charge when connected to USB, unless I get back to Factory app

I'm using this code:
lib: lewisxhe/XPowersLib @ ^0.2.6

#include <XPowersLib.h>
extern XPowersPPM PPM;

void setup() {
// code code

Wire.begin(8, 18);
      pmu_ret = PPM.init(Wire, 8, 18, BQ25896_SLAVE_ADDRESS);
      if(pmu_ret) {
          PPM.setSysPowerDownVoltage(3300);
          PPM.setInputCurrentLimit(3250);
          Serial.printf("getInputCurrentLimit: %d mA\n",PPM.getInputCurrentLimit());
          PPM.disableCurrentLimitPin();
          PPM.setChargeTargetVoltage(4208);
          PPM.setPrechargeCurr(64);
          PPM.setChargerConstantCurr(832);
          PPM.getChargerConstantCurr();
          Serial.printf("getChargerConstantCurr: %d mA\n",PPM.getChargerConstantCurr());
          PPM.enableADCMeasure();
          PPM.enableCharge();
      }
// code code 
}

@ShallowGreen123
Copy link
Collaborator

Try examples/bq25896_test

The example uses the library lewisxhe/ XPowersLib@ ^0.2.4

After downloading this program, open the serial port;

@bmorcelli
Copy link
Author

I changed the library and tested with the example setup, didn´t work either..

it only worked afer add:
´´´
PPM.enableOTG();
PPM.disableOTG();
´´´

the working code was:

    bool pmu_ret = false;
    Wire.begin(8, 18);
    pmu_ret = PPM.init(Wire, 8, 18, BQ25896_SLAVE_ADDRESS);
    if(pmu_ret) {
        PPM.setSysPowerDownVoltage(3300);
        PPM.setInputCurrentLimit(3250);
        Serial.printf("getInputCurrentLimit: %d mA\n",PPM.getInputCurrentLimit());
        PPM.disableCurrentLimitPin();
        PPM.setChargeTargetVoltage(4208);
        PPM.setPrechargeCurr(64);
        PPM.setChargerConstantCurr(832);
        PPM.getChargerConstantCurr();
        Serial.printf("getChargerConstantCurr: %d mA\n",PPM.getChargerConstantCurr());
        PPM.enableADCMeasure();
        PPM.enableCharge();
    }
     PPM.enableOTG();
     PPM.disableOTG();

thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants