OLED Module Interface


Introduction

Digilent offers a handy, 128x32 pixel monochrome OLED module, which is handy for displaying small amounts of information (details here). The controller chip is an SSD1306, but configured for 32 rows rather than 64. The chip is set up for 4-wire [1] SPI communication, and to prolong the life of the display it requires a particular startup sequence with regards to timing and the two power supply lines. It then offers a 128x8 memory space of 8-bit words, only four bits of which correspond to displayed pixels.

To me, the display is primarily useful as an informative or debugging output mechanism. In my clone of Nintendo’s a 1st-generation Game Boy® I use it to display the internal state of the processor, and I am currently exploring using it as the primary output display of my frequency counter. My goal is therefore to build an interface to the module that handles all low-level communication and presents a tile interface, with a bitmap font loaded into the tile map.


Progress

The GitHub repository is here, containing a complete rewrite of my original driver. It is structured as follows: an FSM drives an SPI transmitter using data coming from a blockram or various constant values to configure and operate the display. The first few states start up the display, using timers to turn on the power lines after the correct delay. A series of preprogrammed commands are then sent to enable the charge pump, turn on the display and enable horizontal addressing mode. The code then uses a blockram, tilemap, to translate the tile values stored in another blockram to pixel values to be transmitted.

Status as of 2014/08/17

A very basic version of the driver has been written, including the tilemap but not including the tile memory. I have yet to decide on the exact structure of the external interface to this driver module, so it is thus far nonexistent: the contents of the tilemap are dumped to the display without any control possible.

The font used comes from the Noritake Itron PIC Font page, converted to bitmaps and with a 1 px border added on two sides. The first 16 ASCII control codes have been replace by 0-9 and a-f, to allow the display of hex nibbles without conversion. The other 16 blanks can be used for special characters as needed.

Things to do:



  1. 4-wire SPI uses 8-bit words and the standard 3 lines (clock, data and chip select), plus a fourth data/!command line to indicate if the word is meant as a command or as a byte to be written to pixel memory.

Written with StackEdit using markdown.css, google-code-prettify and MathJax.