Go Down

Topic: MKRGSM1400 - VIN (bq24195 dead?) (Read 170 times) previous topic - next topic

k4hvd

Apr 15, 2019, 10:00 pm Last Edit: Apr 15, 2019, 10:02 pm by k4hvd
Hello,
I have two boards.
Been running them powered using the mkr-rs485 module. All good.

Recently one of the board doesnt work, but with a battery connected. Its no problem.
Charge lit up and everything act as normal.

Disconnect the battery again and its dead, Seems like the bq24195L doesnt produce 3.8V out on the pin, SYS.

Been testing out with some i2c-communications to the bq24195. But not there yet..

Anyone else experienced this?
Or have any sketch working to check statuses on bq24195?

 

k4hvd

#1
Apr 16, 2019, 12:13 pm Last Edit: Apr 16, 2019, 12:14 pm by k4hvd
Hmm, Dont know whats wrong, no fault codes. Nothing really off with the registers.
Might be somewhere else the problem on my board is..


Put some code together to read the registers. Use at your own risk.


Code: [Select]

// MKRGSM1400 CHECK STATUS ON BQ24195L
// READ THE MANUAL bq24195.pdf . TEXTS MAY NOT BE CORRECT.
// ALPHA VERSION- Use at your own risk.

#include <Wire.h>

#include "wiring_private.h"

#define PMIC_ADDRESS  0x6B

#define BQ24195L_INPUT_SRC_CTRL_REG 0x00
#define BQ24195L_PWR_ON_CFG_REG 0x01
#define BQ24195L_CHRG_CURRNT_CTRL_REG 0x02
#define BQ24195L_PRECHRG_TERM_CURRNT_CTRL_REG 0x03
#define BQ24195L_CHRG_VOLT_CTRL_REG 0x04
#define BQ24195L_CHRG_TERM_TIME_CTRL_REG 0x05
#define BQ24195L_THERMAL_REGULATION_CTRL_REG 0x06
#define BQ24195L_MISC_OP_CTRL_REG 0x07
#define BQ24195L_SYS_STATUS_REG 0x08
#define BQ24195L_FAULT_REG 0x09
#define BQ24195L_V_P_REV_STATUS 0x0A

