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