Maximum Speed for using I2C with SSD1306 Display?

Status
Not open for further replies.

Expensive Notes

Well-known member
The default value for I2Cspeed below is 400000. I would like to speed up the communication between the Teensy and the screen so display.display(); is faster. It defaults to 400000Hz. In my code using this setting it takes 28ms to update the display. I tried using 1000000 as below and got 12ms, which is a lot better.

Is there a maximum safe speed for wire2?

Code:
//--- Oled Screen ------------------------------------------------------------------- Oled Screen

#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     4 // Reset pin # 
#define SCREEN_ADDRESS 0x3C // Found using scanner
#define I2Cspeed 1000000


//Initialize OLED screen. Changed Wire to Wire2 for SCL2 and SDA2
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire2, OLED_RESET, I2Cspeed);
 
I tried a few different values if anyone is interested. Basically anything under 1MHz takes 28ms and anything over this takes 12ms to display the screen. I guess I answered my own question. However, is this detrimental to the Teensy?
 
Status
Not open for further replies.
Back
Top