cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate I2C SCL Speed

Tharaga B
Associate
Posted on July 14, 2017 at 06:27

I'm trying to get a 100 or 400 kHz rate on I2C3 SCL to interface with a Sparkfun IMU breakout board. I was wondering what value I should set 'TIMING' to in order to achieve this rate with an STM32L476RG Nucleo board. For reference, this is the 'TIMING' value I'm trying to calculate:

hi2c3.Instance = I2C3;

hi2c3.Init.Timing = 0x0020098E; // Thought this was 100 kHz based on other examples, but appearing as 600 Hz on my oscilloscope
2 REPLIES 2
Nesrine M_O
Lead II
Posted on July 14, 2017 at 12:56

Hi

t2balach

,

Please try to refer to

I2C timings paragraph and

Timing register (I2C_TIMINGR)

in your related reference manual.

-Nesrine-

Posted on July 17, 2017 at 12:34

Note, that unless clock stretching is disabled, the actual run-time timing is dependent also on the clock rise time, which may be longer then what's set up in the register if there is significant capacitive load and on the bus and the pullups' resistances are high. Slaves may also stretch clock, influencing the resulting timing.

JW