PIC32MZ DA User Guide for Microchip Graphics Suite (MGS) Harmony

Last modified by Microchip on 2024/05/28 10:57

Introduction

The PIC32MZ DA is a family of microcontrollers based on the MIPS32® microAptiv™ core that are notable for their integrated graphics capabilities, which include a Graphics Processing Unit (GPU) and a Display Controller. This makes them particularly suitable for applications that require rich graphical user interfaces, such as home automation systems, industrial control panels, and medical devices.

Getting Started

Development Kit

The PIC32MZ DA Curiosity Development Kit and displays are supported in Microchip Graphics Suite (MGS) Harmony.

PIC32MZ DA Development Kits

You will find more information about these kits on the pages listed in the table:

Development BoardsSupported Displays

Hardware Setup

The PIC32MZ DA Curiosity Development Kit comes with the 24-bit passthrough graphics card. This graphics card can be used to connect either the 4.3" WQVGA or the 5" WVGA displays. 

S1 switch on the graphics card must be set to position 1 for use with the PIC32MZ DA Curiosity Development Kit.

To connect the display to the development board:

Disconnect the flat cable from the J2 connector on the MEB adapter board.

Disconnect ribbon cable
 


Connect the free end of the cable to the 24-bit passthrough graphics card as shown.

Connect ribbon cable
 

Back to Top

Application Examples

Use the application Quickstart examples to start developing an embedded Graphical User Interface (GUI) project on the PIC32MZ DA Curiosity Development Kit. These examples are published on the GFX applications Github repository.

Use the MPLAB® Code Configurator (MCC) Content Manager to download these examples or clone/download directly from the GitHub repository

Legato Quickstart Applications

Legato Quickstart provides a good starting point for GUI development with MGS Harmony Graphics.

To get started, build and program the appropriate Legato Quickstart project based on the display module being used and the preferred color mode. Refer to the application documentation for details on how to run it.

Display ModuleMGS Harmony Graphics
High-Performance 4.3" WQVGA Display Module with maXTouch Technology (AC320005-4)
High-Performance 5" WVGA LCD Display Module with maXTouch Technology (AC320005-5)

Back to Top

Project Configuration

Here's a typical project graph for a PIC32MZ DA MGS Harmony project.

PIC32MZ DA MCC Harmony Project Graph

Back to Top

Display Components

Display Module

The Display Module component provides display-specific information like resolution and display timing.

For PIC32MZ DA Development Kits, examples of Display Module components are the PDATM5000, PDA TM4301 for the 5.0 WVGA and the 4.3" WQVGA displays. 

GFX Core LE

GFX Core LE shows the display information provided by the Display Module in the project graph.

For customer boards using third-party display modules, display parameters and timing information can be user-specified in the GFX Core LE component.

Refer to the "Microchip Graphics Suite (MGS) Display Timing Guide" page for more information.

GFX Core LE Component

This timing information will be generated in the GLCD display controller driver to configure the GLCD  peripheral.

LE GLCD

The GLCD component provides configuration options for the GLCD display controller driver.

LE GLCD MCC Harmony Component

Clock Settings
Pixel Clock DividerSets the GLCD clock divider to change the pixel clock frequency.
Layer Configuration
Enable Advanced Layer Configuration

Enables per-layer configuration like position, size, color mode, etc.

Enable LayersEnables the HW layers in the GLCD. 

 By default, all the layers will be configured to the same resolution, position, and frame buffer color mode.

In the default configuration with frame buffers in DDR, the GLCD driver will reserve its frame buffers in DDR region 0xA800_0000 to 0xA88C_9FFF. 

If each layer needs to be configured differently, enabling Advanced Layer Configuration will allow user-specified size, position, frame buffer color mode, and base addresses. Base addresses are set using the KSEG1 (non-cacheable) address.

GLCD Advanced Layer Configuration

Frame Buffer Settings
Frame Buffer Color ModeSets the default color mode for the frame buffers for all the GLCD HW layers, if advanced layer configuration is not enabled.
Use Double BufferingEnables double buffering which can help avoid screen tearing. 
Frame Buffer Memory ModeSets the RAM used to store the frame buffers. 
Use 8-bit Palette?

Configures the GLCD layers to LUT8 mode. LUT8 mode uses a global color palette to reduce frame buffer size.

Refer to Legato Climate Control application for an example.

Other Settings
Update On VBlankWhen checked, the GLCD driver will configure the GLCD registers only during the VBLANK period. This avoids display glitches when configuring the GLCD at run-time.
Canvas ModeThis needs to be checked if using the GFX Canvas.
Use GPU for BlitsWhen checked, the GLCD driver will use the GPU to copy the scratch buffer to the frame buffer. Using the GPU can accelerate frame buffer updates.
Blit on VBlank

When checked GPU scratch buffer blits will be performed during the VBLANK period.

GPU Component

LE 2DGPU

The LE 2D GPU component enables the 2D GPU (Nano2D). The 2D GPU can be used to accelerate certain graphics functions like fills, scratch buffer copy, and advanced functions like pre-processed image blits.

Back to Top

