[SOLVED] Using u8glib with East rising ER-OLEDM028/32 (SSD1322)

Hi Folks,
I've got some of those displays thinking that the u8glib which supports SSD1322 will work on this display. unfortunately after a few hours of effort I couldn't even get it to show anything, not even garbage.

has anyone have any experience (or any idea) on which construct I should use (I've tried u8g_dev_ssd1322_nhd31oled(GR/BW) and u8g_dev_uc1608_240x64_hw_spi). maybe another library that might work?
or how to modify existing u8glib (1.16) to work with it? unfortunately I'm not that strong in C, so I can't really reverse engineer anything..

Using Arduino Micro if that changes anything.

Thanks for all your help,
Uri


Update:
Solved thanks to Oliver
http://forum.arduino.cc/index.php?topic=255465.msg1807849#msg1807849
http://forum.arduino.cc/index.php?topic=255465.msg1808618#msg1808618

Hi Uri

Can you provide more detailed information?

  • Exact U8glib constructor
  • Which pins of display and Arduino board are connected
  • Optional picture of your setup.
  • How did you ensure, that the display is put into serial (SPI) mode?

Especially the last question might be the cause for your problem. I also did not see an information in the datasheet about how to switch to SPI mode (maybe i missed this). Is there a solder bridge, which defines parallel or serial mode? Maybe you can post a picture of the back side of the display.

Oliver

Hi Oliver, thanks for the quick response.

Constructor I've mostly focused on was u8g_dev_ssd1322_nhd31oled (i?ve tried both the BW and GR variants)

I can't show you the wiring as it is a mess right now (shift register and another ssd1306 screen that work - they are all part of the same project, but not activated in code).
Pin out is as follows.
Sck, mosi are hardware ISP (available on breadboard for micro)
Cs, ds pins 12 and 9
Reset I've tied high and also tried using pin 13.

I've also tried sw spi, using pins 7&8.

I've connected the screen for 4 wire SPI as illustrated in the Display interfacing diagram
http://www.buy-display.com/download/interfacing/ER-OLEDM028-1_Interfacing.pdf
I don't know how to verify that the display indeed went to that mode. Also note, interfacing diagram shows SSD1326 chip, but data sheet specify a SSD1322 controller. Not sure what that means. (Typo or wrong document) - I'm sending them an email about it now.

Hi

On the interface diagram you see, that BS1 is set differently for parallel and serial mode. If the BS1 line is not available on the header, then usually there is a solder bridge for that. If you post a picture of the back side of the display, we could look have a look together.

For the constructor, it would be good to see, which parameters are used. Also: To switch between HW SPI and SW SPI, usually no rewiring is required.

But actually, i think, the problem is that your display is set to parallel mode and must be forced to serial mode first.

Oliver

I just looked at the datasheet again.
You must move the zero Ohm resistor from R19 to R18. So you need to unsolder the resistor from position R19 and resolder it on position R18.

Oliver

OK, think I've got it.
you mean the

R19 and R23 ON
R18 and R20 NC

remark?
I guess it's a jumper of some sort, I'll have a look at it when I'll get back home.

but while at it, is there any advantage for 4 line SPI over 3 wire? I would prefer to simply my connections (as the screens are on other assemblies would putting "U8G_PIN_NONE" on the DC pin and wiring the screen for 3 pin SPI do the trick?
or should I just stick with 4 pin that is transparently supported?

Thank you for all your help!
Uri

uri_ba:
you mean the

R19 and R23 ON

R18 and R20 NC



remark?

yes

uri_ba:
but while at it, is there any advantage for 4 line SPI over 3 wire? I would prefer to simply my connections (as the screens are on other assemblies would putting "U8G_PIN_NONE" on the DC pin and wiring the screen for 3 pin SPI do the trick?
or should I just stick with 4 pin that is transparently supported?

3-wire SPI requires that the information on the DC pin is transfered along with the 8 databits. That means SPI has to transfer 9 bits per block. First, this is not implemented in U8glib at the moment. Second problem, this is not supported by the ATMega hardware, so there is no easy HW SPI support on AVR systems. More modern architectures (like SAM?) allow 9 bit HW SPI.

All in all, currently this is not supported with U8glib.

Oliver

vielen Dank Oliver!

I'll post pictures of the proper jumpers/resistors (before and after) once I get the process done.

It WORKS!!
Thanks to Oliver's keen eye problem was fixed.

I've de-soldered the resistor and moved it to it's proper location and display works!

Arduino Micro
ER-OLEDM028 and ER-OLEDM032
HW SPI

constructor is u8g_dev_ssd1322_nhd31oled_gr (the 2X version)
U8GLIB_NHD31OLED_2X_GR

HTH, I've updated the title to solved.

Ausgezeichnet...
Good to see that it works.

Oliver

Hi

Is it possible to get this display to work with u8glib in parallel mode?
It seems the U8GLIB_NHD31OLED_2X_GR class dosn't has a parallel mode.

thanks

Does U8GLIB_NHD31OLED_GR work with parallel mode?

Constructor is:

U8GLIB_NHD31OLED_GR(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
        uint8_t cs, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)

Oliver

Hi

How to call the constructor the right way?

If I use this constructor call:
U8GLIB_NHD31OLED_GR u8g(22, 23, 24, 25, 26, 27, 28, 29, 33, 35, 36);

I get:

U8glib_PARAL_Test:55: error: no matching function for call to 'U8GLIB_NHD31OLED_GR::U8GLIB_NHD31OLED_GR(int, int, int, int, int, int, int, int, int, int, int)'
/Users/Documents/Arduino/libraries/U8glib/U8glib.h:603: note: candidates are: U8GLIB_NHD31OLED_GR::U8GLIB_NHD31OLED_GR(uint8_t, uint8_t, uint8_t)
/Users/Documents/Arduino/libraries/U8glib/U8glib.h:600: note:                 U8GLIB_NHD31OLED_GR::U8GLIB_NHD31OLED_GR(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
/Users/Documents/Arduino/libraries/U8glib/U8glib.h:598: note:                 U8GLIB_NHD31OLED_GR::U8GLIB_NHD31OLED_GR(const U8GLIB_NHD31OLED_GR&)

What is your u8glib version?
I have attached a snapshot of the current repository.

Oliver

u8glib_arduino_v1.17pre2.zip (1.06 MB)

Hi

Thank you very much!
It works now but it needs a little fine tuning 8)

How does your sketch look like at the moment?

Oliver

Hi

I just tried it with the Display Test code from the examples folder.
I didn't implement g8ulib it in my code befor I know if its working properly.
So my main problem is how to set the pins right because the constructor is gifing
11 pins -> 8 Data and cs, da.

To get the Display working properly i need to manage:

CS -> Chip Select
DC -> di -> Data/Command Control
WR -> Read/Write Select or Write
RD -> Read/Write Enable or Read
Reset -> reset -> Reset / init

My updated example code looks like this:

#include "U8glib.h"

// setup u8g object, please remove comment from one of the following constructor calls
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device


U8GLIB_NHD31OLED_GR u8g(22, 23, 24, 25, 26, 27, 28, 29, 33, 35, 36); // s8bit Com: D0..D7: 22,23,24,25,26,27,28,29 cs=33 dc=35 wr=36 rd=37 res=34



#define KEY_NONE 0 // Auto
#define KEY_PREV 1 // Left
#define KEY_NEXT 2 // Right
#define KEY_SELECT 3 // Select
#define KEY_BACK 4 // Menu

// DOGS102 shield configuration values
//uint8_t uiKeyPrev = 2;
//uint8_t uiKeyNext = 4;
//uint8_t uiKeySelect = 5;
//uint8_t uiKeyBack = 3;

// DOGM128-Shield	 configuration values
// DOGXL60-Shield configuration values
uint8_t uiKeyPrev = 47;
uint8_t uiKeyNext = 46;
uint8_t uiKeySelect = 45;
uint8_t uiKeyBack = 48;

uint8_t uiHolderGND = 30;

uint8_t uiKeyCodeFirst = KEY_NONE;
uint8_t uiKeyCodeSecond = KEY_NONE;
uint8_t uiKeyCode = KEY_NONE;


void uiSetup(void) {
  // configure input keys 
  
  pinMode(uiKeyPrev, INPUT);           // set pin to input
  digitalWrite(uiKeyPrev, HIGH);       // turn on pullup resistors
  pinMode(uiKeyNext, INPUT);           // set pin to input
  digitalWrite(uiKeyNext, HIGH);       // turn on pullup resistors
  pinMode(uiKeySelect, INPUT);           // set pin to input
  digitalWrite(uiKeySelect, HIGH);       // turn on pullup resistors
  pinMode(uiKeyBack, INPUT);           // set pin to input
  digitalWrite(uiKeyBack, HIGH);       // turn on pullup resistors
  pinMode(uiHolderGND, OUTPUT);      // set Holder Analog GND PIN
  digitalWrite(uiHolderGND, LOW);    // turn off Analog Holder GND
}

void uiStep(void) {
  uiKeyCodeSecond = uiKeyCodeFirst;
  if ( digitalRead(uiKeyPrev) == LOW )
    uiKeyCodeFirst = KEY_PREV;
  else if ( digitalRead(uiKeyNext) == LOW )
    uiKeyCodeFirst = KEY_NEXT;
  else if ( digitalRead(uiKeySelect) == LOW )
    uiKeyCodeFirst = KEY_SELECT;
  else if ( digitalRead(uiKeyBack) == LOW )
    uiKeyCodeFirst = KEY_BACK;
  else 
    uiKeyCodeFirst = KEY_NONE;
  
  if ( uiKeyCodeSecond == uiKeyCodeFirst )
    uiKeyCode = uiKeyCodeFirst;
  else
    uiKeyCode = KEY_NONE;
}


#define MENU_ITEMS 4
char *menu_strings[MENU_ITEMS] = { "First Line", "Second Item", "3333333", "abcdefg" };

uint8_t menu_current = 0;
uint8_t menu_redraw_required = 0;
uint8_t last_key_code = KEY_NONE;


void drawMenu(void) {
  uint8_t i, h;
  u8g_uint_t w, d;

  u8g.setFont(u8g_font_6x13);
  u8g.setFontRefHeightText();
  u8g.setFontPosTop();
  
  h = u8g.getFontAscent()-u8g.getFontDescent();
  w = u8g.getWidth();
  for( i = 0; i < MENU_ITEMS; i++ ) {
    d = (w-u8g.getStrWidth(menu_strings[i]))/2;
    u8g.setDefaultForegroundColor();
    if ( i == menu_current ) {
      u8g.drawBox(0, i*h+1, w, h);
      u8g.setDefaultBackgroundColor();
    }
    u8g.drawStr(d, i*h, menu_strings[i]);
  }
}

void updateMenu(void) {
  if ( uiKeyCode != KEY_NONE && last_key_code == uiKeyCode ) {
    return;
  }
  last_key_code = uiKeyCode;
  
  switch ( uiKeyCode ) {
    case KEY_NEXT:
      menu_current++;
      if ( menu_current >= MENU_ITEMS )
        menu_current = 0;
      menu_redraw_required = 1;
      break;
    case KEY_PREV:
      if ( menu_current == 0 )
        menu_current = MENU_ITEMS;
      menu_current--;
      menu_redraw_required = 1;
      break;
  }
}


void setup() {
  // rotate screen, if required
  // u8g.setRot180();
  
  
  //DDRC  = B11111111;
  //PORTC = B00000000;
  
  DDRD  = B11111111;
  PORTD = B00000000;
  
  DDRE  = B11111111;
  PORTE = B00000000;
  
  uiSetup();                                // setup key detection and debounce algorithm
  menu_redraw_required = 1;     // force initial redraw
}

void loop() {  

  uiStep();                                     // check for key press
    
  if (  menu_redraw_required != 0 ) {
    u8g.firstPage();
    do  {
      drawMenu();
    } while( u8g.nextPage() );
    menu_redraw_required = 0;
  }

  updateMenu();                            // update menu bar
  
}

Hmm..., WR and reset should be fixed to a proper signal level, I think

Oliver

Hi

Well I didn't get it to work. It seems u8glib pulls the reset and WR down and overwrite my presets.
Where can I find those settings in u8glib?

Thanks

actually, the constructor is this:

    U8GLIB_NHD31OLED_BW(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, 
        uint8_t cs, uint8_t di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)

WR is not used and will not be set by u8glib. You may decide not to use the reset.

Oliver