DocID025202 Rev 7
770/1080
RM0365
Inter-integrated circuit (I2C) interface
834
28.4.4 I2C
initialization
Enabling and disabling the peripheral
The I2C peripheral clock must be configured and enabled in the clock controller (refer to
Section 9: Reset and clock control (RCC)
).
Then the I2C can be enabled by setting the PE bit in the I2C_CR1 register.
When the I2C is disabled (PE=0), the I
2
C performs a software reset. Refer to
Section 28.4.5: Software reset
for more details.
Noise filters
Before enabling the I2C peripheral by setting the PE bit in I2C_CR1 register, the user must
configure the noise filters, if needed. By default, an analog noise filter is present on the SDA
and SCL inputs. This analog filter is compliant with the I
2
C specification which requires the
suppression of spikes with a pulse width up to 50 ns in Fast-mode and Fast-mode Plus. The
user can disable this analog filter by setting the ANFOFF bit, and/or select a digital filter by
configuring the DNF[3:0] bit in the I2C_CR1 register.
When the digital filter is enabled, the level of the SCL or the SDA line is internally changed
only if it remains stable for more than DNF x I2CCLK periods. This allows to suppress
spikes with a programmable length of 1 to 15 I2CCLK periods.
Caution:
Changing the filter configuration is not allowed when the I2C is enabled.
Table 137. Comparison of analog vs. digital filters
Analog filter
Digital filter
Pulse width of
suppressed spikes
≥
50 ns
Programmable length from 1 to 15 I2C peripheral
clocks
Benefits
Available in Stop mode
– Programmable length: extra filtering capability
vs. standard requirements
– Stable length
Drawbacks
Variation vs. temperature,
voltage, process
Wakeup from Stop mode on address match is not
available when digital filter is enabled