Envelope Followers, VU meters and LVGL

Using the NXP LPC55S69 for Embedded Graphics


Nov. 9, 2020
EliHughes-MoreFace_2k
Eli Hughes

Introduction

“Embedded” graphics technologies have come a long way since simple character displays. At one time in the not-so-distant past, microcontrollers were not powerful enough to drive high-resolution color LCD displays effectively. The proliferation of low-cost 32-bit microcontrollers has made it much easier to use high resolution color displays without needing to resort to high-end applications processors. High-resolution color LCDs are now available in virtually any size or resolution.

The LPC55S69 MiniMonkey with 240x240px IPS Display

One of the design features of the LPC55S69 MiniMonkey project was a 240x240px IPS display from buydisplay.com. The LPC55S69 is a good fit for small, low active power embedded graphics applications. It has as significant amount internal SRAM to store a framebuffer and has ample processing power to composite a scene on a small display. Putting pixels and simple graphics on a memory buffer is straight forward. However, using a dedicated library can save time when prototyping a user interface.

LVGL, Enveloper Followers and VU Meters

Light and Versatile Graphics Library (LVGL) is an open source option for embedded graphics/UI and is well documented making it simple to integrate into your project. Looking at the GitHub repo, you can see development is active and quite healthy for an embedded open-source effort. Some notable features:

  • A simple driver interface that separates the graphics logic from the physical interface to the display.
  • Input interfaces for touch controllers, encoders and buttons.
  • A simulator to run code on PC.

You can find demonstrations here that run in a web browser. While I certainly enjoy developing my own bespoke graphics library, LVGL is quite impressive in its documentation and features.

To kick the proverbial tires, I put together a simple demonstration using the available I/O on the MiniMonkey. Since the MiniMonkey has a MEMs microphone, constructing a simple audio VU meter using the LVGL gauge widget would be an effective demonstration.

A classic analog VU meter.

Creating an LVGL Driver

Since I already had code to initialize my IPS display and the microphone on the MiniMonkey, all I needed to do was write a simple driver layer for LVGL. The task was simplified as LVGL is built into MCUXpresso SDK and there is an example for the LPC55S69 using FreeRTOS or a bare metal environment.

I generally prefer to pull in code directly from the GitHub repositories, but using the version from the MCUXpresso SDK was a useful starting point to observe a basic LVGL port. Once you bring the LVGL source tree into your project, porting to a new display is straightforward. In the MCUXpresso example, a file littlevgl_support.c is provided as an example.

In addition to the driver interface code, you need to provide some configuration in lv_conf.h to enable/disable features in LVGL.

Updating lv_conf.h

Since I was familiar with the interface to the MiniMonkey IPS display through previous development with my own graphics library, I was able to get the SDK example ported in about 30 minutes. LVGL provides a “demo widgets” example which shows how to instantiate some common user interface widgets. I used this as a starting point to verify that I had things ported OK.

The LPC55S69 has plenty of RAM for LVGL’s working buffer. LVGL recommends a 1/10 screen sized buffer but you could provide a 1:1 sized back buffer with the large amount of RAM in the LPC55S69.




Engage
jack in