Problem with U8g2 graphics

Using a small 128x64 OLED, this graphics code works perfectly well with a Nano, but produces junk results with a NanoEvery. Can anyone explain why??

type or paste code here
// IZOKEE_graphics.ino, D. Brooks, June 2023
#include <U8g2lib.h>
#include <Wire.h>
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,SCL,SDA,U8X8_PIN_NONE);
void setup() {
  u8g2.begin();
}
void loop() {
  u8g2.clearBuffer();                   // Clear display.
  u8g2.setFont(u8g2_font_ncenB08_tr);   // choose a suitable font
  u8g2.setFontDirection(1); // Left-to-right, bottom-to-top "portrait" orientation.
  // drawStr(Y,X,"text");
  u8g2.drawStr(110,0,"Hello!"); 
  u8g2.drawStr(95,0,"0123456789") ;  
  u8g2.setFont(u8g2_font_5x7_mf);
  u8g2.drawStr(80,0,"small text");
  u8g2.drawStr(70,0,"0123456789ABC");
  u8g2.drawCircle(50,15,10);
  u8g2.drawFilledEllipse(50,43,10,15);
  u8g2.drawRFrame(15,20,20,30,4);
  u8g2.sendBuffer(); // Transfer buffer to screen.
  delay(1000);  
}

Are you connected the OLED to the same pins on NANO and on Every?
It would be better, you could present the connection diagrams for both cases.

Yes, the pin connections are the same because the Nano Every is supposed to be pin-identical with the Nano. I can switch back and forth between Nano and Nano Every just by changing them on the breadboard. There is nothing discretionary about the pin connections, as the OLED has an I2C interface. (The OLED will run from 3.3V or 5V power, but that doesn't make any difference in the performance.)

Why do you use a software I2C mode and then use the SDA and SCL pin of the hardware I2C bus ?

The Wokwi simulator does not simulate the Nano Every. It works on a classic Arduino Nano, but you knew that already :grimacing:

I wanted to try something fancy, so I tested your code on a ESP32-C3: Problem with U8g2 graphics #2 - Wokwi ESP32, STM32, Arduino Simulator
The hardware I2C bus works and the software I2C bus does not work. I don't know if it means anything, but at least there is a difference somehow.

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