Getting Started With Embedded Wizard GUI Application Development With MPLAB® X IDE

Last modified by Microchip on 2025/10/09 13:56

Introduction

This training module will guide you through the process of integrating Embedded Wizard project-generated code and its platform package into a FreeRTOS®-based MPLAB® X IDE project using the SAM9X60 Curiosity development board. You will also learn the step-by-step procedure to add graphics library for the High-Performance WVGA LCD Display Module with maXTouch® Technology within the MPLAB X IDE environment.

By the end of this module, you will have a working understanding of how to combine GUI applications developed in Embedded Wizard with a FreeRTOS-based project in MPLAB X IDE, and how to enable display output on a WVGA LCD Display Module using the SAM9X60 Curiosity Development Board. The application used here is a graphics accelerator, which displays the CPU load and frames per second (FPS) on the screen.

This document is divided into five sections:

  1. Develop an MPLAB Harmony Application and Add WVGA LCD Display Module to the Project
  2. Develop an Application Using Embedded Wizard
  3. Integrate Embedded Wizard Generated Code to an MPLAB Harmony Application
  4. Debug and Test
  5. Running the Pre-built MPLAB Harmony Application From an SD Card

Hardware Used

  1. SAM9X60 Curiosity Development Board.
  2. High-Performance WVGA LCD Display Module with maXTouch ® Technology
  3. microSD™ card

Software/Tools Used

Refer to the project manifest located in the firmware/src/config/lcdc_rgba8888_mxt_9x60_wvga project folder for the MPLAB X IDE, MCC, and libraries version.

Hardware Setup

  • Connect the ribbon cable from the display to the J13 connector of the SAM9X60 Curiosity Development Board.
  • Power up the board by connecting the USB cable to the USB port J1 on the SAM9X60 Curiosity Development Board.
  • Connect the serial UART cable to J11.
  • Connect the MPLAB PICkit™ 5 in-circuit debugger to J12.
    Hardware Setup

Develop an MPLAB Harmony Application and Add WVGA LCD Display Module to the Project

Launch MPLAB X IDE.


Create a new project by clicking the New Project icon New Project icon or by selecting File > New Project.


In the New Project window, under Projects, choose Application Project(s). and click Next.
New Project

Back to Top


In the Select Device dialog pane, fill in or select the following information:

  • Family: 32-bit MCUs and MPUs (PIC32C/SAM)
  • Device : SAM9X60D1G
    Device Selection

Back to Top


In the Select Compiler pane, for Compiler Toolchains select XC32, and click Next.
Select Compiler

Back to Top


Enter Project Location, Project Folder and Project Name, then click Finish.
Project Details

Back to Top


From main menu, click on Tools > Embedded > MPLAB Code Configurator or click the MCC button in the MPLAB X IDE tool bar. It will launch MCC Content Manger Wizard. Click Select MPLAB Harmony.
Launch MCC

Back to Top


In addition to the required packages, download the optional packages gfx_apps_sam9x60, bsp, csp, core, gfx, dev_packs and then click Finish. Content download will take some time. Wait till all the contents are downloaded.
MCC download required packages

Back to Top


The project graph will be displayed. From Device Resources add Board Support Packages for SAM9X60 Curiosity BSP to Project Graph.

Now add the RTC and DBGU peripherals to the project graph. The RTC library will be used by Embedded Wizard to set and read time from RTC.Device Resource

Back to Top


From Device Resources under Graphics > Templates, add Legato Graphics w/PDA TM5000 Display to Project Graph. You will be prompted to allow auto-connection and auto-activation of several components; for all except FreeRTOS, click Yes.

Choosing the Legato Graphics w/PDA TM5000 Display template automatically populates rest of the project components. This can be seen in the way the project graph is set up and connected.

Added Graphics package

Back to Top


To add FreeRTOS to the Project Graph, go to Third Party Libraries > RTOS > FreeRTOS. You will be prompted to allow auto-connection and auto-activation of PIT. Click on Yes. This will automatically create FreeRTOS Tasks which can be found in tasks.c.

Note that TCO is used as the system timer as shown in the project graph in the accompanying image.
Add FreeRTOS

Back to Top


Remove Legato from the Project Graph as Embedded Wizard is used as the GUI to create graphics in this example.
See the "Graphics Getting Started Application on SAM9X60 Curiosity Development Board" page to learn how to create a graphics application using Microchip Graphics Suite on the SAM9X60 Curiosity Development Board.
Remove Leagto

Back to Top


In the Project Graph, click on FLEXCOM6. In the Configuration Options window, select clock speed as 100,000 (100KHz).

Flexcom Clock Frequency

Back to Top


In the Project Graph, click on LE LCDC Driver. In the Configuration Options window, select Output Color Mode as 18 BPP, enable only the Base Layer and enable the Canvas mode.
Display config

 

Back to Top


From the Project Graph tab, select Pin Configuration from the Plugins menu.

Pin Configurations

Back to Top


You can see that PA30 and PA31 are set to FLEXCOM6. Enable pullups for those pins. Ensure all the pins are configured as shown:

Pin Configs

