Microchip Graphics Suite (MGS) Web Simulator
Introduction
The Microchip Graphics Suite (MGS) Harmony Composer helps application developers easily design the GFX UI and along with MPLAB® Code Configurator (MCC), generates the required MPLAB Harmony code. Subsequently, the application code required to control the behavior is developed and debugged on the target.
Microchip offers two useful tools to help ease and expedite the entire process:
- MGS Harmony Web Simulator (Beta Trial)
- MGS Harmony Desktop Emulator (Available in April 2024)
The benefits of utilizing these tools for creating your graphical application, rather than coding for the intended platform directly, include the following:
- Begin developing your application before hardware (target and debugger) procurement.
- Flashing the code to the target could be time-consuming, therefore the tool helps save time.
- Porting the simulator project to the actual target is trivial. Design once and use on multiple targets.
- Sharing the Simulator/Emulator Output with peers is easy. Because there is no reliance on specific hardware, peers can easily interact with the application and provide feedback.
This guide shows how to develop a graphical application using the MGS Harmony Web Simulator and easily port it to the desired target.
Required Hardware and Software
For the purpose of this training, the required hardware are as follows:
- EV40E67A SAM9X60 Curiosity Development Board.
- A Micro-USB cable to power the board.
- High-Performance WVGA Display Module with maXTouch®.
- External Segger JTAG debugger such as J32 Debug Probe.
The required software is as follows:
Description of Example Application
For the purpose of this training, we will develop an EV Charger example application whose GFX UI and behavior are described below.
- From the first screen displaying the "Please plug your car" message, pressing the red power button launches the charging screen with the charge cable animation.
- Pressing the + and - buttons beside the battery increases/decreases the battery percentage and changes the string for output power, charge time, etc.
- If 100% battery charge is reached, "Battery Fully Charged" is displayed. Pressing the green power button reverts to the first screen.
- From Screen 2, on a 10-second idle time, the "Charging..." screen is displayed. Pressing anywhere on the screen reverts to the charging (second) screen.
Getting Started with the Application
In this section, we will learn how to use the MPLAB X IDE to create the EV Charger example application.
Create an MCC Project
We start by creating an MCC project.
Build the Project Graph
Next, we will build the Project Graph by adding the necessary resources and configuring them. For this example, we build the project graph as explained in the following steps.
Optionally, for Webpage Options, unselect Bezel and Responsive.
Similarly, right-click on the yellow diamond for LE Display Driver and choose gfx_canvas.
Select Graphics Canvas from the project graph. Right-click on the yellow diamond for LE Display Driver and choose gfx_legato. From the Configuration Options, set the number of Canvas Objects to 3 and their width, height, color mode, and frame buffer allocation.
The final Project Graph should look as shown in the accompanying image.
Designing GUI with MGS Harmony Composer
With the MCC project created and the project graph ready, we will finally design the GUI using MGS Harmony Composer. For the purpose of this training, we will use a pre-made design.
From the Project Graph Plugins drop-down menu, launch Microchip Graphics Composer.
This will automatically launch the project design as shown in the accompanying image.
Application Code - Example
The EV Charger example application can be downloaded from GitHub.
Copy the app.c and app.h file to your project.
MGS Harmony Web Simulator - Installation and Usage
In this section, we will learn how to install and run the simulator. The output of the Graphics application is viewed on a web browser.
MGS Harmony Web Simulator installation
Download the
and unzip it to a location on your PC. Run the installer wizard. The Simulator will be installed in C:\Users\<USER>\AppData\Local by default. You may choose to create a desktop shortcut which is done by default.Using the MGS Harmony Web Simulator
To run the GFX demo application on the simulator, follow the tutorial steps:
Launch the MGS Harmony Web Simulator installed in the C:\Users\<USER>\AppData\Local folder or use the desktop shortcut (if selected during installation).
Click Open and choose the lcdc_rgba888_mxt_9x60_wvga.mgsws file in the EVCharger\firmware\src\config\lcdc_rgba888_mxt_9x60_wvga folder generated by MCC as explained in the "Designing GUI with MGS MPLAB Harmony Composer" section.
An SDK is required to use the Simulator which is installed on the first build.
Click on the Build button.
The simulator will launch the SDK Manager and prompt you to download the required SDK.
Click on the SDK to select it, and click Download.
The SDK will be downloaded and extracted to the C:\Users\,USER>\AppData\Roaming\com.microchip.mgsws folder.
With the SDK installed, we are ready to build the project. Import the application file and click Build as shown in the accompanying graphic.
On a successful build, you should see an output as shown in the accompanying image, including a link to the generated HTML file. Click on the link (highlighted) to launch the MGS Harmony Web Simulator output on your default web browser.
MGS Harmony Web Simulator Output
To interact with the MGS Harmony Web Simulator output:
- Click on the red and green power button.
- Click on the + and - buttons next to the battery and observe the changes.
- From the charging screen (with the animated power cable) on a 10-second idle time, the Charging screen is launched. Observe the Microchip logo animation.
- Click anywhere on the screen to revert to the charging screen.
Porting to the Target
Porting the MGS Harmony Web Simulator project to the target is quite trivial. A simple method is described in the following steps.
Launch MCC and make changes to the project graph as described in the following instructions.
Include Graphics Canvas to the project graph.
Select LE LCDC Driver from the project graph and then from Configuration Options, select Canvas Mode.
Select Graphics Canvas from the project graph and from the Configuration Options, set the Canvas Objects to 3, and set their values as shown in the accompanying image.
Copy the design files from the MGS Simulator project to the Legato Quickstart project at the following location: legato_quickstart\firmware\src\config\lcdc_rgba8888_mxt_9x60_cu_wvga
and rename it to "lcdc_rgba8888_mxt_9x60_cu_wvga_design".
Connect the WVGA display and the JTAG debugger to the SAM9X60 Curiosity board. Power the board, download and debug the project on the target.