user29599: 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 ?

user13432: 
Looking to get 100 kHz clock. What am I missing?

Calculations are int (16-bits) by default in AVR GCC. Try 100*1000L. Or even better:
#define F_TWI 100000L 

and use: 
TWBR = ((F_CPU/F_TWI)-16)/2;

or:
Wire.setClock(F_TWI);

Cheers!

29599: <p>Using an Atmega168P - programmed by means of <code>avrdude</code> with the <code>.hex</code> file generated by Arduino IDE.</p>

<p>The following code sets the 8 MHz Atmega's TWI interface to just 15.625 kHz:</p>

<pre><code>  Wire.begin(); // Initiate the Wire library
  Wire.setClock(100* 1000);
  delay(10);
</code></pre>

<p>While this one doubles it to 31.25 kHz:</p>

<pre><code>  Wire.begin(); // Initiate the Wire library
  TWBR = (F_CPU/(100*1000) - 16)/2;
  TWSR &amp;= 0b11111100;
  delay(10);
</code></pre>

<p>Looking to get 100 kHz clock. What am I missing ?</p>
 13432: <blockquote>
  <p>Looking to get 100 kHz clock. What am I missing?</p>
</blockquote>

<p>Calculations are int (16-bits) by default in AVR GCC. Try 100*1000L. Or even better:</p>

<pre><code>#define F_TWI 100000L 
</code></pre>

<p>and use: </p>

<pre><code>TWBR = ((F_CPU/F_TWI)-16)/2;
</code></pre>

<p>or:</p>

<pre><code>Wire.setClock(F_TWI);
</code></pre>

<p>Cheers!</p>
