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

Not working with 128X32 .96" Display #11

Open
bbarenz opened this issue Dec 7, 2023 · 3 comments
Open

Not working with 128X32 .96" Display #11

bbarenz opened this issue Dec 7, 2023 · 3 comments

Comments

@bbarenz
Copy link

bbarenz commented Dec 7, 2023

I'm attempting to use your library with the 128X32 .91" display. I have tested it by loading the Adafruit sketch in Arduino and it works as expected. Moving to native C in Atmel Studio with this library, the output sometimes resembles text but is too small and the top is cut off. Any thoughts on what to check?
Setup:
#define SSD1306_SET_MUX_RATIO 0x1F
#define SSD1306_COM_PIN_CONF 0x02
#define END_PAGE_ADDR 3

@bbarenz
Copy link
Author

bbarenz commented Dec 8, 2023

I made some progress. I can get your library to work if I first flash the Adafruit firmware. It appears something is not getting set and seems to persist after the display is powered off (I didn't think the SSD1306 had non volatile memory so maybe something else is happening?) For example, if I set SSD1306_SET_MUX_RATIO = 0xA8 it will garble the screen but even after setting it back to 0x1F it will stay garbled even after a power cycle. If I flash the Adafruit firmware then go back to your firmware it works fine.

@Matiasus
Copy link
Owner

Matiasus commented Dec 11, 2023 via email

@Matiasus
Copy link
Owner

Hi bbarenz,
I tested library yesterday with defined settings for 128x32 / 0.91" oled (SSD1306_SET_MUX_RATIO 0x1F, SSD1306_COM_PIN_CONF 0x02, END_PAGE_ADDR 3) but it worked correctly. I tested it with raw atmega328p with high fuse set to 'DE' and low fuse set to 'FF'.
But you can try this list of commands & arguments settings according to adafruit:

// @const List of init commands with arguments by Adafruit
// @link https://github.com/adafruit/Adafruit_SSD1306
const uint8_t INIT_SSD1306[] PROGMEM = {
  17,                                                             // number of initializers
  0, SSD1306_DISPLAY_OFF,                                         // 0xAE / Set Display OFF
  1, SSD1306_SET_OSC_FREQ, 0x80,                                  // 0xD5 / 0x80 => D=1; DCLK = Fosc / D <=> DCLK = Fosc
  1, SSD1306_SET_MUX_RATIO, 0x1F,                                 // 0xA8 / 0x3F (64MUX) for 128 x 64 version
                                                                  //      / 0x1F (32MUX) for 128 x 32 version
  1, SSD1306_DISPLAY_OFFSET, 0x00,                                // 0xD3
  0, SSD1306_SET_START_LINE,                                      // 0x40
  1, SSD1306_SET_CHAR_REG, 0x14,                                  // 0x8D / Enable charge pump during display on
  1, SSD1306_MEMORY_ADDR_MODE, 0x00,                              // 0x20 / Set Memory Addressing Mode
                                                                  // 0x00 / Horizontal Addressing Mode
                                                                  // 0x01 / Vertical Addressing Mode
                                                                  // 0x02 /  Page Addressing Mode (RESET)
  0, SSD1306_SEG_REMAP_OP,                                        // 0xA0 / remap 0xA1
  0, SSD1306_COM_SCAN_DIR_OP,                                     // 0xC8
  1, SSD1306_COM_PIN_CONF, 0x02,                                  // 0xDA / 0x12 - Disable COM Left/Right remap, Alternative COM pin configuration
                                                                  //        0x12 - for 128 x 64 version
                                                                  //        0x02 - for 128 x 32 version
  1, SSD1306_SET_CONTRAST, 0x8F,                                  // 0x81 / 0x8F - reset value (max 0xFF)
  1, SSD1306_SET_PRECHARGE, 0xc2,                                 // 0xD9 / higher value less blinking
                                                                  //        0xC2, 1st phase = 2 DCLK,  2nd phase = 13 DCLK
  1, SSD1306_VCOM_DESELECT, 0x40,                                 // 0xDB / Set V COMH Deselect, reset value 0x22 = 0,77xUcc
  0, SSD1306_DIS_ENT_DISP_ON,                                     // 0xA4
  0, SSD1306_DIS_NORMAL,                                          // 0xA6
  0, SSD1306_DEACT_SCROLL,                                        // 0x2E
  0, SSD1306_DISPLAY_ON                                           // 0xAF / Set Display ON  
};

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