Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reducing excessive I2C timeout #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
maidnl wants to merge 3 commits into arduino:main
base: main
Choose a base branch
Loading
from maidnl:i2c_empty_bus_timeout

Conversation

Copy link
Contributor

@maidnl maidnl commented Sep 23, 2025

This PR takes care of issue #492 .
There was a default timeout of 1000 ms in I2C communication.
Timeout has been reduced to 1ms.
However (although this is not a standard Wire function) a setTimeout() function has been added to Wire class so that users can tune the value.


void setBusStatus(WireStatus_t);
/* set timeout in ms for I2C communication */
void setTimeout(unsigned int t);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@per1234 per1234 added the topic: code Related to content of the project itself label Sep 23, 2025
Copy link
Contributor Author

maidnl commented Sep 24, 2025

@per1234 I renamed the function according to the request, however please note that in the current implementation of Wire (at least in Core-Renesas) the Wire class is derived from HardwareI2C class, that is derived from Stream. And Stream has already setTimeout function.
void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
In my opinion it is better to use setTimeout name which is in line with the current class derivation scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@per1234 per1234 per1234 requested changes

@pennam pennam Awaiting requested review from pennam

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
topic: code Related to content of the project itself
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

I2C scan takes extremely long (~126 seconds) with Wire.endTransmission() on empty bus
2 participants

AltStyle によって変換されたページ (->オリジナル) /