Skip to content
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

ina238: retry if read fails #24163

Merged
merged 6 commits into from
Jan 22, 2025
Merged

Conversation

AlexKlimaj
Copy link
Member

@AlexKlimaj AlexKlimaj commented Jan 2, 2025

Noticing some occasional dropouts of the data with the ARK 12s power modules. Same thing I found on the INA226 a couple of years ago. A single bad I2C read would cause the driver to publish 0's and not connected.

#19423

Needs to be tested on hardware.

Current behavior
image

@AlexKlimaj AlexKlimaj requested a review from dagar January 2, 2025 03:02
@AlexKlimaj AlexKlimaj force-pushed the pr-ina238-dont-publish-0 branch 2 times, most recently from 8da3c6d to c90e87e Compare January 6, 2025 22:52

if (ret == PX4_OK) {
data = swap16(received_bytes);
for (size_t i = 0; i < 6; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not use the actual _retries mechanism in I2C?

if ((_retries > 0) && (retry_count < _retries)) {
#if defined(CONFIG_I2C_RESET)
DEVICE_DEBUG("I2C bus: %d, Addr: %X, I2C_RESET %d/%d",
get_device_bus(), get_device_address(), retry_count + 1, _retries);
I2C_RESET(_dev);
#endif // CONFIG_I2C_RESET
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated and pushed.

@AlexKlimaj AlexKlimaj force-pushed the pr-ina238-dont-publish-0 branch from c90e87e to 4a81e65 Compare January 22, 2025 16:59
@dagar dagar enabled auto-merge (squash) January 22, 2025 18:36
@dagar dagar disabled auto-merge January 22, 2025 20:31
@dagar dagar merged commit 07e7c64 into PX4:main Jan 22, 2025
56 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants