Skip to content

twi_readFrom() does not proerly handle timeout #586

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

Closed
Ztirom45 opened this issue Dec 29, 2024 · 2 comments
Closed

twi_readFrom() does not proerly handle timeout #586

Ztirom45 opened this issue Dec 29, 2024 · 2 comments

Comments

@Ztirom45
Copy link

My program freezes randomly. After debugging I found out this:

gdb output:

Program received signal SIGINT, Interrupt.
0x00001ad8 in twi_readFrom (address=address@entry=104 'h', 
    data=0x8009d0 <TwoWire::rxBuffer> <incomplete sequence \302>, 
    length=length@entry=1 '\001', sendStop=sendStop@entry=1 '\001')
    at /home/moritz/.platformio/packages/framework-arduino-avr/libraries/Wire/src/utility/twi.c:219
219         if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) {
(gdb) print twi_timeout_us
$1 = 0
(gdb) print startMicros
$2 = 763126656

using:
Adafruit_ADXL345_U.h: Adafruit_MPU6050.getEvent()

I am not sure how the timeout handling should work, but I don't think that it should freeze.

@matthijskooijman
Copy link
Collaborator

Did you enable the timeout with setWireTimeout? https://reference.arduino.cc/reference/en/language/functions/communication/wire/setwiretimeout/

@Ztirom45
Copy link
Author

Thank you for your quick reply.
No, I think Adafruit_ADXL345_U and the underlying Adafruit BusIO don't use setWireTimeout. I will ask there.

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

No branches or pull requests

2 participants