QuickStart PIC32MZ DA Curiosity Development Kit - mchpgfx/legato.docs GitHub Wiki

Microchip Technology QuickStart PIC32MZ DA Curiosity Development Kit

This guide describes the basic steps to create a graphics-enabled application using the PIC32MZ DA Curiosity Development Kit connected to a WQVGA display.

What you will build

You will build a simple application that displays an image, text, and touch button. It starts with the creation of a new MPLAB® project and finishes with a graphics application equivalent to legato_quickstart.

What you will see

The demonstration will render the following image on the display:

Microchip Technology

Contents

The following bullets detail the steps necessary to create a solution for your board.

  • Get Materials
  • Create a new project
  • Configure Software with MHC
  • Create UI Design with Legato Composer
  • Save Project
  • Generate, Build, and Run

Get Materials

Before you begin this quick start, make sure you have what you will need. The Microchip development documentation and hardware provides a basic foundation that we will use as a reference for your PIC32MZ DA design.

Documentation Description
PIC32MZ DA Curiosity User Guide User Guide with Schematics
Hardware Description
PIC32MZ DA Curiosity Development Kit connected to a WQVGA Development Board
WQVGA Display Module (AC320005-4). High-Performance 4.3" WQVGA Display Module
Standard USB A to micro-B cable PC debugging connector.

NOTE: The PIC32MZ DA Curiosity Development Kit includes an on-board Embedded Debugger (EDBG), which requires no additional hardware to get started. For programming/debugging, the EDBG connects to the host PC through the USB micro-B connector on the PIC32MZ DA Curiosity Development Kit.

Software Description Install
MPLAB® X Integrated Development Environment v5.15 or newer Install MPLAB® IDE
MPLAB® XC32/32++ C Compiler v2.20 or newer Install Compiler
MPLAB® Harmony 3 gfx v3.5 (and dependencies) or newer Install Harmony v3

NOTE: This project has been verified to work with the following versions of software tools: MPLAB® X IDE v5.45, MPLAB® XC32 Compiler v2.50, Harmony Graphics v3.9.0

NOTE: Because we regularly update our tools, occasionally you may discover an issue while using the newer versions. If you suspect that to be the case, we recommend that you use the same versions that the project was tested with.

Hardware Setup

Configure the hardware as follows:

If your WQVGA display cable is connected to a interposer board, following these steps:

  • Disconnect the ribbon cable that connects the display to the interposer board. The board is for the MEB 2 only, and not used with the PIC32MZ DA Curiosity Development Kit.

Microchip Technology

  • Release the ribbon cable from the interposer board.
  • Release the black clamp on the J2 connector and turn the display over.
  • Insert the ribbon cable into J2 and close the clamp.

Microchip Technology

Important The board and display are powered by a Micro B – USB A cable from PC to the “USB Debug” port on the PIC32MZ DA Curiosity Development Kit.

PIC32MZ DA Curiosity Development Kit is connected to the display using the display ribbon cable. Programming is a board to PC link using a standard USB A to micro-B cable.

The final hardware setup is illustrated below.

Create a new project

  1. Launch the New Project wizard. Select File > New Project from the main IDE menu.

  2. In the Categories pane of the New Project dialog, select Microchip Embedded. In the Projects pane, select 32-bit MPLAB® Harmony 3 Project, then click Next.

Microchip Technology

NOTE: If 32-Bit MPLAB® Harmony 3 Project selection is not displayed, Download MPLAB® Harmony Framework.

  1. In the Framework Path edit box, browse to the folder you downloaded the framework to. If you haven't done this, or want to download it to a different folder, click the Launch Framework Downloader button, then click Next.

NOTE: For more information on the framework downloader, see the, Download MPLAB® Harmony Framework section of the "MPLAB® Harmony Configurator Overview" page.

Microchip Technology

  1. In the Project Settings window, apply the following settings:

    • Location: Indicates the path to the root folder of the new project. All project files will be placed inside this folder. The project location can be any valid path, for example: C:\microchip\harmony\v3.
    • Folder: Indicates the name of the MPLABX .X folder. Enter “legato_qs_mzda_cu_tm4301b” to create a legato_qs_mzda_cu_tm4301b.X folder.
    • Name: Enter the project’s logical name as “legato_quickstart_mzda_cu_wqvga”. This is the name that will be shown from within the MPLAB® X IDE.
    • Click Next to proceed to Configuration Settings.

