INA226 not working with vbs connected

Hi
I am trying a few days to troubleshot this and while i have some progress, i am still not understanding the issue.I have an INA226 connected as in the picture and i use an old ATX power supply, and the code is:

*/

#include <Wire.h>
#include "INA226.h"

INA226 ina;

void checkConfig()
{

  Serial.print("Max possible current:  ");
  Serial.print(ina.getMaxPossibleCurrent());
  Serial.println(" A");

  Serial.print("Max current:           ");
  Serial.print(ina.getMaxCurrent());
  Serial.println(" A");

  Serial.print("Max shunt voltage:     ");
  Serial.print(ina.getMaxShuntVoltage());
  Serial.println(" V");

  Serial.print("Max power:             ");
  Serial.print(ina.getMaxPower());
  Serial.println(" W");
}

void setup() 
{
  Serial.begin(115200);

  Serial.println("Initialize INA226");
  Serial.println("-----------------------------------------------");

  // Default INA226 address is 0x40
  ina.begin();

  // Configure INA226
  ina.configure(INA226_AVERAGES_1, INA226_BUS_CONV_TIME_1100US, INA226_SHUNT_CONV_TIME_1100US, INA226_MODE_SHUNT_BUS_CONT);

  // Calibrate INA226. Rshunt = 0.1 ohm, Max excepted current = 4A
  ina.calibrate(0.1, 4);

  // Display configuration
  checkConfig();

  Serial.println("-----------------------------------------------");
}

void loop()
{
  Serial.print("Bus voltage:   ");
  Serial.print(ina.readBusVoltage(), 5);
  Serial.println(" V");

  Serial.print("Bus power:     ");
  Serial.print(ina.readBusPower(), 5);
  Serial.println(" W");


  Serial.print("Shunt voltage: ");
  Serial.print(ina.readShuntVoltage(), 5);
  Serial.println(" V");

  Serial.print("Shunt current: ");
  Serial.print(ina.readShuntCurrent(), 5);
  Serial.println(" A");

  Serial.println("");
  delay(1000);
}

With vbus unconnected i have readings but of course the voltage is zero (some milli volts actually). When i connect the vbus to in+ the SW stops after the ina.begin() command.
The strange things just started, when i switch off the power supply (the arduino have power from USB) then i have normal readings (the voltage fades out). If i connect vbus to 5V that comes from arduino, again i have normal readings but if i connected to any other voltage of the PS it stops.

What i found so far is that the program stops inside the “configure” function of the INA226.cpp GitHub - jarzebski/Arduino-INA226: INA226 Bi-directional Current/Power Monitor Arduino Librar
So i try to comment the line
“ina.configure(INA226_AVERAGES_1, INA226_BUS_CONV_TIME_1100US, INA226_SHUNT_CONV_TIME_1100US, INA226_MODE_SHUNT_BUS_CONT);”
to see what will happens and all of the sudden it start working with correct readings.

Ok now its working but i am still not understanding why and what will be the consequences of this.
Any help?

Thanks

  ina.configure(INA226_AVERAGES_1, INA226_BUS_CONV_TIME_1100US, INA226_SHUNT_CONV_TIME_1100US, INA226_MODE_SHUNT_BUS_CONT);

That line configures the same values as the power on default value of the device is. I see no reason why this line should pose problems on the hardware side. But the member variables vBusMax and vShuntMax are not set without this call (which is an error in library design in my view). So without calling this method I would expect wrong max values to be returned.

Are you using the chip directly? If you use a breakout board please post a link to it's schematics!