No Wire.setWireTimeout on nano every

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?

.setWireTimeout is not implemented in either the megaavr or the MegaCoreX packages.

https://github.com/arduino/ArduinoCore-megaavr/issues/83

There is information in the MegaCoreX link about how to modify the library used in DXCore or MegaTinyCore to work with a 4808.

I had situations where the program just freeze when updating the display.

What have you done to correct the root cause of the issue? What pull ups are you using? What bus speed are you running?

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?

Try making them stronger. 4.7K or 2.2K.

Was the wire library of the 4808 fixed so it cannot freeze or is it still an open issue?

I do not think so. What core are you using for the 4808?

I do think it may be possible to use the Wire Library from the megaTinyCore with the 4808.

https://github.com/MCUdude/MegaCoreX/issues/134#issuecomment-1683914666

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.

Is it an official Nano Every? That board has a 4809 processor. You can use either MegaCoreX or the megaavr core with it.

There is a "Thinary Nano" with a 4808.

Did you build a custom board with a 4808 processor?

Any board with a 4808 will require you to use MegaCoreX.

I also found that the volume.h (Volume - Arduino Reference ) does not work with the 4808

Yes, that library is written with hardware register instructions which are not valid for the 4808/4809 processor.

It is a custom board with 4808. I'm watting for it come from production.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.