I2c.scan() screw up the bus

Hi, I have 2 I2C scan functions. One is a self-written one using Wire.h:

Serial.println ("I2C Scanning ...");
  byte count = 0;
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.print (" 7 bit address in Arduino)");
      Serial.print (" (0x");
      Serial.print (2*i, HEX);
      Serial.println (" 8 bit address on datasheet)");
      count++;
      delay (1);  
      } 
  } 
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");

This one can find the correct address under good condition.(no weird operations after powering on the slave)

The other scan function is the one in I2C.h, which has the timeout feature. Details here: I2C/I2C.cpp at master · rambo/I2C · GitHub
The problem with this one is: It always report a problem with the bus, could not complete the scan. But the truth is, all I2C functions (include the self-written scan)works well without running I2c.scan, and after you run I2c.scan() once, nothing works, following is the result of running self-scan;I2c.scan;self-scan

10:06:36.533 -> Serial and I2C setup ready
10:06:42.459 -> Command sent: I2C::scan
10:06:42.492 -> I2C scanner. Scanning ...
10:06:42.492 -> Found address: 46 (0x2E 7 bit address in Arduino) (0x5C 8 bit address on datasheet)
10:06:42.594 -> Found address: 47 (0x2F 7 bit address in Arduino) (0x5E 8 bit address on datasheet)
10:06:42.696 -> Found address: 64 (0x40 7 bit address in Arduino) (0x80 8 bit address on datasheet)
10:06:42.765 -> Done.
10:06:42.800 -> Found 3 device(s).
10:06:55.556 -> Command sent: I2C::sc_an
10:06:55.589 -> Scanning for devices...please wait
10:06:55.623 -> 
10:06:55.623 -> Found device at address -  0x0
10:06:55.725 -> There is a problem with the bus, could not complete scan
10:07:08.433 -> Command sent: I2C::scan
10:07:08.468 -> I2C scanner. Scanning ...  (program stuck here)

Anyone sees the reason? Thanks

And every time I re-power the slave and restart the Arduino program, the expected data which got stuck last time are dumped out

Anyone sees the reason?

Yes, if the scan detects a problem it calls the lockUp() method which simple blocks the I2C hardware.

The problem is that the scan method of that library does something which isn't allowed: it scans for invalid addresses (p.e. 0-7). Address 0 is something like the broadcast address and the other low addresses may have other special features. If one of the connected devices thinks it should react by pulling SCK low the scan runs into a timeout which then calls lockUp().

Without having more information about the bus you're testing with no additional comments are possible. My guess is that one of the connected devices reacts special if some invalid address is signaled.

pylon:
The problem is that the scan method of that library does something which isn’t allowed: it scans for invalid addresses (p.e. 0-7). Address 0 is something like the broadcast address and the other low addresses may have other special features. If one of the connected devices thinks it should react by pulling SCK low the scan runs into a timeout which then calls lockUp().

Thanks a lot. After I change the starting address to 8 in the .cpp file, it works well.