Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing issues with a SSD1306 OLED #15

Open
Karl255 opened this issue Feb 21, 2023 · 3 comments
Open

Timing issues with a SSD1306 OLED #15

Karl255 opened this issue Feb 21, 2023 · 3 comments

Comments

@Karl255
Copy link

Karl255 commented Feb 21, 2023

I've been having some issues with this library when using it with an SSD1306 OLED screen where the communication would completely break, usually only in the first second or two since power up. Although I managed to fix that by editing the delay times in TinyI2CMaster.cpp (lines 24 and 25):

#define DELAY_T2TWI (_delay_us(1.3))   // >1.3us
#define DELAY_T4TWI (_delay_us(0.6))   // >0.6us

This works because the _delay_us() function takes a double and converts it to a cycle-accurate delay. The floating point math gets optimized away by the compiler.

After changing those lines everything worked flawlessly. I guess the SSD1306 is sensitive to low communication speeds. I didn't try this for low speed mode.

@technoblogy
Copy link
Owner

Thanks - I'll update it after checking it a bit. What platform were you using it on, and what processor clock rate?

@Karl255
Copy link
Author

Karl255 commented Feb 21, 2023

I used it on an ATtiny45 at 8 MHz.

@technoblogy
Copy link
Owner

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants