[Lewin] wrote in to tell us about a high speed library for Arduino Due that he helped develop which allows interfacing OLED displays that use the SSD1306 display controller, using DMA routines for faster display refresh time.
Typically, displays such as the Monochrome 1.3″ 128×64 OLED graphic display , are interfaced with an Arduino board via the SPI or I2C bus. The Adafruit_SSD1306 library written by [Limor Fried] makes it simple to use these displays with a variety of Arduinos, using either software or hardware SPI. With standard settings using hardware SPI, calls to display() take about 2ms on the Due.
[Lewin] wanted to make it faster, and the SAM3X8E on the Due seemed like it could deliver. He first did a search to find out if this was already done, but came up blank. He did find [Marek Buriak]’s library for ILI9341-based TFT screens. [Marek] used code from [William Greiman], who developed SD card libraries for the Arduino. [William] had taken advantage of the SAM3X8E’s DMA capabilities to enable faster SD card transfers, and [Marek] then adapted this code to allow faster writes to ILI9341-based screens. All [Lewin] had to do was to find the code that sent a buffer out over SPI using DMA in Marek’s code, and adapt that to the Adafruit library for the SSD1306.
There is a caveat though: using this library will likely cause trouble if you are also using SPI to interface to other hardware, since the regular SPI.h library will no longer work in tandem with [Lewin]’s library. He offers some tips on how to overcome these issues, and would welcome any feedback or testing to help improve the code. The speed improvement is substantial. Up to 4 times quicker using standard SPI clock, or 8 times if you increase SPI clock speed. The code is available on his Github repo.
Any Idea if this would work with the Teensy 3?
The idea definitely will but I don’t know if the SAM3X8E DMA engine works the same way. You’d probably want to go look at the OctoWS2811 for how the DMA works on the 3.
The Teensy 3 has DMA of a form; people have used these features to speed up writes to other types of screen. However, this library is specific to the Arduino Due with its SAM3X8E. The Teensy uses a different processor, and this library uses processor-specific functions, so it won’t work with the Teensy.
A good place to start would be to look at SSD1306 implementations on the Teensy, and look at implementations of DMA on the Teensy, and see if you could stick those together. It can be tough to understand in the beginning, but three weeks ago, I didn’t think I could do this, and I got there, so I’m sure you can make it too!
Have a look at the uGFX library (http://ugfx.org). It is optimized for low resource systems as well and somebody just got it working with a Teensy 3 a few days ago (take a look at the forum).
Check Littlev Graphics Library. It works as an Arduino library too.
Website: https://littlevgl.com
GitHub: https://github.com/littlevgl/lvgl
Arduino library: https://github.com/littlevgl/lv_boards
I’m sure Paul Stoffegren would say otherwise about its performance relative the Teensy. Good try hackaday, though I don’t see any sales conversion on Arduinos and the other sponsors that fund you.
Yeah, and I don’t know who is funding you, I also don’t see any sales conversion on the possible sponsors that fund you…
its about time people found the dma modules. just imagine the led blinking shenanigans possible.