i2c_filter_enable() function
Enable hardware filter on I2C bus Sometimes the I2C bus is disturbed by high frequency noise(about 20ns), or the rising edge of the SCL clock is very slow, these may cause the master state machine to break. Enable hardware filter can filter out high frequency interference and make the master more stable.
Arguments
i2c_num
I2C port number to filter
cyc_num
the APB cycles need to be filtered (0<= cyc_num <=7). When the period of a pulse is less than cyc_num * APB_cycle, the I2C controller will ignore this pulse.
Return value
- ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error
Notes
Enable filter will slow down the SCL clock.
i2c_filter_enable() calls 6 functions:
![]()
i2c_filter_enable()
i2c_filter_enable() reads 12 variables:
![]()
i2c_filter_enable()