SSD1332 and SSD1331 fast drivers

Status
Not open for further replies.

sumotoy

Well-known member
OBSOLETE! All controllers now included in one library (tha support many SSD1331,SSD1332,SSD1322,SSD1351, more to come), it's much faster and uses the same commands/fonts/icons/images of my TFT_ series.
It doesn't need adafruit GFX and finally works at any rotation (one of the reason I abandoned adafruit gfx).
New library is called SSD_13XX


Hello,
I just finished a fast library for SSD1332 OLED displays that works with SPI and uses correctly hardware accellerated macros for this chip and SPI/DMA from Paul. The result it's very promising, the display it's really fast, here's video.
Note that the small time gaps of the video are caused by camera->youtube conversion! It performs very smooth in real word. The video shows the speed with a Teensy3.0 in SPI mode with version 0.5b1, now the 0.5b2 it's even faster. The SSD1331 has the same speedup. Both modules have been tested with 4 wires connection with 24Mhz SPI

Both libraries uses Adafruit_GFX so are 100% compatibles with projects builded around those libraries.


I spent quite a lot of time to figure out what's wrong with damn solomon's hardware accellerated macros (even Adafruit has commented out) and finally I got it working.

Edit 28/05 :
SSD1332 library has been optimized and now it's even faster, I believe it's pushing the limits of this chip, btw it's really tricky to have the screen rotation command working correctly since the hardware accellerated commands works only
in one way so I have to deal continuosly with pixel addressing (reverse it, invert upside down and up and so on) so at the moment in only works ok in normal mode (setRotation(0)) and upside down (setRotation(2)). I'm near to find a permanent solution for the remaining 2 modes.
I still not checked the screen rotation of SSD1331 or SSD1306 but since they not use hardware accellerated stuff it believe it's easy trick.

On GITHUB
https://github.com/sumotoy/OLED_SSD1332
https://github.com/sumotoy/OLED_SSD1331

EDIT
:
An experimental SSD_1306 library here:
https://github.com/sumotoy/OLED_SSD1306
 
Last edited:
Looks awesome, however I can't make it work on my Adafruit .96 oled display ssd1331. You seem to have only 3 pins defined and there are 5 pins to hook up.
Your sketch doesn't define sclk or mosi like the adafruit example does. I did look at the library, but I'm not a code expert.





#define rst 14
#define dc 9
 
I'm using pure SPI and Adafruit use bitbang that it's much slower than SPI. Internally the library use the standard SPI pins so you have to connect SCLK or CLK to pin 13 and SDIO or DATA or MOSI to pin 11 as standard SPI.
If you are using Teensy3 you need to connect CS and DC to a pin that's is compatible with fast SPI routines. In my example I choosed 10 (the standard SS pin) for CS and 9 for DC but you can check the instructions and you have a good choice of pins.
The reset pin it's not critical and you even can connect to vcc and not use. Since this library use SPI in theory the SCK and MISO can be shared with other devices so it's possible to save more pins but I still not checked this feature since I'm using SPI accellerated libraries from Paul and for sure it's still not interrupt frendly. I just solved some memory addressing problems in another library so I will update those soon to fix the screen rotation and probably I will add the protection for IRQ.

Let me know if you need assistance!
 
Last edited:
I'm using pure SPI and Adafruit use bitbang that it's much slower than SPI. Internally the library use the standard SPI pins so you have to connect SCLK or CLK to pin 13 and SDIO or DATA or MOSI to pin 11 as standard SPI.
If you are using Teensy3 you need to connect CS and DC to a pin that's is compatible with fast SPI routines. In my example I choosed 10 (the standard SS pin) for CS and 9 for DC but you can check the instructions and you have a good choice of pins.
The reset pin it's not critical and you even can connect to vcc and not use. Since this library use SPI in theory the SCK and MISO can be shared with other devices so it's possible to save more pins but I still not checked this feature since I'm using SPI accellerated libraries from Paul and for sure it's still not interrupt frendly. I just solved some memory addressing problems in another library so I will update those soon to fix the screen rotation and probably I will add the protection for IRQ.

Let me know if you need assistance!

I hope this is the right place to respond. Thank you for responding so quickly. I have another display that I will try. It looks like it uses the ssd1331 driver. It is the NKK ICS01P.
After some research, I see that this fill.rect instruction works slowly for everyone. My application is with the mlx90620. I am displaying the individual temperatures as a range
of colors from black to white, set into a grid of blocks. When I built an earlier version with the Omron D6T-44L ,I assumed that the reason for the slow update was that the sensor is only specified at a 3HZ refresh rate. The MLX90620 is capable of video speeds - up to 512HZ, so I'm looking forward to seeing what it can do.
 
