Lab 6 - How to Integrate an Embedded Wizard GUI Project With an MPLAB® X IDE Project

Last modified by Microchip on 2025/07/07 15:16

Introduction

This training module will guide you through the process of integrating Embedded Wizard project-generated code and its platform package into an MPLAB® X IDE project using the SAM9X75 Curiosity Wireless Kit . You will also learn the step-by-step procedure to add support for the Waveshare® 4-inch MIPI® round display within the MPLAB X IDE environment.

This document presents the final lab, showcasing the development of a full-fledged IoT application.

By the end of this module, you will have a working understanding of how to combine GUI applications developed in Embedded Wizard with a bare metal firmware project in MPLAB X IDE, and how to enable display output on a Waveshare 4-inch MIPI DSI® display using the SAM9X75 Curiosity Development Board.

This document is divided into three sections:

  1. Steps to develop an IoT Thermostat application using Embedded Wizard
  2. Add Waveshare display to the project graph and develop an MPLAB® Harmony Application
  3. Integrate Embedded Wizard generated code to an MPLAB Harmony application

Back to top

Prerequisites

Follow these steps:

Develop an IoT Thermostat Application Using Embedded Wizard

Information

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

This section assumes that the reader has 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 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:

New Embedded Wizard project

 

Back to Top


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

Refer to SAM9X75 thermostat IoT application GUI developed using Embedded Wizard.

This application is designed in such a way that:

  • The display will update every 10 seconds with the real-time temperature and humidity value read from Temp&Hum 13 Click board™ sensor.
  • You can increase/decrease the brightness of the display.
  • You can change the Mode of the Thermostat to HOT/COOL/OFF.
  • Wi-Fi/Bluetooth communication can be enabled/disabled from the display.
  • You can control the Mode of the Thermostat and get Status of the Thermostat via Bluetooth/Wi-Fi using MQTT.

Embedded Wizard IoT project

The simulation output on the Embedded Wizard is as shown below:
Embedded Wizard IoT Simulaion

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 of the thermostat IoT application from the Embedded Wizard GUI.

Back to Top

Add Waveshare 4-inch MIPI round LCD to the Project Graph and Develop an MPLAB Harmony Application

Follow all the labs under the "Prerequisites" section and ensure that all the components required were added to the project graph and corresponding code is generated.

​​​​

Back to Top


The next step is to add the Waveshare 4-inch MIPI round display to the project graph. To do this, from Device Resources, expand Graphics > Displays and select Waveshare 4inch DSI Round LCD.

Select Yes to the pop-up asking for Input System Service component auto activation.

Project graph

Back to Top


Add the dependency for the Waveshare 4-inch DSI Round LCD as follows:

Add the DSI Display dependency from the Available Consumers as DSI (gfx_bridge_dsi_plib

Add the DSI peripheral library (DPI) dependency from Available Consumers as LE XLCDC Driver

Add an extra instance for I2C.

Verify that the extra I2C driver instance was created. 

Add Instance 1 of the I2C dependency from Active Consumer to Waveshare 4inch DSI Round LCD.

Project graph dependency

Back to Top


From the SAM9X75 Curiosity development board user guide, observe that DSI is interfaced via FLEXCOM6.
Schematics

Back to Top


Now add the dependency for the Instance 1 of I2C as FLEXCOM 6 (flexcom6) as shown:
Add FLEXCOM6

Back to Top


Now add RTC peripheral and GFX2D peripheral to the project graph. Graphics2D accelerator will be used by Embedded Wizard while rendering the images and the RTC library will be used by Embedded Wizard to set and read time from RTC.
​​​​​​

Also, add the dependency of the GFX2D peripheral library to the LE GFX2D Graphics Processor. This completes the creation of the project graph for the SAM9X75 IoT Thermostat application.

Add RTC and GPU

Back to Top


Add the pin configurations. To do this, go to Project Graph > Plugins > Pin Configuration.
Pin Config

Back to Top


Configure the pins as follows:

  • PA24 --> DSI_TWD   --> FLEXCOM6_IO0
  • PB16 --> DSI_TWC   --> FLEXCOM6_IO1

Pin Configuration

Back to Top


Verify the settings under Waveshare 4inch DSI Round LCD as follows:LCD Config

Back to Top


For LEXLCDC driver, perform the following configuration.

  • Check the Enable Backlight PWM box.
  • Enable only the Base Layer (this application uses only one hardware layer with Embedded Wizard).
  • Check the Canvas Mode and Enable Interrupts boxes.
  • Set the GCLK Clock, Source, as PLLA/2 and the Pixel Clock (HZ) as 50,000,000.

XLCDC Driver Config

Back to Top

Now, enable the Pattern Generator in the DSI Display configuration to ensure the display is working properly by displaying the pattern on the DSI display.

Now, generate the code by clicking the Generate button. Wait until the code generation is complete.
Enable Pattern Generator

Back to Top


Now, clean and build the application and debug it by following the steps outlined in Lab 7.

When you the run the application from MPLAB X IDE, you can observe the pattern being generated on the Waveshare 4-inch DSI round LCD.
Display output

Back to Top


Now, that you have verified the successful integration of the Waveshare 4-inch DSI round LCD with MPLAB X IDE, disable the Pattern Generator and generate the code.
Disable Pattern Generator
The next step is to integrate the Embedded Wizard platform package and generated code into MPLAB X IDE.

Back to Top

How to 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 Waveshare 4-inch round display is located in the Embedded_Wizard folder, which contains four sub-folders. 

Build Environment for round DSI LCD

  • Application - 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 system.
    Information

    The ewconfig.h file in the Source folder has configurations for the Waveshare 4-inch DSI LCD.

    The DeviceDriver.c file in the Source folder has the device integration source code required for the SAM9X75 thermostat IoT application.

    • PlatformPackage - This folder contains the necessary source codes and/or libraries of the SAM9 Platform Package with the color format RGBA8888 and the Runtime Environment.
    • TargetSpecific - This folder contains all configuration files and platform-specific (board support package - Microchip hardware drivers) source codes.
    Information

    PlatformPackage and TargetSpecific are the same as the build environment downloaded from the previous step.

    • Thermostat_IoT  - This folder contains the thermostat GUI Embedded Wizard project.
    Information

    It is recommended to download the latest Build Environment for the SAM9X75 Curiosity board from the Embedded Wizard website 

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 files to the project
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 to the project
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 to the project

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 path to the project

Back to Top


Add the application files, app_dsi.c, app_wincs02.c, app_rnbd.c, and temp_hum_13_click.c, for the SAM9X75 thermostat IoT application, to the MPLAB Harmony project. In the app_dsi.c file, notice 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.

Add source files to the project

Back to Top


Clean and build the code. (See the sample application files​ ​​​for reference.)

Back to Top


Follow the steps outlined in Lab 7 to debug the IoT thermostat application.

 

Back to Top


You can also opt to run the application from a microSD® card by following the steps mentioned in Lab 8.

 

Back to Top

Summary

In this training, you developed, configured and built an MPLAB Harmony v3 IoT application using the SAM9X75 IoT thermostat application.

Back to Top

Learn More

Back to Top