Back to Top


Save all and then click the Generate button. This will generate code for all the peripherals that have been added in the project graph.
Project Graph

 

Back to Top


With FreeRTOS, the CPU load can be measured by using run-time counter for the Idle task.

The corresponding FreeRTOS configuration needed to enable run time statistics using FreeRTOS is added in FreeRTOSConfig.h file. 

configGENERATE_RUN_TIME_STATS and INCLUDE_xTaskGetIdleTaskHandle must both be defined as 1 for this feature to be available.

Enable RunTime Statics

Note that a high precision timer, TC0, is used in this example to measure the run time statics. The corresponding timer configurations are added in FreeRTOSConfig.h as shown:

FreeRTOS Configurations

Back to Top


The definition of RTOS_AppConfigureTimerForRuntimeStats() is available in app.c. TCO timer is used as system timer.
FreeRTOS Run Time Statistics definition

Back to Top


The CPU load can be increased or decreased by inserting a delay in lAPP_Tasks in task.c as shown:
App Task Periodicity
By default, no delay is added in lApp_Tasks(), so the CPU is 100% loaded. You can add the delay to modify the CPU load of app_task.

Back to Top


Now clean and build the project. This completes configuring the peripherals and code changes required for developing the graphics application.

Back to Top

Develop an Application Using Embedded Wizard

Information

If you are new to Embedded Wizard, we recommend reviewing the official documentation or introductory tutorials.

This section assumes you have prior experience with Embedded Wizard GUI development. It is intended for developers who are already familiar with the basic concepts, tools, and workflow involved in creating graphical user interfaces using Embedded Wizard. The content will build upon that foundational knowledge, focusing on more advanced features, best practices or platform-specific implementations.

Download Embedded Wizard for the target platform, Microchip's SAM9X75 Curiosity LAN Kit.Download Embedded Wizard

Back to Top


Download the Embedded Wizard Build Environment for SAM9X75-Curiosity-WVGA.
Embedded Wizard Build Environment

 

Back to Top


Now launch Embedded Wizard and create a new project with the following settings:

SAM9 WVGA Configuration

Back to Top


Follow "Quick Tour - a Tutorial" to learn how to develop a Embedded Wizard-based GUI application.

See the SAM9X75 Graphics Accelerator GUI project developed using Embedded Wizard or other example applications for the WVGA display in GitHub®.

This application is a benchmark to compare the FPS and CPU load by testing the following basic operations: Rectangle Copy, Bitmap Copy, Rectangle Blend, Bitmap Blend and Alpha8 Blend.

The simulation output on the Embedded Wizard is as shown:
Simulation

Back to Top


After completing the creation of the GUI application, generate code to the directory ../../../Application/GeneratedCode.

Embedded Wizard CodeGeneration

This completes the code generation for an GUI application from the Embedded Wizard GUI.

Back to Top

Integrate Embedded Wizard Generated Code to an MPLAB Harmony Application

The next step is to add Embedded Wizard platform packages and generated code to the MPLAB X IDE. To do this, first download the Embedded Wizard Build Environment for SAM9X75-Curiosity-WVGA

Embedded Wizard Build Environment for SAM9X75-Curiosity-WVGA download

Unzip it and find the platform packages in the following directory:
Build Environment

Information

The build environment given in the Embedded Wizard website for Embedded Wizard V14.04 is based on the LVDS WVGA display.

Back to Top


The customized Embedded Wizard build environment for the High-Performance WVGA LCD Display Module with maXTouch Technology and for SAM9X60 Curiosity development board is located in the Embedded_Wizard folder, which contains four sub-folders. 

Build Environment for WVGA

 

The Application folder has two sub-folders: 

  • GeneratedCode: This folder is used to receive the generated code from the thermostat Embedded Wizard UI project.
  • Source: This folder contains the main.c and ewmain.c files. There you will find the initialization of the system and the main loop to drive an Embedded Wizard GUI application. The ewconfig.h file contains general configuration settings for the target display and the system.
Information

The ewconfig.h file in the Source folder has configurations for the High-Performance WVGA LCD Display Module with maXTouch technology.

The DeviceDriver.c file in the Source folder has the device integration source code required for the graphics accelerator source code.

The PlatformPackage folder contains the necessary source codes and/or libraries of the SAM9 Platform Package with the color format RGBA8888 and the Runtime Environment.

The TargetSpecific folder contains all configuration files and platform-specific (board support package - Microchip hardware drivers) source codes for SAM9X60.

Information

PlatformPackage is the same as the build environment downloaded from the previous step.

It is recommended to use the latest PlatformPackage for SAM9 MPUs from the Embedded Wizard website.

The Examples\800x480\GraphicsAccelerator folder contains the Graphics Accelerator GUI Embedded Wizard project.

Back to Top


