Go Down

Topic: OLED display with 4-wire SPI mode, but without CS (Read 49283 times) previous topic - next topic

Caltoa

Feb 12, 2014, 02:49 pm Last Edit: Feb 12, 2014, 02:51 pm by Caltoa Reason: 1
I bought the cheapest 1.3" OLED 128x64 display on Ebay. It has a 4-wire SPI mode, but the CS is fixed to ground.
Most libraries have a bad result, but the u8glib is almost working, only the characters are shifted some to the left.
https://code.google.com/p/u8glib/

Is this easy to fix in the library, or is there another library for it ?

Details for this display:
128x64 pixels
manufacturer: heltec  http://heltec.taobao.com
The BS0,BS1,BS2 are connected to ground, so it is a 4-wire SPI interface.
On Ebay it is sometimes said that the driver IC is a SH1106, but the 128x64 display of this manufacturer has always the SSD1306 driver chip.
The labels on the board are wrong, the 'sda' is the data_in and the 'scl' is the clock. It is not possible to set it in I2C mode, since the BS0,BS1,BS2 are connected to ground and can not be changed.

CrossRoads

What happens if you remove the 0 ohm jumper? Does CS/ work then?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

olikraus

I think your display really has a SH1106 controller. It is similar, but not identical to the SSD1306.
1. Locate file u8g_dev_ssd1306_128x64.c
2. Find line 183:
Code: [Select]
  0x000, /* set lower 4 bit of the col adr to 4  */

3. Change this to
Code: [Select]
  0x004, /* set lower 4 bit of the col adr to 4  */


Oliver

Caltoa

CrossRoads, If I remove the 0 ohm, I should be able to solder a wire to CS. But it is working without CS now.

olikraus, Thank you so much! Value 0x002 worked. So now my cheap display is fully working.

I'm testing now to see what it can do.
It doesn't seem to have contrast.

olikraus

Good to read that your display is working. I am also glad that U8glib supports this controller with minor modifications. The 0x004 was a wild guess, based on your picture. Excellent, that you figured out the correct value.

Oliver

Caltoa

#5
Feb 13, 2014, 03:40 am Last Edit: Feb 13, 2014, 12:14 pm by Caltoa Reason: 1
With hardware SPI, sometimes a mismatch could occur. But using the RST with the third parameter fixed it.

Software SPI : okay
Hardware SPI : okay with RST connected and used as third parameter.

FPS sketch with Arduino Uno and Hardware SPI with RST to pin 2:
U8GLIB_SSD1306_128X64 u8g(10, 9, 2);  // HW SPI Com
draw clip test : 038.4
clear screen : 005.3
draw @ : 007.8
draw pixel : 002.5

When I use 50ns instead of 300ns for the SPI clock cycle, the values are about 4% higher.

Using Software SPI
U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9, 2);  // SW SPI Com
draw clip test : 026.3
clear screen : 005.0
draw @ : 007.2
draw pixel : 002.4

The '2X' has higher fps
U8GLIB_SSD1306_128X64_2X u8g(10, 9, 2);  // HW SPI Com
draw clip test : 047.9
clear screen : 007.9
draw @ : 011.8
draw pixel : 004.7

olikraus

Thanks for providing the values. Hope speed is sufficient for you.

Oliver

LarsSorensen

Hi Oliver,
Any chance you could officially add this device to the library?

- Lars

Caltoa

LarsSorensen, if you look at the source development, you can see that Oliver is already working on the SH1106.  XD
For now, you only have to change that value in the library to 0x002, as you can read in the posts above.

olikraus

I have added this as issue 240 to u8glib: http://code.google.com/p/u8glib/issues/detail?id=240.
Not sure when i will be able to release a new version.

Oliver

LarsSorensen

Sounds great.
I would like to not have to alter the SSD1306 device in the library, as I have many SSD1306 devices laying around.

olikraus

It will still take some time to the next release. Until then, i suggest to alter that one number on the source code as described above.

Oliver

markmotor

Hi guys, I've got the same display but I don't know how to wire it, somebody can help me? I would like to use it with an arduino mega.

Caltoa

With the U8glib you can use the hardware SPI signals, but also any pin using software toggling.
I suggest to use the software toggle.

I did this:
U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9, 2);  // SW SPI Com

Find 5 unused pins.
You have to use an Arduino pin for chip-select (I used pin 10), but that is not connected to the display.

Connect it like this:
U8GLIB_SSD1306_128X64 u8g( SCL, SDA, <cs no connected>, D/C, RST);
The display label 'SCL' is the clock, 'SDA' is the data.

Let me know if it works.

markmotor

I uncommented that line U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); in the Hello word example and connect th wires like these:

Mega    OLED
   13            SCL
   11             SDA
   10              -
    9             D/C
    2              RST

I also tried like that

Mega      OLED
   21             SCL
   20           SDA
    9             D/C
    2              RST

but they doesn't work.
What could be the problem?
Why need to use an Arduino pin for chip-select, if it isn't connected to the display?





Go Up