I2C Wire.requestFrom() takes way to long on error #5972
Labels
Area: Peripherals API
Relates to peripheral's APIs.
Resolution: Duplicate
Issue is a duplicate of another issue
This is probably related to #5875
I'm using
Wire.requestFrom(address, 1);
also to scan the I2C bus. If it returns 1, a device is present, otherwise not. For some reason, the current version (both the official 2.0.1 release as well as the latest master including the fix from #5910) take very long in case of an error. Consider this example program (slightly modified from the default WireScan example):With the default implementation (using the two commented lines above) the scan is fast and one loop takes around 2 seconds. The above code, however, takes about 1 second for each address it scans (except for the addresses where a device is present). The timeout for the I2C bus is set to the default of 50ms.
Expected Behavior
Wire.readFrom(address, 1);
takes 50ms in case there's no device at the given address.Actual Behavior
It takes about 1 second.
Hardware:
Board: ESP32 Dev Module
Core Installation version: Tested 2.0.1 and 399f4ec. The problem did not occur with 1.0.6
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 10
The text was updated successfully, but these errors were encountered: