Using an Atmega168P - programmed by means of avrdude with the .hex file generated by Arduino IDE.
The following code sets the 8 MHz Atmega's TWI interface to just 15.625 kHz:
Wire.begin(); // Initiate the Wire library
Wire.setClock(100* 1000);
delay(10);
While this one doubles it to 31.25 kHz:
Wire.begin(); // Initiate the Wire library
TWBR = (F_CPU/(100*1000) - 16)/2;
TWSR &= 0b11111100;
delay(10);
Looking to get 100 kHz clock. What am I missing ?