what is the proper way to reset I2C after an error? Is there a Wire.reset()?

mchahn
Posts: 17
Joined: Fri Sep 18, 2020 6:31 am

what is the proper way to reset I2C after an error? Is there a Wire.reset()?

Postby mchahn » Sun Nov 14, 2021 6:17 pm

Way back in 2017 there was a post here about not being able to reset the I2C state after an error: viewtopic.php?f=14&t=3152. One of the replies said ...

"A reset method is now available in the Arduino master for the Wire library. You can use it as a part of recovery of the I2C under your own control.": viewtopic.php?p=14936#p14936
I am writing my app now that uses I2C. I want to handle errors properly but I have stared at the Wire code for some time and cannot find any reset. Using Wire.reset() doesn't compile.

What is the correct procedure I should use?

rodmcm
Posts: 65
Joined: Sat Sep 02, 2017 3:31 am

Re: what is the proper way to reset I2C after an error? Is there a Wire.reset()?

Postby rodmcm » Wed Nov 24, 2021 12:38 am

The latest Wire.h at https://www.arduino.cc/en/reference/wire only has limited commands
Usually a failure to read is handled by external programming such as "if Value>0 then ok else fault"
You can also detect with available() which returns the no of bytes that can be read

Who is online

Users browsing this forum: No registered users and 76 guests