Skip to main content
Tharaga B
Visitor II
July 14, 2017
Question

How to calculate I2C SCL Speed

  • July 14, 2017
  • 2 replies
  • 906 views
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
    This topic has been closed for replies.

    2 replies

    Nesrine M_O
    Associate
    July 14, 2017
    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-

    waclawek.jan
    Super User
    July 17, 2017
    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