37.4.2.2 Host Clock Timing
The Serial Clock (SCL) signal is generated by module hardware via the I2C Clock Selection (I2CxCLK) Register, the I2C Baud Rate Prescaler (I2CxBAUD) Register, and the Fast Mode Enable (FME) bit.
The figure below illustrates the SCL clock generation.
I2CxCLK contains several clock source selections. The clock source selections typically include variants of the system clock and timer resources.
I2CxBAUD is used to determine the prescaler (clock divider) for the I2CxCLK source.
The FME bit acts as a secondary divider to the prescaled clock source.
When FME is clear (FME = 0
), one SCL period
(TSCL) is equal to five clock periods of the prescaled I2CxCLK
source. In other words, the prescaled I2CxCLK source is divided by five. For example, if
the HFINTOSC (set to 4 MHz) clock source is selected, I2CxBAUD is loaded with a value of
‘7
’, and the FME bit is clear, the actual SCL frequency is 100 kHz
(see the equation below).
When FME is clear, host hardware uses the first prescaled I2CxCLK source period to drive SCL low (see Figure 37-30). During the second period, hardware verifies that SCL is in fact low. During the third period, hardware releases SCL, allowing it to float high. Host hardware then uses the fourth and fifth periods to sample SCL to verify that SCL is high. If a client is holding SCL low (clock stretch) during the fourth and/or fifth period, host hardware samples each successive prescaled I2CxCLK period until a high level is detected on SCL. Once the high level is detected, host hardware samples SCL during the next two I2CxCLK periods to verify that SCL is high.
When FME is set (FME = 1
), one SCL period
(TSCL) is equal to four clock periods of the prescaled I2CxCLK
source. In other words, the prescaled I2CxCLK source is divided by four. Using the
example from above, if the HFINTOSC (4 MHz) clock source is selected, I2CxBAUD is loaded
with a value of ‘7
’, and the FME bit is set, the actual SCL frequency
is 125 kHz (see the equation below).
When FME is set, host hardware uses the first prescaled I2CxCLK source period to drive SCL low (see Figure 37-31). During the second prescaled period, hardware verifies that SCL is in fact low. During the third period, hardware releases SCL, allowing it to float high. Host hardware then uses the fourth period to sample SCL to verify that SCL is high. If a client is holding SCL low (clock stretch) during the fourth period, host hardware samples each successive prescaled I2CxCLK period until a high level is detected on SCL. Once the high level is detected, host hardware samples SCL during the next period to verify that SCL is high.