Designing the GUI with MGS Harmony

To start designing the GUI on the PIC32MZ DA development kits, it is recommended that the Legato Quickstart application be used as the starting project. 

Refer to the MGS Harmony User Guide for information on how to use the MGS Composer and MGS Harmony Widgets to design the GUI.

Back to Top

Optimizing the GUI Design

For general guidelines on how to optimize the GUI design for improved performance or memory/flash usage refer to this "Optimizing a Microchip Graphics Suite (MGS) Harmony Project" page.

For advanced usage and optimization on the PIC32MZ DA, check out the "PIC32MZ DA User Guide for Microchip Graphics Suite (MGS) Harmony" page.

Back to Top

How-To Guides

Image Preprocessing

Image processing is a feature in MGS Harmony that facilitates the efficient storage of compressed images in flash memory, which are subsequently decompressed to Random Access Memory (RAM) upon system startup.

On the PIC32MZ DA, compressed images in flash can be pre-decoded to the integrated DRAM for faster rendering.

If the GPU is enabled, size the pre-processed source image files so that they are x8 pixels wide.

This enables the library to use the GPU to accelerate the drawing of these images to the frame buffer.

Back to Top

Use Layers and HW Overlays

Using layers to separate UI components uses the HW overlay features of the PIC32MZ DA's integrated display controller and enables users to design complex GUIs and UI functions while minimizing the processing load on the main CPU.

Enabling more layers increases the memory and bus/memory bandwidth needed to refresh the display. Depending on the UI design and other peripherals accessing the memory, there may not be enough bandwidth to refresh the display at the required rate and can cause display corruption.

If this occurs, see the "Troubleshooting Guide" section.

Back to Top

Use the Graphics Canvas

The Graphics Canvas is a middleware in MGS that enables users to easily leverage the HW features of the integrated display controllers in Microchip's graphics-enabled MCUs and MPUs. These features can be used to perform complex GUI effects without loading the CPU, including effects like sliding, fading, screen pre-rendering, and sprite animations.

Application ExampleDescription
Legato Dashboard

This demo uses the Graphics Canvas to show sliding screens and rotating gauge needles.

Legato Climate Control

This demo uses the Graphics Canvas to show multi-layer WVGA graphics using internal SRAM only without the need for DDR memory. The library uses 8-bit index frame data to draw on a scratch buffer in internal SRAM. 

Back to Top

Use External Flash Memory

External flash memory like QSPI, NOR, and SQI™ flash can be used to store graphics assets like images and fonts. These are useful when using large amounts of images or multi-language fonts. Refer to the following example applications on how to configure an MGS Harmony project with external resources.

Application ExampleDescription
Legato External ResourcesThis project showcases how the MGS Harmony can be used to package images and font glyphs to be stored in external non-volatile memory, specifically a QSPI, NOR, and SQI™ flash.
Legato Quickstart External Resources

This demonstration shows how to use the Legato Graphics Library to retrieve externally stored assets.

Back to Top

Control the display backlight

The PIC32MZ DA can be used to control the display backlight, enabling features like display fade in/out, dimming for power save mode, etc.

On the PIC32MZ DA Curiosity board, the display backlight can be controlled by using the OCMP1 and TMR2 peripherals to generate the PWM backlight signal.

The OCMP1 and TMR2 components are added and configured in the MCC Harmony project as follows.

OCMP1 and TMR2 component configuration

In the MCC Harmony Pin Settings, pin RD0 is set to OC1 function to generate the Pulse-Width Modulation (PWM) backlight signal to the display.

OC1 pin configuration

The PWM duty cycle is set by calling the OCMP1_CompareSecondaryValueSet() peripheral library API.

For project examples and code usage, check out the Legato Dashboard and Legato Climate Control applications.

Back to Top

Use a Third-party Display

Third-party displays may be used with the PIC32MZ DA Curiosity Development board using the GFX Proto board for Curiosity (EV48R50A). The GFX Proto board enables users to solder the appropriate cable connector for the display and route the display signals to the PIC32MZ DA Curiosity board. Refer to the "Graphics Prototype Board for Curiosity Boards User Guide" for more information.

For instructions on how to adjust the display timing, refer to "Microchip Graphics Suite (MGS) Display Timing Guide".

Back to Top

Troubleshooting Guide

 Issue  Things to check 
Blank display
  • Check the signals to the display. The 24-bit passthrough graphics card has test points to probe the PCLK, VSYNC, HSYNC, DE, and display backlight (PWM) signals.
  • Make sure that the flat cable is properly inserted into the graphics card.
  • Make sure enough power is provided to the board to drive the display. Use a power supply via J300 if needed.
Screen corruption when updating
  • If using Advanced Layer Configuration, make sure that the user-specified frame buffer addresses are in KSEG1 (non-cacheable).
  • If the screen corruption is related to bandwidth, reduce GLCD bandwidth requirements by
    • Slowing the pixel clock to minimum display requirement.
    • Using less layers.
    • Using smaller layer sizes - size the upper layers only to the visible section.
    • Change layer and project color mode to less bit depth (RGB565).

Back to Top