DMD Dot Matrix Display SPI Firmware Development: Software Control of DMD Displays

Selvakumar
29. September 2016
Categories:Technology,  Embedded Software,  UI/UX Design,  Industrial

Our earlier blogs on DMD discussed the Dot Matrix Display internals and interfacing techniques. In this blog, we focus on DMD dot matrix display SPI firmware development — specifically, how to write display firmware for a DMD panel that drives industrial LED displays and home automation display systems reliably and efficiently. Embien's Product Engineering Services cover the full scope of such embedded display firmware projects, from architecture to production.

DMD Dot Matrix Display SPI Firmware Development: Driving the Panel

As we have seen, the DMD panel comprises a matrix of LEDs — the foundational building block of industrial led displays. Each LED needs one bit of information to store its state. So effectively the DMD data to be displayed can be represented as consecutive memory. Of the many mechanisms available, a simple array is the easiest representation. Thus to represent pixels in a 16×32 DMD panel, the following 'C' statement can be used:

Unsigned char buffer_data [16][4];

Since each byte has 8 bits, we are representing a 32-pixel row with 4 bytes. Now that the memory for display data is allocated, we need to transfer the same to the DMD panel. There are many ways to achieve this — simple bit-banging or dedicated peripherals if available. As seen earlier, using SPI is the simplest and easiest method. Since most microcontrollers, even very low-end MCUs, have an SPI master port available, this DMD dot matrix display SPI firmware development approach is applicable across platforms.

By design, the data pushed into the DMD panel is displayed only in every fourth row, in a certain order. It is necessary to select the line set based on the Demultiplexer input. For a 16×32 DMD panel, we will have to drive Demux inputs in four possible combinations — 00, 01, 10, and 11.

16X32 DMD panel

Demux inputs – possible combinations

Since only one fourth of the data is going to be displayed at any given time in the DMD, it is essential that the display is refreshed fast enough for the human eye not to detect the difference. Assuming a minimum of 20 frames per second, we need to drive each line set four times faster. So for a 16×32 panel, we need to drive the SPI at at least a frequency of 16×32×20, i.e., around 10 KHz. Apart from this, we need to switch the Demux pins once every 16×8 pixels, i.e., around 12.8 ms.

One way of achieving this is using a timer in combination with SPI. Typical steps involved in DMD dot matrix display SPI firmware development for driving a DMD panel are given below:

  • Initialize the Pins and Port functionality enabling SPI operation for DS/OE pins and GPIO output for Latch pin and Demux pins.
  • Initialize the SPI controller at at least 20 times the number of pixels.
  • Initialize a variable to indicate the current line set.
  • Use a timer or task to perform the following operations once every quarter of the total transfer time:
    • Switch the Demux pin to point to the current line set.
    • Configure the SPI controller to transfer the current set of line data (each separated by one fourth of the buffer size).
    • Increment the line set pointer to point to the next set. Fall back to 0 after 3.
    • Wait for the SPI transfer to complete before starting the next cycle.

With the above mechanism it is possible to seamlessly display data on industrial led displays based on the DMD panel using the SPI controller.

Industrial LED Displays: Buffer Manipulation for DMD Panels

A major discrepancy is not covered in the above description. As mentioned earlier, the data shifted into the DMD is displayed in a certain manner, typically as depicted below. When developing firmware for industrial led displays, this memory layout mismatch must be resolved in software to ensure pixel-accurate rendering.

It is possible to store the data in the above format. Or, for ease of manipulation, we can go for a double buffer approach. One buffer (buffer_data) will hold data in a format easy to manipulate, and another buffer (back_buffer) holds data in the format to be shifted into the DMD. A simple routine copies data from the first buffer to the second, typically as follows.

The memory allocation for back_buffer is represented as:

Unsigned char back_buffer [4][16];

//for four bytes of data

for(index = 0;index < 4; index ++)