Now, add Embedded_Wizard build environment to MPLAB X IDE. First, add the header files. To do this, go to Projects > Header Files > Add Existing Items from Folders. Select the Embedded_Wizard folder and choose Header Files (.h) files in the search pane.
Add Header
Similarly, add the source files from this folder. To do this, go to Projects > Header Files > Add Existing Items from Folders. Select the Embedded_Wizard folder  and choose C Source Files (.c) files in the search pane.
Add Source Files
Link the Embedded Wizard EWRTE (Embedded Wizard Run Time Engine - libewrte.a) and EWGFX (Embedded Wizard Graphics - libewgfx.a) libraries. Go to Projects > Libraries > Add Library/Object File and then choose libewrte.a and libewgfx.a from the PlatformPackage folder.

Add Libraries

Back to Top


If you see a path-related error, for example:

  • Unable to find Embedded Wizard related include paths

Then add the include directories as shown:
Add Include directories

Back to Top


Write an application, app.c, in such a way that once the LCDC is initialized, the GUI gets fired up with a call to ew_init(), the graphics and interface keep updating regularly through the ew_process() function, and the app_display_callback from the Embedded Wizard project should update . Sample application files​  are available.
Application file

Back to Top


To synchronize the frame rate of a graphics output from Embedded Wizard with the refresh rate of the LCDC, Start of Frame (SOF) interrupt is used.

To enable SOF interrupt, an interrupt call back is defined in app.c, and  can be seen in the screen shot of the previous step (Step 5) and its handler is written in ew_bsp_display.c as shown:

SOF Interrupt Handler

A modification in an interrupt handler for LCDC driver is required to service Start Of Frame(SOF) interrupt via the LCDC interrupt call back. To do this, comment out the "Layer Lock Pending" conditional check in LCDC interrupt handler _IntHandlerLayerReadComplete() in drv_gfx_lcdc.c.c file as shown below:
IRQ Callback

Back to Top


The CPU load measurement used in the Embedded Wizard GUI application project, which will be displayed on the WVGA display, is available in ew_bsp_os.c as follows:
CPU Load Measurement

Note that the macro "FREERTOS" should be defined in the definition.h file to enable the CPU load calculation used in the Embedded Wizard GUI application.
#define FREERTOS

​​​​

Back to Top


Now clean and build the project. This completes the integration of the Embedded Wizard GUI developed into MPLAB Harmony project.​​​​​

Back to Top

Debug and Test

Configure project properties for debugging in MPLAB X IDE using MPLAB® PICkit™ 5 In-Circuit Debugger. To do this, in the Projects pane, right-click on the project and select Properties from the menu. 

In this example, we use the MPLAB PICkit™ 5 In-Circuit Debugger (ICD) with Debugger Adapter Board

For the MPLAB PICkit 5 ICD to operate correctly, SAM9X6_DFP version 1.8.210 or higher is required. 

Compiler settingsClick on the Apply button. Observe under Categories > Conf: [default], that PICkit 5 and  Bootstrap are now listed. 

Back to Top


In the Categories pane, select PICkit 5. In the Option categories drop down box, select Communications. Change JTAG Speed to 4.000 MHz.  

Debugger Settings

Back to Top


In the Categories pane, select Bootstrap. Observe that Use bootstrap is selected and the pre-compiled version of the at91bootstrap.elf is selected. A precompiled at91bootstrap.elf   is available.

at91bootstrap is a second-stage bootloader for Microchip Technology Arm®-based microprocessors (MPU). For more information see the “at91bootstrap: A Second Stage Bootloader for Microchip MPUs” page. 

Bootstrap

Back to Top


To create BIN file from an ELF file in MPLAB X IDE, use the following command when MPLAB complete building an elf:

${MP_CC_DIR}/xc32-objcopy -O binary ${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.elf ${DISTDIR}/harmony.bin
Build Binary

Back to Top


Power the SAM9X60-Curiosity by connecting a USB Micro-B connector to the USB-A Connector (J1) and the host computer, or a suitable USB power source. For more information see the “Power Options” section of the “SAM9X60-Curiosity - Features” page.

Press the START and then the RESET push button (SW1)

Back to Top


Now clean and build the project. The resultant application binary files can be seen in <project_path>\dist\default\debug  as shown in the accompanying image:

Build Output

Back to Top


Click on the Debug Project icon on the toolbar.

Debug

You can view the debugging messages on the serial console. For more information on establishing serial communications with the target console see the "SAM9X60 Curiosity Development Board - Console Serial Communications" page.

Console: Application Booting

Back to Top


Press Run, it will display the graphics accelerator application on the display connected with SAM9X60 Curiosity development board.

Debugging an application

 

Running the Pre-built MPLAB Harmony Application From an SD Card

The pre-built application BIN file can be programmed by following these steps:

Program the BIN File on SD Card

Take a microSD card formatted with the FAT32 file system.


Copy the boot.bin and harmony.bin files to the microSD card using the PC.


Insert the SD card to J3 on the SAM9X60 Curiosity Development Board.

Run the BIN File From SD Card

Press the START and then the Reset button. It will display the graphics accelerator application on the display connected with SAM9X60 Curiosity Development Board.
Running an application

Summary

In this training, you developed, configured and built an Embedded Wizard-based MPLAB Harmony graphics application using the SAM9X60 Curiosity Development Board.

Back to Top

Learn More

Back to Top