Post by riffelrw on Aug 16, 2020 19:05:36 GMT -8
I have had an intermittent (and now permanent) problem with my INA3221 breakout I purchased at the end of may. I am unable to read the mfg ID in my code and all measurements come back 0.0. I've split it out to just the code segment to read the ID to be sure my code isn't the issue, it's running on an Mini-LP board that I use to drive my Lead Acid Solar system. It's about as simple as it can get.
The code I'm running is below, this looks like the chip has failed - there isn't much in the code to mess up. The reading of the mfg id byte at 0xFE comes back -1. I've swapped out the grove cable and used a backup MiniLP so the breakout is about all that is left.
This is the output:
\\Mac\Home\Desktop\Projects\SkyWeather\INA3221_TEST\INA3221_TEST.ino
Checking for INA3221 Current Monitor...
Manufacturing ID=65535
INA3221 Not present?
Checking for INA3221 Current Monitor...
Manufacturing ID=65535
INA3221 Not present?
Any ideas?
Thanks
Rich R
SDL_Arduino_INA3221 INA3221(0x41, 0.1);
byte hb;
void heartBeat() {digitalWrite(LED_BUILTIN, hb); hb = !hb; return;}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
while (!Serial) {
heartBeat();
}
Serial.begin(9600); delay(1000);
Serial.println(__FILE__);
Wire.begin();
return;
}
void loop(){
uint16_t iStatus;
uint8_t addr;
addr = 0xFE;
Serial.println(F("Checking for INA3221 Current Monitor..."));
INA3221.begin();
INA3221.wireReadRegister(addr, &iStatus);
Serial.print(F("Manufacturing ID="));
Serial.println(iStatus);
if (iStatus != 0x5449) {
Serial.println(F("INA3221 Not present?"));
}
else {
for (uint16_t i = 1; i < 4; i++) {
Serial.print("INA3221 Channel: "); Serial.println(i);
Serial.print("Voltage(v): "); Serial.println(INA3221.getBusVoltage_V(i));
Serial.print("Current(ma): "); Serial.println(INA3221.getCurrent_mA(i));
}
delay(1000);
return;
}
The code I'm running is below, this looks like the chip has failed - there isn't much in the code to mess up. The reading of the mfg id byte at 0xFE comes back -1. I've swapped out the grove cable and used a backup MiniLP so the breakout is about all that is left.
This is the output:
\\Mac\Home\Desktop\Projects\SkyWeather\INA3221_TEST\INA3221_TEST.ino
Checking for INA3221 Current Monitor...
Manufacturing ID=65535
INA3221 Not present?
Checking for INA3221 Current Monitor...
Manufacturing ID=65535
INA3221 Not present?
Any ideas?
Thanks
Rich R
SDL_Arduino_INA3221 INA3221(0x41, 0.1);
byte hb;
void heartBeat() {digitalWrite(LED_BUILTIN, hb); hb = !hb; return;}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
while (!Serial) {
heartBeat();
}
Serial.begin(9600); delay(1000);
Serial.println(__FILE__);
Wire.begin();
return;
}
void loop(){
uint16_t iStatus;
uint8_t addr;
addr = 0xFE;
Serial.println(F("Checking for INA3221 Current Monitor..."));
INA3221.begin();
INA3221.wireReadRegister(addr, &iStatus);
Serial.print(F("Manufacturing ID="));
Serial.println(iStatus);
if (iStatus != 0x5449) {
Serial.println(F("INA3221 Not present?"));
}
else {
for (uint16_t i = 1; i < 4; i++) {
Serial.print("INA3221 Channel: "); Serial.println(i);
Serial.print("Voltage(v): "); Serial.println(INA3221.getBusVoltage_V(i));
Serial.print("Current(ma): "); Serial.println(INA3221.getCurrent_mA(i));
}
delay(1000);
return;
}