Optimized SSD1351 library with buffering

Status
Not open for further replies.
This library is really very fast. Thank you kirberich!

I want to use the Adafruit OLED (128 x 128) together with the Audio Adaptor Board, calculating FFT for two audio channels and so on. The test sketch works fine with a Teensy 3.6 at 72 MHz. If I set the Teensy at 180 MHz it doesn't work. Are there plans to make the library work with the Teensy 3.6 at 180 MHz?

Best,
Peter
 
Thanks so much for this library kirberich and Paul! I've been using it with a Teensy 3.2 and the 128x128 display version.

I know this is an old thread, but I was wondering if there was any conclusion about which SPI clock frequencies are stable with which CPU frequencies. On my board, I can only seem to get it to work with 15MHz SPI and 96MHz CPU. If I drop the CPU to 72MHz, I have to drop the SPI clock to 8MHz. Some other combinations produce just a black screen, while others (worryingly) run for about a second and then lock up in odd ways with the screen glitching (this is in highcolor mode, not sure about others yet). I don't understand the lowest level of SPI workings quite yet (I am trying to learn via using this library) so if anyone could shed any light on why certain clocks would work while others don't, it would be really helpful and appreciated! Or if it's just a case of "try and see what works" because of hardware variation that would be great to know too :) I'm writing a more barebones graphics library than the standard Adafruit-style ones, with a tile-based framebuffer for a game, so ultimately I'd just like to have the simple "write to range in ram" command working as fast as possible (rather than any of the line/circle/etc routines).

Thanks again for the great code reference!
 
I've been playing off and on with 128x128 displays, mostly with the Adafruit Animated eyes sketch (which uses the library for setup, but does all of its own SPI/DMA handling):

I go back and forth between TFT display and OLED, and I'm thinking of giving OLED another whack.

In the past, I've found that it depends on the display. So far, I used two different displays:

And there are two more I've thought about using:

Initially without setting the SPI bus speed, I needed to lower the clock frequency to 24 Mhz for the Adafruit display and 48 Mhz for the NewHaven display. I switched the code to use SPI transactions and to set the SPI bus rate 18000000 (down from 24000000). I am able to get the NewHaven display to work with the Teensy 3.5 up to 120Mhz clock speed. Unfortunately, the Adafruit display did not seem to work unless I set the processor clock speed to 24 Mhz on the 3.5. I even tried lowering the SPI bus speed to 16000000 and it didn't work. I will probably do some testing tonight, going back to the Teensy 3.2.

While I like the NewHaven display, I want a smaller display (I'm trying to fit these inside of steampunk goggles), and I'm considering whether to get one of the other two displays, which are smaller. However, I wonder if it will need to be limited like the Adafruit display? Anybody use these displays (WaveShare color 128x128 OLED and DIYmall color 128x128 OLED)

But my basic take away is the individual displays may be the limiting factor. You may need to play with the various processor speed and SPI bus speed to get one that works for your displays.

I also use the TFT displays, and I find those displays can operate at the highest bus speeds. I vaguely recall even the 3.6 at its fastest processor speed could drive the Adafruit TFT display.
 
Last edited:
Thanks for the info! It's odd that the clock has to be so low, since the data sheet says that it can go as low as 5ns period for the clock signal (which is 20MHz)...maybe I'm being naive about how close I should expect to get to spec :)

Those NewHaven displays look great, are the pixels really as clean and smooth as those images suggest? I find the adafruit display has very noticeable pixel structure...I love how clean the monochrome displays are, but I understand it's much harder to get that clean look with colored ones...
 
Thanks for the info! It's odd that the clock has to be so low, since the data sheet says that it can go as low as 5ns period for the clock signal (which is 20MHz)...maybe I'm being naive about how close I should expect to get to spec :)

Those NewHaven displays look great, are the pixels really as clean and smooth as those images suggest? I find the adafruit display has very noticeable pixel structure...I love how clean the monochrome displays are, but I understand it's much harder to get that clean look with colored ones...