NOTE: Folder must be a valid directory name for your operating system. The Path box is read-only. It will update as you make changes to the other entries.

Microchip Technology

  1. Follow the steps below to set the project’s Configuration Settings.

    • Name: Enter the configuration name as "glcd_rgba8888_mxt_mzda_intddr_cu".
    • Target Device: Select “PIC32MZ2064DAR176” as the target device.
    • Click Finish to launch the MHC.

NOTE: You can select the Device Family or enter a partial device name to filter the list in Target Device in order to make it easier to locate the desired device.

Microchip Technology

NOTE: The New Project Wizard opens a Configuration Database Setup window to allow you to review the packages that will be used by the current project.

  1. Launch MHC.

Microchip Technology

Click Launch to launch the MHC Configurator tool with the selected packages.

  • Launching MPLAB® Harmony Configurator. The following message will be displayed while the project is loaded into MPLAB® X.

Microchip Technology

  1. The MHC plugin’s main window for the project will be displayed. This is the initial project graph.

Microchip Technology

  1. Set up the compiler toolchain. Click on the Projects tab on the top left pane. Right click on the project name legato_quickstart_mzda_cu_wqvga and go to Properties.

Microchip Technology

Make sure that XC32 (v2.50) is selected as the Compiler Toolchain for XC32. Click on Apply and then click on OK.

Microchip Technology

Verify Clock Settings

  1. Launch Clock Diagram. Click the MHC menu tab in MPLABX IDE and then select Tools > Clock Configuration.

Microchip Technology

A new tab, Clock Diagram, is opened in the project’s main window.

  1. Click on the Clock Diagram tab, scroll to the right and verify that the SYSCLK is set to 200 MHz.

Microchip Technology

Configure Software with MHC

  • Configure pins
    • Connect to external graphics communication
  • Create a UI design
  • Save Project
  • Generate, Build, and Run

Load Software Components

  1. This is a Harmony based application, therefore, you will need to use the Harmony Core Service Component.

Under the bottom left tab, Available Components, expand Harmony. Double click or drag and drop Core to add the Harmony Core Service to the project graph. When prompted to activate FreeRTOS, click No.

Microchip Technology

Microchip Technology

  1. You will also need the Time System Service.

NOTE: Harmony components lists Current Consumers and Available Consumers when a right click occurs on the circle icons.

  • On the Harmony Core Service component, right click the Core Service icon on Harmony Core Service component, select Available Consumers, then select TIME.

Microchip Technology

  • On the Time System Service component, right click the TMR icon, select CORE_TIMER(core_timer).

Microchip Technology

This is a GFX enabled application. You will need to select a graphics library. For this tutorial, we will use Legato.

  1. Under the bottom left tab, Available Components, expand Graphics>Middleware. Double click or drag and drop Legato to add the MGS Harmony library to the project graph.

  2. On the Legato component, right click the LE Display Driver, select Satisfiers, and select LE GLCD.

Microchip Technology

  1. On the Confirm Component Auto-Activation dialog, click Yes to activate the GFX Core LE component.

Microchip Technology

  1. On the LE GLCD component, right click Graphics Display diamond icon, select Satisfiers, and select PDA TM4301B (gfx_disp_pdatm4301b_480x272).

Microchip Technology

  1. On the PDA TM4301B component, right click Touch Panel diamond icon, select Consumers, and select MaXTouch Controller (gfx_maxtouch_controller).

Microchip Technology

  1. On the MaXTouch Controller component, right click DRV_I2C diamond icon, select Satisfiers, and select I2C (drv_i2c).

Microchip Technology

  1. On the MaXTouch Controller component, right click Input System Service circle icon, select Available Satisfiers, and select Input System Service (sys_input).

Microchip Technology

  1. On the I2C Driver component, right click Input I2C diamond icon, select Satisfiers, and select TWIHS0.

Microchip Technology

On completion, your Project Graph window should look similar to the following image:

Microchip Technology

If the display timing needs to be configured, then you will need to launch Display Manager. For this tutorial, Display Managing is not required. See Getting started with Display Manager for more information.

Microchip Technology

Configure Hardware

In this step, you will need to configure the pins on the PIC32MZ DA Curiosity Development Kit to support the external touch controller and display modules.

  1. Open the Pin Configuration tabs by clicking MHC > Tools > Pin Configuration.

