esp32: Slow I2C on S2 after bus failures.
After a certain number (usually <10) of failures (e.g. ENODEV due to non-existent address), the clock frequency seems to drop to 1/16 of the requested value.
Unfortunately, this is exactly how i2c.scan() is implemented, so the behavior I see is that everything is fine if I don't do a scan first.
i2c_get_period continues to report the original frequency. If add a call i2c_param_config to re-set the frequency, then all is fine.
Can replicate on IDF 4.4 and 5.0, and only on S2.
esp8266: the i2c freq argument is ignored
The freq argument to machine.I2C doesn't seem to have any effect. No matter what value I pass to it, the resulting signal on the CLK line looks exactly the same on the osciloscope. Looking at the source code at https://github.com/micropython/micropython/blob/master/esp8266/modpybi2c.c#L84-L130 I can see that the "freq" variable is never used anywhere.
I tried to lower the frequency, because for some reason I'm getting occasional OSError when trying to write to the I2C bus, and, what's worse, those errors sometimes leave the device I'm communicating with in a stuck state.