By Daniel Lizewski | Apr 29, 2019
In the world of smartphones and tablets, customers have high expectations when it comes to graphical user interfaces (GUIs). Customers expect swipe animations, blending, and smooth transitions. This can be very challenging for the average low cost, resource constrained embedded platform. Modern smartphones and tablets boast impressively powerful processors and GPUs specialized for their application. They are significantly more powerful than the average embedded platform, and can include expensive GPU or video processing units. In many applications, it’s not feasible to add a GPU to your embedded platform due to design restrictions around cost, size, power, or boot time. This article discusses some other options and best-practices when designing an embedded system with a GUI.
If cost and power budget can support it, then one option is to use an “embedded Linux” system on a chip (SOC). These provide significant processing power and usually contain an SOC with an integrated GPU. This type of design is best suited for high-end applications due to the significant cost of the SOC. They also increase the overall product cost due to complexity of PCB fabrication, assembly, and thermal management. Despite the high component cost, this option can save a significant amount of software development cost due to availability of libraries and tools.
The second option, better suited for high volume, low cost, fast boot or small footprint applications is to use a microcontroller with support for driving a display. Many modern microcontrollers include some form of video processing hardware acceleration and one or more dedicated outputs for driving a display. The exact performance, limitations and capabilities are usually processor-specific. The following items should be considered and leveraged when designing and implementing the product to meet requirements.
- Direct Memory Access (DMA). DMA is a simple, yet highly effective method of reducing CPU load and increasing overall system efficiency. A DMA controller can perform basic memory operations such as moving or copying from one area to another. This can free up the processor to perform other operations while the DMA operations are executed in parallel.
- Data Cache. Video frames are often drawn using a series of operations on the same memory region or object. Without data caching, each time the CPU needs to read or write to these areas, it must go directly to memory. In any computer system, memory access is relatively slow when compared to CPU instructions or registers. Data caching allows frequently visited memory addresses to be read or written in a much faster area of memory. Data is only sent or fetched from physical memory when it’s not valid in the cache. This significantly reduces the overall average processing time spent on memory operations. When using a data cache, it’s important to consider cache coherency. Any hardware peripheral with DMA will not go through the data cache, so it’s important that the data be appropriately flushed from the cache prior to starting a DMA operation.
- Avoid Memory Bus Contention. Video data requires relatively high memory bandwidth which may cause bottlenecks and effect overall system performance. If possible, dedicated video memory can be used to separate high-bandwidth video traffic from the remaining data. If not, then memory access priorities and rate limiting must be carefully managed to prevent memory starvation of any real-time process.
- Hardware Acceleration. Many microcontrollers capable of driving a display have some form of video hardware acceleration. This can vary from alpha blending, layering, colour conversions, or pixel transformations. This can vary based on the micro-controller, but if used correctly can deliver a significant increase in performance by reducing load on both the CPU and memory.
- Time-Memory Trade-offs. Visual effects such as shadows, rounded corners, blended objects, and dynamically sized fonts can cause a lot of strain on the CPU if hardware acceleration is not available. Depending on the design of the GUI, it’s possible to pre-render some of the heaviest computations and operations. These objects or images can then be stored in memory, ready for quick use. This can greatly improve overall system performance, but at the cost of memory. The software architect must therefore take the system’s parameters into consideration and make the best time-memory trade-off for the particular system and its target applications.
Using the methods and techniques discussed in the article, combined with proper system optimizations, a product designer can add a sophisticated touch-screen GUI to their embedded platform without adding a significant cost to their processor or microcontroller.
Contact Nuvation Engineering for your graphical user interface requirements.