{

pos = 0;

//when single DMD panel (16×32) NUM_PANELS is one and so on.

for(col = 0; col < 4 * NUM_PANELS; col ++)

{

offset = 15 – index;

//four different set of rows given in Demux table

for(row = 0; row < 4; row ++)

{

back_buffer[index][pos]  = ~buffer_data[offset][col];

offset = offset – 4;

pos ++;

}

}

}

Thus with the above double buffering scheme, the complexities of shifting are abstracted and the user can simply manipulate the buffer directly. For example, to draw a simple pattern of 'T' in the first 8×8 pixels, the following statement can be used:

Buffer_data [0][0] = 0x1F;

Buffer_data [1][0] = 0x04;

Buffer_data [2][0] = 0x04;

Buffer_data [3][0] = 0x04;

Buffer_data [4][0] = 0x04;

Buffer_data [5][0] = 0x04;

Buffer_data [6][0] = 0x04;

Upon calling the transfer routine, this information is transferred suitably to back_buffer. The timer/task will feed this data to the DMD via SPI, effectively displaying the 'T' symbol. This double-buffer technique is a cornerstone pattern in DMD dot matrix display SPI firmware development for industrial led displays that require flicker-free, artifact-free rendering.

Home Automation Display: DMD Applications

Beyond industrial led displays, DMD dot matrix display SPI firmware development enables a wide range of real-world use cases, particularly in the home automation display segment. A home automation display built on a DMD panel can serve as a status indicator for smart home controllers, showing room temperature, appliance states, or security alerts in a compact, high-visibility format. Other common applications include retail point-of-sale signage, public information boards in lobbies and corridors, and industrial status boards on factory floors — all areas where home automation display panels and industrial led displays deliver clear value.

The SPI-driven firmware approach described in this blog scales elegantly to these use cases because the underlying DMD dot matrix display SPI firmware development pattern remains the same regardless of panel count or content type. Embien has applied this expertise across embedded display products as part of its comprehensive Product Engineering Services, helping clients take home automation display and industrial led display products from concept to production.

Graphical Programming: Font Rendering and Text Display

With the hardware driving and buffer manipulation layers in place, the next challenge in graphical programming for DMD displays is text rendering. Graphical programming at this level involves encoding font bitmaps into memory, mapping character codes to glyph data, and writing pixel-level blitting routines that place characters into buffer_data correctly. In our next blog, we will look into advanced concepts of font rendering and scrolling — key graphical programming techniques that bring DMD displays to life for real user-facing applications. For teams building richer display stacks, Embien also offers Qt application development services that extend these display capabilities to higher-level GUI frameworks.

GUI Development Embedded: Extending DMD Display Capabilities

For products that demand more than character-based output, gui development embedded frameworks such as Embien's Sparklet library can be layered on top of the DMD dot matrix display SPI firmware development foundation described here. By abstracting the display driver behind a framebuffer interface, gui development embedded tools can render widgets, icons, and animated content on DMD-based industrial led displays and home automation display panels without modifying the low-level SPI firmware.

With an understanding of DMD dot matrix display SPI firmware development and software control of DMD, we will look into advanced concepts of font rendering and scrolling in our next blog.

Related Pages

Edge COMPUTING SERVICES

Discover how edge computing enables real-time DMD dot matrix display SPI firmware development and control of industrial led displays at the network edge, reducing latency in factory automation and smart infrastructure applications.

Read More

INDUSTRIAL AUTOMATION EXPERTISE

Embien's industrial automation expertise covers firmware for industrial led displays, home automation display panels, and DMD-based status boards — delivering reliable embedded display control for manufacturing and process industries.

Read More

DIGITAL VISION CHART DEVELOPMENT FOR A MEDICAL OEM

A case study on developing a digital vision chart for a medical OEM, showcasing graphical programming and gui development embedded techniques applied to precision medical display systems.

Read More

Subscribe to our Blog