Melexix mlx90620 if I remember right its an IR 16x4 I2C sensor, it works with I2C protocol. I don't know NKKICS01P and can't find any info on the net but if it's ssd1331 you have to be sure that it's hardware configured for SPI (there's a couple of solder tags normally on PCB) because SSD13XX series can work with 3 different interfaces. If you want fast refresh rates I will raccomand SSD1332 that have hardware accellerated macros for fill rect and line so in combination with high speed SPI it's the fastest OLED I put the hand on.
 
Ahh, size is the problem. This display is rgb 52x36, 17.8mm wide, 17.2mm long, 9.9mm tall. You can stack 2 of these displays on top of a Teensy 3.1. The viewing area for this display is 10mm x 13mm. In fact if I could find a smaller one I would be happier. To clarify: NKK Smart Switch oled display ICS01P. Their applications manual does not actually specify that it is a ssd1331 but many of their charts are cut and pasted out of the Solomon Tech manual. Literally every parameter is the same. On the last page of the tech manual NKK states that the display is capable of video speeds.


Pin Definitions on the display;
Ground: The Ground for logic and OLED.
VDD: Power source for logic (2.4V to 3.5V)
VCC: Supply voltage for OLED (15V to 17V)
SDI: Data for SPI communication.
SCK: Clock for SPI communication maximum 6.66 MHZ SDI: Data for SPI communication.
D/C: Data/command select. When pin is pulled low the transmitted bytes are treated as command. When pin is pulled high the transmitted bytes are treated as image data.
RES: Reset for OLED module for initialization.
SS :select OLED module.This pin should be pulled down for duration of the data/command package.

Fill enable is #26, A4 default




 
Try:
SDI -> 11
SCK -> 13
SS -> 10
DC -> 9
RES -> 14

in file OLED_SSD1331.h change:
#define OLED_WIDTH 52//was 96
#define OLED_HEIGHT 36//was 64

I dunno what is fill enable pin, probably should be tied to VDD but better check on datasheet.
Again, be sure that display it's enabled for SPI and NOT 8bit or I2C!

Library works at standard SPI speed but using setBitrate(24000000); (in your sketch) you can get 24Mhz and SPI works at almost max speed possible, in my tests the display worked with no problems, maybe was just a bit hot.
 
Last edited:
Hello sumotoy,

I just tried out your SSD1331 library and I couldn't get it to work. I used your SSD1331 combined with your modified Adafruit_GFX library and the included test.ino. The code is completely stock except the spi rst pin:

#define cs 10
#define rst 12 //changed from 14 to 12
#define dc 9

MISO is connected to pin 11, and SCLK is connected to pin 13

Hardware setup:
Teensy 3.1
Adafruit 0.96" 96X64 w/SSD1331 controller

Software config:
Teensyduino 1.20 96MHz
Arduino 1.0.6


Using the stock Adafruit SSD1331 and stock Adafruit_GFX libraries the display works without any issues.

Your libraries compile and write the Teensy without any errors. After a compile and an upload with your libraries, the Teensy reboots and I can see the pin 13 LED (SCLK) is slightly illuminated. It looks like the SCLK is working, not sure about MOSI. I know that your libraries are supposed to run faster so I double checked the grounds for the the OLED and the Teensy to make that wasn't an issue.

Any idea what the problem could be?

Thanks,

Rob
 
hello,
It should works, I've just tested with a display here, no issue. I'm not using MISO at all. I will update for the new SPI library support in a couple of days.
 
hello,
It should works, I've just tested with a display here, no issue. I'm not using MISO at all. I will update for the new SPI library support in a couple of days.

Sorry, this should read:

MOSI is connected to pin 11, and SCLK is connected to pin 13

I'm not using MISO either. I'll give it a try as soon as you update the libraries.

Thank you,

Rob
 
hello

I am also testing the Adafruit 0,96" OLED.
SSD1331 Library is not working for me, too.
But i tried the SSD1332 Library and it is working, but the view is upside down and text is mirrored.
 
Mmm, SSD1332 it's really different from SSD1331, it uses hardware accelleration inside so many functions are modified to use this feature and should not working well with SSD1331.
Can you please give me more infos about the OLDE you are using? I've tested again here and it's working. Maybe a picture will help me.
Tomorrow I will release a new version of both library that are SPI Transaction compatible and can use alternative SPI pins as well.
 
Hello Sumotoy,

The Readme.md file states that the drivers work with the Arduino DUE. However, I can't get it to compile. Sinse this is the Teensy forum, could you please direct me to an Arduino forum where you could help me with the compilation problem? If it is OK to do it in this forum, please let me know.

Thank you
 
I am using this OLED:
http://www.adafruit.com/product/684
and Teensy-3.1

The library SSD1332 is working fine with this display but i had to do little changes.
I did some little changes in drawPixel, drawLine and hdwre_drawRect, so that setRotation will work.
Mirrored Text is fixed also, when i use this display with the changed library in my project.
I also write a function hdwre_fillRect to draw big text very fast. (use of writeData and goTo)

Also I found some brackets missing in the adapted Adafruit_GFX library in fillTriangle.

Bitmaps not yet tested.

I added some files for testing.
(Renamed SSD1332 Libray to SSD1331_2)

mathew
 

Attachments

  • OLED_SSD1331_2.cpp
    20.9 KB · Views: 328
  • OLED_SSD1331_2.h
    8.3 KB · Views: 405
  • test_Teensy31_10.ino
    11.1 KB · Views: 261
  • Adafruit_GFX.cpp
    21.1 KB · Views: 374
Hello Matthew.

Thank you. That is the same display I use.

One of the changes you made to Adafruit_GFX.cpp is to add the line

setFont(GFXFONT_GLCD);

and a couple of functions that use GFXFONT_GLCD and others. But those are not defined. Perhaps you also made changes to the font.h and font.cpp files?

Thank you,

Pedro
 
Hello,

no i just added some missing brackets in the fillTriangle Funktion.

You got errors, because of the modified Adafruit_GFX library described here:
https://github.com/sumotoy/OLED_SSD1332
I renamed it to Adafruit_GFX_oled and attached it to this post.

Download the 2 librarys i attached, extract and copy them to the arduino/libraries folder.
Then restart Arduino IDE and and open the example scetch test_Teensy31_15 in the SSD1331_2 folder.
Look at the defines of the pins you have to wire.

The example should compile (I use Arduino 1.05 with Teensduino).

The example bitmap is from Adafruit example here:
https://learn.adafruit.com/096-mini-color-oled/drawing-bitmaps

Hope you get it work, too.

Mathew
 

Attachments

  • Adafruit_GFX_oled.zip
    25.7 KB · Views: 310
  • OLED_SSD1331_2.zip
    17 KB · Views: 337
Thanks for help, I'm working for a new version today that will use modified GFX and the standard one. I only have a big issue with screen rotation with SSD1332 due the hardware accelleration routines that forced my to use a weird screen addressing scheme.
All my library are build for Teensy3.x, UNO but in the last 2 months I'm extending to DUE and ENERGIA as well and trying to keep code compact so maybe my github is not well sincronized with the code I have in my computer, this happened several times this year.
About the display you are using: Accordly the link you gived me it's a SSD1331 that uses similar commands of SSD1332 but not 100% the same! Also, many calls to the Hardware Accellerated routines of SSD1332 will be ignored or misinterpreted by SSD1331 and in the best case the speed will suffer for that so I better fix the SSD1331 library first.
The Adafruit_GFX modified it's basically the same of Adafruit but text is much faster and added some missed features, changed a couple of functions with faster ones but basically uses the same names for compatibility.
 
Hello Sumotoy,
you can look at the library i uploaded. (originally it was your SSD1332 library)
I did some changes because of screen rotation,
mostly in the "switch (getRotation)..." command (swapping coordinates) of these functions: drawPixel, drawLine, hdwre_drawRect, hdwre_fillRect.
And in setRotation.
Even big Text (i.e. setTextsize(3) ) is now drawn without a delay (i added hdwre_fillRect)
May be you have a look.
With my display (SSD1331) it works ok for me in all 4 directions.
 

Attachments

  • OLED_SSD1331_2.cpp
    19.8 KB · Views: 425
  • OLED_SSD1331_2.h
    8.3 KB · Views: 262
Hello Matthew,

Thank you very much for your help. It now compiles. I was using the Adafruit_GFX.cpp program you originally posted. But there was no header file, and therefore, would use the original Adafruit .h file. That way, it couldn't find the definition for the setfont function and gave the compile time error.

Thanks again,

Pedro
 
Hello Sumotoy,

Matthew solved my problem (at least, the compilation part of it). I'll try it later this week. Please, let me know when you finish porting to the Due and Energia, since I am also testing those platforms.
 
Hi Sumotoy,

I have been spending the last couple of days trying to get Adafruit's SSD1331 module to work with my Teensy 3.1 (96Mhz), I have given the connections as instructed.
sclk - 13
mosi - 11
cs - 10
rst - 14
dc - 9
3.3v - Power

While adafruit code works fine for me, It is too slow for my needs I tried your library on an arduino and works it does not work with my teensy though.
I have also tried the SSD1332 library with this but the display is mirrored and rotated, I have tried the above fix mentioned by mathew but have been failing at my attempts.
Can you please guide me in this matter?
 
Time to upgrade this library, I've finally some spare time this week. It was developed long time ago, that time I was still using Adafruit_GFX.
 
I'm working on it, has to be completely rewrited to get rid of the useless Adafruit stuff, but in the meantime I'm fixing some other library as well.
I will add external font support as well (as the popular ILI9163C)
 
Status
Not open for further replies.
Back
Top