Microchip Technology

  1. Select the MHC Pin Settings tab. Set sort Order: to Ports illustrated tsrated below.

Microchip Technology

  1. Use the table below to establish your Pin Settings

Required Pin Settings

Pin Number Pin ID Custom Name Function Direction Latch
129 RA2 SCL2
128 RA3 SDA2
11 RB1 RGB_LED_8 LED_AL Out High
12 RB11 SWITCH1 SWITCH_AL
9 PC0 EBI_D0 EBI_D0
17 RC1 RGB_LED_R LED_AL Out High
16 RC4 RGB_LED_G LED_AL Out High
79 RD0 TM4301B_BACKLIGHT GPIO Out High
34 RG15 SWITCH2 SWITCH_AL
105 RH13 SWTICH3 SWITCH_AL
42 RH14 BSP_MAXTOUCH_CHG GPIO

NOTE: the drv_maxtouch driver require specific names for its pins. If you do not have the correct pin names a compiler output will display an error along with the expected name.

If you are using the PIC32MZ DA Curiosity Development Kit, you may refer to the PIC32MZ DA Curiosity Development Kit schematic obtained from the PIC32MZ DA Curiosity Development Kit.

NOTE: If you are using a schematic for your custom board, map the required graphics pins to your board.

Create UI Design with MGS Harmony Composer

Next you will need to create a basic design using the MGS Harmony Composer

Launch MGS Harmony Composer from the MHC->Tools->MGS Harmony Composer Menu:

Microchip Technology

On the Welcome Dialog, select Create a new project using the new project wizard. Follow the step-by-step guided menus.

Microchip Technology

Create a template design by following the steps in the How to Create a Simple Design Using the Project Wizard guide. Make sure to set display resolution to Width: 480 and Height: 272, Color Mode: RGB888, Memory Profile: M7.

Click Start with a basic quickstart project template to automatically create a UI design.

Save and Generate Legato Composer Design

  1. Save the Legato Composer UI Configuration. Click File -> Save.

Microchip Technology

  1. When done, Generate Legato composer project files. Click File -> Generate Code as shown below. This will generate the UI design and the necessary MGS Harmony files. Harmony files such as peripheral libaries, system services, and drivers are generated via the MHC code generate in the steps to follow.

Microchip Technology

Save and Generate Harmony Project

  1. When done, before generating code, click Save MHC State as shown below.

Microchip Technology

  1. Save the configuration in its default location when prompted.

  2. Generate the code as shown below.

Microchip Technology

Click on the Generate button in the Generate Project window, keeping the default settings as shown below. If prompted for saving the configuration, click Save.

  1. As the code is generated, MHC displays the progress as shown below.

Microchip Technology

  1. Examine the generated code.

MHC will include all the MPLAB® Harmony library files and generate the code based on the MHC selections. The generated code would add files and folders to your Harmony project

  1. Navigate to the Projects tab to view the project tree structure.

Microchip Technology

Build, program and observe outputs

Power up the board by connecting the power adapter to power connector or a powered USB cable to the DEBUG USB port on the board.

  1. Connect the Type-A male to mini-B USB cable to micro-B DEBUG USB port to power and debug the SAM E70 board.

  2. Go to File > Project Properties and make sure that the EDBG is selected as the debugger under the Hardware Tools and XC32 (v2.50 or later) is selected as the Compiler Toolchain for XC32.

  3. Clean and build your application by clicking on the Clean and Build button as shown below.

Microchip Technology

  1. Program your application to the device, by clicking on the Make and Program button as shown below.

Microchip Technology

The application should build and program successfully.

Review

You have successfully created an application using MPLAB® Harmony v3 on PIC32MZ DA Curiosity Development Kit. Your application used all the fundamental elements that go in building a graphics application. Your application successfully rendered a UI to the High-Performance 4.3" WQVGA Display Module. The application also took user from the display module.

Specifically, you used MPLAB® Harmony Configurator (MHC) to configure PIC32MZ DA Curiosity Development Kit. You used MHC to add and connect components. You used Pin Configurator to set up the pins for display and maxTouch controller.

Summary

This guide provided you training of configuring and using all the fundamental components needed to build a graphics application on a PIC32MZ DA Curiosity Development Kit with MPLAB® Harmony v3 Framework. As a next step, you may customize this application and reconfigure some of the components used in this tutorial. You could also add new components (PLIBs, etc.) to enhance this application to realize your end application.


Is this page helpful? Send feedback.