Ok, I tried it. Note, I'm using jumper wires on a breadboard, next to my computer, so I assume you may get a faster speed with properly shield wires that are soldered together. I'm also only trying one display not two (I broke one of the NewHaven displays, so I couldn't use two NewHaven displays anyway). While I only have one display connected, the Teensy is generating both eyes.

That being said for the two OLED displays, I get:
  • While the Teensy 3.2 can sort of do the display, I can't get either display to work without electrical interference ruining the effect;
  • I can run the NewHaven display up to 120 Mhz clock speed, providing I use a SPI clock speed of 18,000,000 (18 Mhz) -- I can't run it overclock (168Mhz);
  • I can run either NewHaven or Adafruit displays at any clock speed the 3.5 can handle if I set the SPI clock speed to 11,000,000 (11 Mhz);
  • The TFT displays can run on the Teensy 3.2 with a SPI clock speed of 24,000,000 (24 Mhz) at all Teensy 3.2 clock speeds, including 120 Mhz over-clock.

Note, in the past, I believe I did get the NewHaven display to work without screen glitches on the 3.2. I'm using the teensyduino 1.42 beta7 release. In addition to going down to 2 Mhz clock speed, I tried changing the Teensy 3.2 options to "Debug" instead of "Faster", and that still fails.

So, if I want to use the OLED displays, I need to use the 3.5 or 3.6 Teensies. But the 3.5/3.6 are an 1" longer, which might be a problem.

As why the Adafruit display is slower than the NewHaven, I assume both displays use the same chipset, and both use the same OLED monitor. But the other components on the Adafruit board might not be as fast acting as the components on the NewHaven board. If you look at digikey.com which re-sells both, the Newhaven display is also cheaper ($30.50 vs. $39.95) than the Adafruit display.
 
That's a great breakdown! Thanks for the thorough sleuthing :)

It's also good to know that the TFT displays are so fast (that was quite a surprise to me).

I believe I was able to run most cpu frequencies on the 3.2 when I dropped the SPI down to 8MHz, but that sort of defeats the purpose. I think I'll end up just sticking to the 96/15 setting as it's a reasonable middleground.
 
Advantages that OLED displays have over TFT:
  • On a TFT display, you have a much smaller angle of view where you can properly see the image than with OLED;
  • The colors are more saturated on an OLED display.

Advantages that TFT displays have over OLED:
  • The TFT displays are cheaper than the OLED displays, and there are many clone displays available;
  • As I mentioned, the TFT displays are capable at operating at a faster SPI bus frequency;
  • Because it uses a back light, you can control the overall brightness using a PWM bit to control the back light;
  • The power usage is more consistent in that the main power draw is the back light, while with OLEDs if more of the screen uses black pixels, it will use less power than if most of the pixels are white.
 
In case anybody finds this article, I have bought the waveshare displays because I needed to rethink the layout. The waveshare had a smaller footprint, and I wouldn't have to resolder it. In addition, the orientation of the pins would allow me to plug the units directly to the PCB and I wouldn't need wires. I've found over time, that as I carry props, my solder joints connecting wires seem to come apart as I move the prop.

The Teensy 3.5 drives the Wavelan displays just like the Newhaven. I can overclock the 3.5 up to 168 Mhz and it will work as long as I keep the SPI bus speed to 18 Mhz or less. I tried using the Teensy 3.2 with the Wavelan OLED display, and like the Adafruit/NewHaven displays, I cannot get it to work without screen glitches, even when I set the Teensy 3.2 bus speed to 2 Mhz and/or limited the SPI bus speed to 4 Mhz.
 
As an update to the waveshare displays, I ruined all three of mine, so I'm going back to the Adafruit displays. One of the displays I dropped, and it would only display a screen that was glitching. I was rewiring my breadboard and I must have touched the wrong wire to the display and knocked both of my remianing displays.
 
Any idea how to rotate a certain font around? Possibly just a quick an dirty method. Don't need the whole display rotated
 
nevermind my above question, i figured something out.

on another note however, I'm wondering if anyone ever used this library along with the audio library? I'm getting some nasty noise that gets worse as I draw more pixels to the display..
 
Did anyone ever try to use this library concurrently with audio synthesis ? I just realized that I'm getting some serious timing issues in my sequencer when just a bit of stuff is happening on the screen. Wondering if this can be optimized somehow, and if it's something I could figure out.. any ideas would be of so much help
 
Status
Not open for further replies.
Back
Top