Summary of SSD1306 OLEDs – DMA Library for Arduino Due
Grav Corp developed a high-speed library for 128x64 OLED screens using the SSD1306 controller on Arduino Due. By leveraging Direct Memory Access (DMA), they reduced display buffer writing time from ~2ms to significantly faster speeds, minimizing CPU overhead. The project adapts techniques originally used for SD cards and ILI9341 TFT screens to optimize OLED performance via hardware SPI.
Parts used in the SSD1306 OLED DMA Project:
- 128x64 OLED screen
- SSD1306 controller
- Arduino Due microcontroller
- SAM3X8E microcontroller
- Adafruit_SSD1306 library
- Marek Buriak's ILI9341 library
- William Greiman's SD card libraries
So we’re always cooking up hot new hardware in the Grav Corp labs. Recently, we’ve been working on a project using a 128×64 OLED screen with the SSD1306 controller.
Adafruit is a good source of these displays, with an excellent library written by Limor Fried. The Adafruit_SSD1306 library makes it simple to use these displays with a variety of Arduinos, using either software or hardware SPI. However, we wanted a speed boost, and the Due looked like it could deliver, with its DMA (Direct Memory Access) capability.
So what is DMA? Direct Memory Access, as simply stated by Wikipedia:
- Direct memory access (DMA) is a feature of computerized systems that allows certain hardware subsystems to access main system memory independently of the central processing unit (CPU).
We wanted to use the DMA capabilities of the Arduino Due’s SAM3X8E microcontroller to speed up calls to the display() function, which writes the display buffer to the OLED controller. With stock settings using hardware SPI, calls to display() take ~2ms on the Due. This is a long time to tie up our CPU, so what can we do to improve this?
Like all good endeavours, this began with research. We hunted for anything regarding the SSD1306 and DMA but came up short. After digging deeper, we found Marek Buriak’s library for ILI9341-based TFT screens. Marek used code from William Greiman, who developed SD card libraries for the Arduino. William took 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.
For More Detail : SSD1306 OLEDs – DMA Library for Arduino Due
- What is Direct Memory Access?
DMA allows hardware subsystems to access main system memory independently of the central processing unit. - How can we improve display speed on the Arduino Due?
We can use the DMA capabilities of the SAM3X8E microcontroller to speed up calls to the display function. - Why did Grav Corp choose the Arduino Due?
The Due was selected because it possesses DMA capability which offers a significant speed boost over stock settings. - Does the Adafruit library support DMA?
No, the article states that research regarding SSD1306 and DMA came up short until adapting code from other sources. - What was the original performance time for display calls?
With stock settings using hardware SPI, calls to display take approximately 2ms on the Due. - Who wrote the Adafruit_SSD1306 library?
Limor Fried wrote the excellent Adafruit_SSD1306 library. - Where did the developers find the DMA code inspiration?
They found inspiration in Marek Buriak's library for ILI9341-based TFT screens which used code from William Greiman. - Can this library work with software SPI?
The Adafruit library supports both software and hardware SPI, though DMA optimization targets hardware SPI for speed.