Clock Generation (Standard Mode, Fast Mode, and Fast Mode Plus)

In I2C, Sm, Fm, and Fm+ modes, the Host clock (SCL) frequency is determined as follows.

The low (TLOW) and high (THIGH) times are determined by the Baud Rate (BAUD) register, while the rise (TRISE) and fall (TFALL) times are determined by the bus topology. Because of the wired AND logic of the bus, TFALL is considered part of TLOW. Likewise, TRISE remains in a transitional state between TLOW and THIGH until a high state is detected.

Figure 31-7. SCL Timing
The following parameters are timed using the SCL low time period (TLOW). This value is derived from the Host Baud Rate Low bit group in the Baud Rate register (BAUD.BAUDLOW) or. when BAUD.BAUDLOW = 0, from the Host Baud Rate bit group in the Baud Rate register (BAUD.BAUD).
  • TLOW—Low period of the SCL clock
  • TSU;STO —Setup time for the Stop condition
  • TBUF—Bus free time between Stop and Start conditions
  • THD;STA—Hold time for (repeated) Start condition
  • TSU;STA—Setup time for repeated Start condition
  • THIGH is sdtimed using the SCL high time count from BAUD.BAUD
  • TRISE is determined by the bus impedance. For internal pull-ups, refer to the Electrical Characteristics chapter.
  • TFALL is determined by the open-drain current limit and bus impedance and can typically be regarded as zero. Refer to the Electrical Characteristics chapter for details.

The SCL frequency is given by:

fSCL=1TLOW+THIGH+TRISE

When BAUD.BAUDLOW is zero, the BAUD.BAUD value is used to time both the SCL high and SCL low durations. In this case, the following formula gives the SCL frequency:

fSCL=fGCLK10⁢+ 2BAUD+fGCLK⋅TRISE

When BAUD.BAUDLOW is non-zero, the following formula determines the SCL frequency:

fSCL=fGCLK10⁢+ BAUD+BAUDLOW+fGCLK⋅TRISE

The following formulas determine the SCL TLOW and THIGH times:

TLOW=BAUDLOW+5fGCLK

THIGH=BAUD+5fGCLK

Note: The I2Fm+ (Fast mode plus) requires a nominal high-to-low SCL ratio of 1:2, and BAUD must be configured accordingly. At a minimum, BAUD.BAUD and/or BAUD.BAUDLOW must be non-zero.

To configure the SCL clock, first increase the BAUDLOW value until the measured SCL low time meets the minimum requirement for the selected speed mode. Then increase the BAUD value until the desired SCL frequency is reached. When BAUDLOW is zero, adjust BAUD to satisfy both the minimum SCL low time and the desired SCL frequency. Because delays introduced by the bus driver can reduce the measured SCL low time, verify the SCL timing in the target application and allow sufficient margin.

The minimum time between an SDA transition and the SCL rising edge is six APB cycles when the DATA register is written in Smart mode. If a greater setup time is required because of long rise times, the time between the DATA write and interrupt flag clear must be controlled by software.
Note: When timing is controlled by the user, the Smart mode cannot be enabled.