QuickStart SAMC21N Xplained Pro Evaluation Kit - mchpgfx/legato.docs GitHub Wiki

Summary

This topic describes how to create a quick graphics-enabled application from scratch using SAMC21N Xplained Pro Evaluation Kit. It starts with a blank MPLAB® project and finishes with a graphics application equivalent to aria_quickstart.

Description

The instructions in this tutorial assume that you have already installed following software:

The instructions also assume that you have acquired following hardware:

Getting Started

To get started with this tutorial, you should:

  1. Install MHC.
  2. Configure hardware.
  3. Run MPLABX.

Install MHC

To install MHC, follow the Harmony V3 MHC installation guide. Upon completion, proceed to Configure Hardware steps below.

Configure Hardware

The final setup should be:

Set the IM switches on the maXTouch Xplained Pro Display to IM[2:0] = 111b.

Connect the Cable to the XPRO EXTENSION HEADER on the maXTouch Xplained Pro Display.

Connect the other end of the cable to the EXT1 header on the SAM C21 Xplained Pro board.

Important The board and display are powered by a Micro B – USB A cable from PC to the “Debug USB” port on the E70 board. The ICD4 Debugger and ICD4/PICKit4 Adapter Board are connected as shown above.

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

  1. Choose Project.
  • In Categories: window, Click Microchip Embedded
  • In Projects window, Click 32-bit MPLAB® Harmony Project
  • Click Next.

Microchip Technology

Important If 32-bit MPLAB® Harmony Project is not visible repeat software installation steps Install MHC above.

  1. Framework Selection.
  • Set Framework Path: to you Harmony v3 root installation directory. This path is not set by default.
  • Select Convert to Relative Path for Configuration
  • Click Next.

Important 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.

Microchip Technology

  1. Project Settings.
  • Location: field is set by default, it is not recommended to change this setting for this tutorial.
  • Set Folder: field to sam_c21n. This will be the name of the MPLAB® X project folder configured for SAM E70.
  • Set Name: field to new_app. This will be the name of your application displayed in MPLAB® X.
  • Click Next.

Microchip Technology

  1. Configuration Settings.
  • Set Name: field to sam_c21n. This will create a sam_c21n0 folder for configuration settings.
  • Select for Device Family: drop down, ATSAM.
  • Select for Device Filter: samc21n.
  • Select for Target Device: drop down, ATSAMC21N18A.
  • Click Finish.

Note The selection of Target Device ATSAMC21N18A is required for this tutorial.

Microchip Technology

  • When Finish is clicked, the following message may be displayed while the configuration database setup dialog is loaded.

Microchip Technology

  1. Configuration Database Setup.
  • Select the following packages to load into the project: gfx, core, and bsp.
  • Deselect all other packages.
  • Click Launch.

Microchip Technology

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

Microchip Technology

  • Initial Project Graph. The following will be displayed after project is loaded into MPLAP X.

Microchip Technology

  1. Available Components BSP.
  • Expand Board Support Packages (BSPs).
  • Double-click SAM C21N Xplained Pro BSP component.

Microchip Technology

Microchip Technology

  1. Available Components Template.
  • Expand Graphics/Templates.
  • Double-click the Aria Graphics w/ Xplained Pro Display template component.

Microchip Technology

  • 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.
  • Project Graph. The following will be displayed after all components are loaded into MPLAP X.

Microchip Technology

  1. Launch the Graphics Composer from the MHC/Tools Menu:

Microchip Technology

  • When MHGC’s Welcome Dialog is displayed. Click the Create a new project using the new project wizard button.

Microchip Technology

Important If the Welcome Dialog does not appear, it is because it had been disabled previously. The Welcome Dialog can be re-enabled by using MHGC’s File > Settings > General menu:

Microchip Technology

  • In the MPLAB® Harmony Graphics Composer (MHGC) screen use the left-most icon to create a new graphics design.

Microchip Technology

  1. In the New Project Wizard, for the Color Mode step,
  • Select RGB_565
  • Click NEXT.

Microchip Technology

  1. For the Memory Size step, accept the default Flash Memory Size and clickNEXT. It is not recommended to change this setting for this tutorial.

  2. For the Project Type step, chose the second option to create a new project using a basic template:

Microchip Technology

The MHGC window should now show:

Microchip Technology

  1. Launch the Pin Configuration tool and verify that the display is correctly setup:

Microchip Technology

  1. Generate the application’s code for the first time. Select the Generate Code button of MHC’s window:

Microchip Technology

Save the project’s configuration. Enter sam_e70.

Microchip Technology

Select USER_ALL as the Merge Strategy :

Microchip Technology

Click Generate:

Microchip Technology

Now the project’s initial software has been configured.

NOTE: Here is a brief explanation of the different merge strategies that are available:

  • ALL: The user will be prompted with a merge window for all generated files. This includes files that have no user modifications but are changed because of changes in MHC configuration or component updates. (This choice is always the safest.)
  • USER_ALL: The user will always be prompted with a merge window for all generated files that contain user modifications.
  • USER_RECENT: The user will be prompted with a merge window for all generated files that contain recent user modifications.
  • OVERWRITE: All generated file content will be replaced by the contents of this generate operation. All user changes will be overwritten.
  1. Project Properties dialog. Right mouse click on the project’s name and bring up the Project Properties dialog

Microchip Technology

  • Select the debugger: ICD 4)
  • XC32 compiler V2.20.
  • Click OK.

Microchip Technology

If you are using the Embedded Debugger (EDBG):

Microchip Technology

  1. Build and run the project:

Microchip Technology

  1. The following image should appear on the display:

Microchip Technology

Next Steps