emWin QuickStart on Multimedia Expansion Board II - automaate/GFX_sandbox GitHub Wiki
Summary
This topic describes the basic steps to create a graphics-enabled application from scratch using Multimedia Expansion Board II. It starts with a new MPLAB® project and finishes with a graphics application equivalent to emwin_quickstart.
Description
The emWin quickstart guide will use the GUIBuilder designer instead of the Aria graphics composer designer. GUIBuilder creates a layout from emWin widgets and generates a “resource array” into one or more .C files.
The instructions in this tutorial assume that you have already installed following software:
- MPLAB® X Integrated Development Environment v5.15 or later
- MPLAB® XC32/32++ C Compiler v2.20 or later
- MPLAB® Harmony 3 Configurator
The instructions also assume that you have acquired following hardware:
- Multimedia Expansion Board II
- Display Module (choose one)
- Standard USB A to micro-B cable.
Getting Started
To get started with this tutorial, you should:
- Install MHC.
- Configure hardware.
- Run MPLABX.
Install MHC
To install MHC, follow the Harmony V3 MHC installation guide. Upon completion, proceed to Configure Hardware steps below.
Configure Hardware
On the MEB II, the EBIWE and LCD_PCLK (J9) must be jumpered to use the internal SRAM for graphics frame buffer. The J9 jumper is located on the bottom of the MEB II board, beneath where the starter kit is plugged into the board. Refer to the following figure for the exact location.
Connect the PIC32MZ EF Starter Kit to the MEB II board
Configure the 4.3” WQVGA Display
- Disconnect the ribbon cable that connects the display to the interposer board. The board is for the MEB 2 only, and not used on the SAM E70 Xplained Ultra kit.
- Release the ribbon cable from the interposer board.
- Release the black clamp on the E70’s J2 connector and turn the display over.
- Insert the ribbon cable into J2 and close the clamp.
The board and display are powered by a Micro B – USB A cable from PC to the “Debug USB” port on the E70 board.
Run MPLABX
- Launch the MPLAB X IDE.
- From the File pull-down menu, select New Project. This will display the New Project dialog window.
- Proceed to Creating New Project Tutorial Steps
Creating New Project Tutorial Steps
Choose Project.
- In Categories: window, Click Microchip Embedded
- In Projects window, Click 32-bit MPLAB Harmony Project
- Click Next.
If 32-bit MPLAB Harmony Project is not visible repeat software installation steps Install MHC above.
Framework Selection.
- Set Framework Path: to your Harmony v3 root installation directory. This path is not set by default. You must enter the path used at installation.
- Select Convert to Relative Path for Configuration
- Click Next.
The Launch Framework Downloader button is used to download or configure a local framework. Because you have already installed H3, this button click is not required.
Project Settings.
- The Location: field is set by default, it is not recommended to change this setting for this tutorial.
- Set Folder: field to
pic32mzef_mebii
. This will be the name of the MPLAB X project folder configured for SAM E70. - Set Name: field to
my_quickstart
. This will be the name of your application displayed in MPLAB X. - Click Next.
Configuration Settings.
- Set Name: field to
mzef_mebii
. This will create a mzef_mebii folder for configuration settings. - Select for Device Family: drop down,
PIC32MZ
. - Select for Device Filter:
2048
. This optional step helps narrow the possible device target selections to only this family. - Select for Target Device: drop down,
PIC32MZ2048EFM144
. - Click Finish.
The selection of Target Device
ATSAME70Q21B
is required. The device name will enable the listing of the supported BSP specific for this board later in this tutorial. Using a different device may not give any selections for the BSP.
)
- When Finish is clicked, the following message may be displayed while the configuration database setup dialog is loaded.
Configuration Database Setup.
- Select the following packages to load into the project:
gfx
,core
, andbsp
. - Deselect all other packages.
- Click Launch.
- Launching MPLAB Harmony Configurator. The following message will be displayed while the project is loaded into MPLAB X.
- Initial Project Graph. The following will be displayed after project is loaded into MPLAB X.
Available Components BSP.
- Expand Board Support Packages (BSPs).
- Double-click PIC32MZ EF Starter Kit BSP component.
Available Components Template.
- Expand Graphics/Templates.
- Double-click the Aria Graphics w/ PDA TM4301B Display template component.
-
Several dialogs will be displayed during the process. When prompted to:
- "...activate these components?", select Yes.
- "...automatically make these connections?", select Yes.
- "...deactivate these components?", select Yes.
-
Deactivate. This emWin solution leverage much of the Aria hal, but not the Aria library. Remove Aria library from the Project Graph.
-
Deactivate. This emWin solution leverage much of the Aria hal, but not the Aria library. Remove Aria library from the Project Graph.
-
Activate. Add Aria Graphics Library to the Project Graph.
- Project Graph. The following will be displayed after all components are loaded into MPLAB X.
GUIBuilder
Copy the emwin_gui
folder, app.c
and app.h
file from the gfx/apps/emwin_quickstart
folder under your MPLAB Harmony release distribution. These files are required to render the appropriate UI screens.
Select Run Main Project. This button will build, program, and run the application.
UI Display
The following image should appear on the display:
Next Steps
- Learn more about emWin Tools: Bitmap Converter, Font Converter