Hi Team,
Our customer is using Arduino MKRWiFi1010 that contains BQ24195. According to her, when it gets an error on Reg09, it halts all arduino operations. She is getting the values of 128 and 48. She had reached out to Arduino but was directed to contact us because the device she is reading error codes from is BQ24195. What could be the cause of this error?
Attached are the schematic diagram of MKRWiFi1010 and the source code.
MKRWiFi1010V2.0_sch.pdf#include <Wire.h>
#include <Arduino_PMIC.h>
#define INPUT_SOURCE_REGISTER 0x00
#define POWERON_CONFIG_REGISTER 0x01
#define CHARGE_CURRENT_CONTROL_REGISTER 0x02
#define PRECHARGE_CURRENT_CONTROL_REGISTER 0x03
#define CHARGE_VOLTAGE_CONTROL_REGISTER 0x04
#define CHARGE_TIMER_CONTROL_REGISTER 0x05
#define THERMAL_REG_CONTROL_REGISTER 0x06
#define MISC_CONTROL_REGISTER 0x07
#define SYSTEM_STATUS_REGISTER 0x08
#define FAULT_REGISTER 0x09
#define PMIC_VERSION_REGISTER 0x0A
void setup() {
// put your setup code here, to run once:
PMIC.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(readFaultRegister());
delay(2000);
}
int writeRegister(byte address, byte val){
Wire.beginTransmission(0x6B); //PMIC address
Wire.write(address);
Wire.write(val);
if(Wire.endTransmission(true) != 0){
return 0;
}
return 1;
}
int readRegister(byte address){
Wire.beginTransmission(0x6B); //PMIC address
Wire.write(address);
if(Wire.endTransmission(true)!= 0){
return -1;
}
if(Wire.requestFrom(0x6B,1,true) != 1){
return -1;
}
return Wire.read();
}
byte readFaultRegister(){
int DATA = 0;
DATA = readRegister(FAULT_REGISTER);
return DATA;
}
Regards,
Danilo