It seems to be solved!
As stated above, the change I made is to use the i2c_t3.h library instead of Wire.h and added Wire.setDefaultTimeout(100000); in setup(). A few days ago the uC ran for almost 48 hours and no lock-up/freeze! =) Don't think I have been able to that before. Haven't tried the if(Wire.getError()) error checking function yet, but will give it a try when I have the possibility. Would be nice to have an understanding of if, and how many times, i2c-communication fails.
@Headroom: Yes, I get your point. The situation is that it's not the end of the world if I loose one or two i2c transmits in an hour. Its compass and wind data that are sent several times per second and then averaged across hundred samples.
My setup is an sailboat autopilot with i2c-master Teensy 3.2 connected to i2c-slave attiny85 and i2c-slave LSM303 compass. The attiny is connected over a phone cable that is over 15 meter long and in a pretty bad condition. Impressed that it all works so well, especially with the new library. =)
Thanks a lot for all your input and help!
As stated above, the change I made is to use the i2c_t3.h library instead of Wire.h and added Wire.setDefaultTimeout(100000); in setup(). A few days ago the uC ran for almost 48 hours and no lock-up/freeze! =) Don't think I have been able to that before. Haven't tried the if(Wire.getError()) error checking function yet, but will give it a try when I have the possibility. Would be nice to have an understanding of if, and how many times, i2c-communication fails.
@Headroom: Yes, I get your point. The situation is that it's not the end of the world if I loose one or two i2c transmits in an hour. Its compass and wind data that are sent several times per second and then averaged across hundred samples.
My setup is an sailboat autopilot with i2c-master Teensy 3.2 connected to i2c-slave attiny85 and i2c-slave LSM303 compass. The attiny is connected over a phone cable that is over 15 meter long and in a pretty bad condition. Impressed that it all works so well, especially with the new library. =)
Thanks a lot for all your input and help!
Last edited: