SSD1306 garbled bitmap & clearDisplay resets

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
gary4132
 
Posts: 1
Joined: Tue Mar 12, 2013 4:38 pm

SSD1306 garbled bitmap & clearDisplay resets

Post by gary4132 »

I recently purchased a Monochrome 1.3" 128x64 OLED graphic display, item 938 from adafruit and I'm having a couple issues that I've been unable to resolve.

The first one I came across is that whenever I use the display.clearDisplay(); command, even in the setup portion of the program, the program seems to reset. It proceeds no further and jumps back to the start. In the example below, I never get the "Display cleared" message. This is plugged into an Arduino Nano with an Atmega168, by the way.

// 128x64 oled test
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//#include <RTClib.h>

//! OLED display wired per tutorial.
#define OLED_DC 11
#define OLED_CS 12
#define OLED_CLK 10
#define OLED_MOSI 9
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

//! Initialize the sketch.
void setup() {
// Initialize the serial connection for debugging.
Serial.begin(9600);
Serial.println(F("Serial initialized"));

// Initialize the OLED.
display.begin(SSD1306_SWITCHCAPVCC);
Serial.println(F("OLED initialized"));
Serial.println(SSD1306_LCDHEIGHT);

// Clear the display and draw hour/minute clock rectangles.
display.display();
delay(2000);
display.clearDisplay();
Serial.println(F("Display cleared"));
}

//! Main execution loop.
void loop() {
}

Which is why I inserted the display.display(); line, to make sure the display was actually working at all. But problem two is that the splashscreen comes out garbled. I checked all my wiring and it all looks fine. Can anybody clue me in on what might be happening here?
ssd1306.JPG
ssd1306.JPG (165.23 KiB) Viewed 1362 times
Thanks

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: SSD1306 garbled bitmap & clearDisplay resets

Post by adafruit_support_bill »

Double-check all the connections. Breadboard connections tend to be flakey. If the jumper isn't firmly gripped by the spring connectors, try and adjacent hole.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SSD1306 garbled bitmap & clearDisplay resets

Post by adafruit_support_rick »

Actually, the problem is the ATmega168 on the Nano. The 168 only has 1K of SRAM, and with the 128x64 display, the SSD1306 library requires 1K of SRAM for the display buffer alone.

The garbled image you see is essentially the entire contents of SRAM. Calling clearDisplay () wipes out the entire contents of SRAM.

User avatar
buton
 
Posts: 55
Joined: Fri May 11, 2012 8:06 am

Re: SSD1306 garbled bitmap & clearDisplay resets

Post by buton »

indeed, the adafruit library is great but eats lots of RAM.

my solution to that is getting a bigger microconcontroller like the mega 2560... and then no problems at all. it cost money but is worth it.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”