I'm trying to port a code from ATMega328P to ATMega4808 and have an issue with I2C.
This code compiles under "Pro or Pro Mini"
#include <Wire.h> //I2C for display
void setup() {
Serial.begin(9600);
Serial.println(F("Hi"));
Wire.begin();
Wire.setWireTimeout(3000,true); // agaist getting stuck in I2C transmission to the display.
}
void loop() {
// put your main code here, to run repeatedly:
}
But under "Nano Every" I get this error code:
....\sketch_apr21a.ino:7:8: error: 'class TwoWire' has no member named 'setWireTimeout'; did you mean 'setTimeout'?
Wire.setWireTimeout(3000,true); // agaist getting stuck in I2C transmission to the display.
^~~~~~~~~~~~~~
setTimeout
exit status 1
Compilation error: 'class TwoWire' has no member named 'setWireTimeout'; did you mean 'setTimeout'?
I've tried and the line Wire.setTimeout(3000,true); does not work.
My full code uses I2C to run an OLED display. I had situations where the program just freeze when updating the display. adding this line allwed the code to continue.
Which command should I use for this under the 4808?
I use it in my car, the OLED is ~1.5m from the arduino.
Near the display I have two 10K pull up resistors for the SDA & SDK.
I had one display with no issues for a very long time. Lately I had to make a new OLED hardware, and with it I had a lot of freezers of the arduino.
Once I added the setWireTimeout I no longer have these freeze. I did not try to make new hardware for the display.
I use U8g2lib.h to run the display. My code does not set the I2C speed.
Now I wish to update the processor and wish that the code will have the timeout against these kind of freeze.
Not sure that I fully understand the links you sent. Was the wire library of the 4808 fixed so it cannot freeze or is it still an open issue?
I will try stronger pullup with the new processor.
I’m still waiting for the new board... So have no idea about the core. Do you have any recommendations?
I also found that the volume.h (Volume - Arduino Reference) does not work with the 4808. I still have not found a replacement.