String def_values(uint8_t regAddr)
{
  switch (regAddr)
  {
    case BQ24195L_INPUT_SRC_CTRL_REG: //0x00
    Serial.println("REG00 INPUT SOURCE CONTROL REGISTER DESCRIPTION");
    return " BQ24195L_INPUT_SRC_CTRL_REG \n Default: 00110000 or 30 \n";

    case BQ24195L_PWR_ON_CFG_REG: //0x01
    Serial.println("REG01 POWER-ON CONFIGURATION REGISTER DESCRIPTION");
    return " BQ24195L_PWR_ON_CFG_REG \n Default: 00011011 or 1B \n";

    case BQ24195L_CHRG_CURRNT_CTRL_REG: //0x02
    Serial.println("REG02 CHARGE CURRENT CONTROL REGISTER DESCRIPTION");
    return " BQ24195L_CHRG_CURRNT_CTRL_REG \n Default: 01100000 or 60 \n";

    case BQ24195L_PRECHRG_TERM_CURRNT_CTRL_REG: //0x03
    Serial.println("REG03 PRE-CHARGE/TERMINATION CURRENT CONTROL REGISTER DESCRIPTION");
    Serial.println("Pre-Charge Current Limit");
    Serial.println(" Bit 7 IPRECHG[3] R/W 0 1024 mA Offset: 128 mA, Range: 128 mA to 2048 mA Default: 256 mA (0001)");
    Serial.println(" Bit 6 IPRECHG[2] R/W 0 512 mA ");
    Serial.println(" Bit 5 IPRECHG[1] R/W 0 256 mA");
    Serial.println(" Bit 4 IPRECHG[0] R/W 1 128 mA");
    Serial.println("Termination Current Limit");
    Serial.println(" Bit 3 ITERM[3] R/W 0 1024 mA Offset: 128 mA Range: 128 mA to 2048 mA Default: 256 mA (0001)");
    Serial.println(" Bit 2 ITERM[2] R/W 0 512 mA ");
    Serial.println(" Bit 1 ITERM[1] R/W 0 256 mA");
    Serial.println(" Bit 0 ITERM[0] R/W 1 128 mA");
    return " BQ24195L_CHRG_TERM_TIME_CTRL_REG \n Default: 00010001 or 11 \n";

    case BQ24195L_CHRG_VOLT_CTRL_REG: //0x04
    Serial.println("REG04 CHARGE VOLTAGE CONTROL REGISTER DESCRIPTION");
    Serial.println("Charge Voltage Limit");
    Serial.println(" Bit 7 VREG[5] R/W 1 512 mV Offset: 3.504 V Range: 3.504 V to 4.400 V (111000) Default: 4.208 V (101100) ");
    Serial.println(" Bit 6 VREG[4] R/W 0 256 mV ");
    Serial.println(" Bit 5 VREG[3] R/W 1 128 mV");
    Serial.println(" Bit 4 VREG[2] R/W 1 64 mV");
    Serial.println(" Bit 3 VREG[1] R/W 0 32 mV");
    Serial.println(" Bit 2 VREG[0] R/W 0 16 mV");
    Serial.println("Battery Precharge to Fast Charge Threshold");
    Serial.println(" Bit 1 BATLOWV R/W 1 0 - 2.8 V, 1 - 3.0 V Default: 3.0 V (1)");
    Serial.println("Battery Recharge Threshold (below battery regulation voltage)");
    Serial.println("Bit 0 VRECHG R/W 0 0 - 100 mV, 1 - 300 mV Default: 100 mV (0)");
    return " BQ24195L_CHRG_VOLT_CTRL_REG \n Default: 10110010 or B2 \n";

    case BQ24195L_CHRG_TERM_TIME_CTRL_REG: //0x05
    Serial.println("REG05 CHARGE TERMINATION/TIMER CONTROL REGISTER DESCRIPTION");
    return " BQ24195L_CHRG_TERM_TIME_CTRL_REG \n Default: 10011010 or 9A \n";

    case BQ24195L_THERMAL_REGULATION_CTRL_REG: //0x06
    Serial.println("REG06 THERMAL REGULATION CONTROL REGISTER DESCRIPTION");
    Serial.println("Thermal Regulation Threshold");
    Serial.println(" Bit 1 TREG[1] R/W 1 00 - 60°C, 01 - 80°C, 10 - 100°C, 11 - 120°C Default: 120°C (11)");
    Serial.println(" Bit 0 TREG[0] R/W 1");
    return " BQ24195L_THERMAL_REGULATION_CTRL_REG \n Default = 00000011 or 03 \n";
 
    case BQ24195L_MISC_OP_CTRL_REG: //0x07
    Serial.println("REG07 MISC OPERATION CONTROL REGISTER DESCRIPTION");
    return " BQ24195L_MISC_OP_CTRL_REG \n Default = 01001011 or 4B \n";

    case BQ24195L_SYS_STATUS_REG: //0x08
    Serial.println("REG08 SYSTEM STATUS REGISTER DESCRIPTION");
    Serial.println("Bit 7 & Bit 6 VBUS_STAT[1-0] R 00 - Unknown (no input, or DPDM detection incomplete), 01 - USB host, 10 - Adapter port, 11 - OTG");
    Serial.println("Bit 5 CHRG_STAT[1] R 00 - Not Charging, 01 - Pre-charge (<VBATLOWV), 10 - Fast Charging, 11 - Charge");
    Serial.println("Bit 4 CHRG_STAT[0] R Termination Done");
    Serial.println("Bit 3 DPM_STAT R 0 - Not DPM, 1 - VINDPM or IINDPM");
    Serial.println("Bit 2 PG_STAT R 0 - Not Power Good, 1 - Power Good");
    Serial.println("Bit 1 THERM_STAT R 0 - Normal, 1 - In Thermal Regulation");
    Serial.println("Bit 0 VSYS_STAT R 0 - Not in VSYSMIN regulation (BAT > VSYSMIN), 1 - In VSYSMIN regulation (BAT <VSYSMIN)");
    return " BQ24195L_SYS_STATUS_REG \n ";

    case BQ24195L_FAULT_REG: //0x09
    Serial.println("REG09 FAULT REGISTER DESCRIPTION");
    Serial.println("Bit 7 WATCHDOG_FAULT R 0 - Normal, 1- Watchdog timer expiration");
    Serial.println("Bit 6 Reserved R 0 - Reserved");
    Serial.println("Bit 5 & Bit 4 CHRG_FAULT[1-0] R 00 - Normal, 01 - Input fault (VBUS OVP or VBAT < VBUS < 3.8 V), 10 - Thermal shutdown,11 - Charge Safety Timer Expiration");
    Serial.println("Bit 3 BAT_FAULT R 0 - Normal, 1 - BATOVP");
    Serial.println("Bit 2,1 & Bit 0 NTC_FAULT[2-0] R 000 - Normal, 101 - Cold, 110 - Hot");
    return " BQ24195L_FAULT_REG \n ";

    case BQ24195L_V_P_REV_STATUS: //0x0A
    return " BQ24195L_V_P_REV_STATUS \n Default: 00100011 or 23 \n";
    default:
    return " \n";
  }
 
}
void readRegister(uint8_t i2cAddr, uint8_t regAddr)
{
  Wire.begin();
  Wire.beginTransmission(i2cAddr); // select device with "beginTransmission()"
  Wire.write(regAddr); // select starting register with "write()"
  Wire.endTransmission(); // end write operation, as we just wanted to select the starting register
  Wire.requestFrom(i2cAddr, 2); // select number of bytes to get from the device (2 bytes in this case)
  Wire.end();
  byte regVal = Wire.read();
  String LINE = def_values(regAddr) + "HEX=" + String(regVal,HEX) + " BIN:" + String(regVal,BIN) + " \n\n";
  Serial.print(LINE);
}
void setup() {
  Serial.begin(9600);
  while (!Serial) { ; } //Wait for serialmonitor.
  Serial.println("Checking BQ24195L..");
  delay(5000);
}

void loop() {

for (uint8_t i=0;i<=10;i++)
{
  readRegister(PMIC_ADDRESS,i);
  delay(2500);
}
delay(30000);

}

Go Up