Finaly i was defeted and need a bit of help.
Im curently making a motorcycle cruise control and everything went fine antil i decided to implement oled display so i can change the pid parameters without reprograming arduino.
Everything works fine untill i start the engine. Then it takes about three secends to freeze the arduino.
Without the dispaly conected cruise control works for hours and controls the speed.
First i tryed diferent wire librarysi with no succes, tryed to modify them with, also no succes.
I used UNO but when i encounterd problems with oled i changed to mega 2560 because i thougth it might me RAM related. On UNO IDE indecated 30% ram usage, no impruvment.
So today made simple sketch just for oled display and tested it in my bike and Arduino crashed anyway so it have to be related to i2c or ssd1306 library.
Mabey some of you already encourted such a prolem.
I could live with errors on display but arduino freezing during operatin is not an option.
Not particually had probelsm with the SSD1306 displays and librairies.
Although that there is a problem highlights the issues around designing safety critical systems, such as a cruise control, using unsupported public software libraries.
Today i propbably have found a solution but so far im unable to implement it.
Turs out adrafruit ssd1306 is writen to use oem wire.h from arduino IDE wich do not have any timeouts.
Iven if u dont attach the wire.h it does it for you. I tryed to modify it to use SoftwareI2C master od I2Cdev but it is beyond my skill set.
Thing i got i to work replacing oem librarys od IDE with SBWire.
When there is interferance there is garbage but arduino doesnt freeze.
Will test it on my bike soon.