SAMA7D65-Curiosity - Getting Started MPLAB® Harmony v3 Graphics Application using Microchip Graphics Suite
Introduction
In this training, you will develop, configure, and build an MPLAB® Harmony v3 Software Framework Graphics application to run on the SAMA7D65-Curiosity Kit using MPLAB X Integrated Development Environment (IDE). This training typically concentrates on project development, coding, building, debugging, and testing.
Once the application has been fully developed, the application is cleaned and built for production. The resulting binary image (harmony.bin) is written to Non-Volatile Memory (NVM), such as a Secure Digital (SD) memory card, NAND, or NOR Flash memories. The harmony.bin binary image is read from NVM by the second-stage bootloader, at91bootstrap, which is also written to NVM. However, at91boostrap must be configured and built for a given NVM. Instructions on how to do this are given in the "What’s Next?" section.
MPLAB Harmony v3 Application
This application demonstrates how to display the Microchip Graphics Quick Start project template on the AC69T88A - 5" WVGA LCD Display w/ LVDS i/f and maXTouch® using the Microchip Graphics Suite (MGS)on the SAMA7D65 Curiosity Kit.
Prerequisites
- Install MPLAB X IDE
- Install MPLAB XC32/32++ Compiler
Hardware
For this training, you will use the SAMA7D65-Curiosity Kit.
SAMA7D65-Curiosity Kit
See the "SAMA7D65-Curiosity Kit - Features" page.
Set up the SAMA7D65-Curiosity as listed below to the host computer running MPLAB X IDE.
Jumpers
- Open 1-2 of Jumper J36 to disable NAND Flash boot.
- Open 1-2 of Jumper J39 to disable QSPI Flash boot.
- Refer to the "Jumper Summary" section of the "SAMA7D65-Curiosity Kit - Features" page for more details.
SD Memory Cards
- Ensure no SD memory cards are plugged into the SD card (J10) connector.
Power
- Apply power as shown in the "Power Options" section of the "SAMA7D65-Curiosity Kit - Features" page.
Debug Communications
- The SAMA7D65-Curiosity contains a 20-pin JTAG Debug Port. Connect a PICkit™ 5 debugger to the 20-pin JTAG Debug port (J38) and the host computer running MPLAB X IDE.
Console Serial Communications
- To view the target console, connect the host computer running a terminal emulation program following "SAMA7D65-Curiosity – Console Serial Communications".
Display
Hardware Setup
- Connect the LVDS cable that comes with the display from the LVDS display to the J17 connector of the SAMA7D65 Curiosity Kit.
- Power up the board through the USB-A port (J3) ( USB-C connector) or by an external 5.0 VDC power supply to (J1) .
- Connect the external debugger MPLAB PICkit 5 debugger to the 20-pin JTAG Debug port (J38) .
- Connect the FTDI cable to the Serial Debug Port (J35) on the SAMA7D65 Curiosity Kit.
- The display can be mounted to the board using the 8-pin headers.
- When mounted, the hardware setup should appear as shown in the image below:
Developing a Quick Start Graphics MGS Application
Launch MPLAB X IDE from the main menu.
Create a New Project by clicking the New Project icon or by selecting File > New Project.
In the New Project window, under Projects, choose Application Project(s). Click Next.
In the Select Device dialog window, fill in or select the information for below:
- Family: Fill configuration name as 32-bit MCUs and MPUs (PIC32C/SAM).
- Device: From drop down list select SAMA7D65.
In the Select Compiler dialog window, under Compiler Toolchains, select XC32 COMPILER. Click Next.
Enter Project Location , Project Folder and Project Name. Click Finish.
This creates an empty project and sets this project as the main project. If there are other projects open in the project explorer window, set this project as main project by right-clicking on the project and choosing Set as Main Project.
Once the project is created, MCC will be automatically launched. (To launch MCC manually, from the main menu, click on Tools > Embedded > MPLAB Code Configurator, or click the MCC button in the MPLAB X IDE toolbar). If Harmony contents are not available in the Harmony Framework path, it will launch the Content Manager Wizard.
In addition to the required packages (csp), download the optional packages bsp, core, and gfx. Then click Apply. The content download will take some time, so be patient and wait until all contents are downloaded. Then click Finish.
The Project Graph window will be displayed. From the Device Resources window, click the add button next to SAMA7D65 Curiosity BSP, which will add Board Support Packages, reflected in the Project Graph.
From Device Resources window, expand Graphics. Then, expand Displays to view the supported display list. Click the add button next to AC69T88A to add it to the Project Graph.
In the Project Graph, right-click on the AC69T88A block, then from LVDS Display, go to Consumers, then click LVDSC.
Add a dependency consumer for the LVDSC block by right-clicking the add button for Consumers and selecting LE XLCDC. Click Yes to all pop-ups and No to FreeRTOS®.
Add Consumers for LE Display Driver block as Legato.
After adding the display blocks, the Project Graph will look like the accompanying image.
To add touch panel support, click the AC69T88A block, right-click on Touch Panel, and add Consumer as MaxTouch Controller.
Right-click on DRV_I2C in the MaxTouch Controller block, add Consumers as I2C.
Right-click on I2C, click Satisfiers, and click FLEXCOM0. (Refer to the datasheet or the pin details and connections).
The Project Graph will look like the accompanying image after adding the display and touch support.
Add system services time by expanding System Services and add the block Time .
Add Satisfiers as TC0 for the system service block Time.
Finally, add support for the Input System Service by expanding Input > Service > Input System Service as shown in the accompanying image. This completes the addition of all the required peripherals to the Project Graph.
Add the pin configurations. To do this, go to Project Graph > Plugins > Pin Configuration.
Configure the pins as follows:
PB14 --> LVDS_LCD_BL --> GPIO --> Output --> High
PB16 --> BSP_MAXTOUCH_CHG --> GPIO --> Input
PB18 --> LVDS_LCD_EN --> GPIO--> Output --> High
PB16 --> LVDS_LCD_SCL --> FLEXCOM0_IO1
PB16 --> LVDS_LCD_SDA --> FLEXCOM0_IO1
Refer to the User guide for the pin details.
Click on the LE XLCDC Deriver > Configuration Options > Enable Backlight PWM.
Generate the code by clicking the Generate button. Wait until the code generation is complete.
Launch Microchip Graphics Composer by selecting Project Graph > Plugins > Microchip Graphics Composer.
In the Microchip Graphics Composer, click + New project.
Click Quickstart 800 x 400 px. Find the Color Mode drop-down and choose RGBA_8888. Then, find Memory Profile and select MPU.
A simple, quickstart screen will be added in the composer.
The GUI design should be saved with the file name <project_configration_name>_design. It is mandatory to name the graphics design file as explained above. This ensures the auto lauch of the graphics design when MGS is launch again. For example: the accompanying image shows that "default" is the project_configuration_name, hence the graphic design file name is saved as "default_design".
Generate the code for the designed graphics by going to File > Generate Code.
Exit the Microchip Graphics Composer by clicking the x at the top right of the screen.
Generate the code from the Project Graph in MPLAB X IDE by clicking the Generate button. Wait until the code generation is complete. This completes the development of the graphics application using MGS on MPLAB X IDE.
Debugging the Harmony Graphics Application on MPLAB X IDE
To debug the project on MPLAB X IDE, make sure the board and powered and the external debugger is connected. Refer to the Hardware setup section in this document for more details.
Right-click on the project and click Properties. Make the following selections from the Configuration dialog:
- Device: SAMA7D65
- Connected Harward Tool: PICkit 5
- Packs: SAMA7D65_DFP > 1.4.54
- Compiler Toolchain: XC32
Then, click OK and Apply.
Right-click on the project and click Properties. Make the following selections from the Configuration dialog:
- Compiler: Toolchain > XC32,
- Packs: SAMA7D65_DFP > 1.4.54
Then, click Apply.
Make the following selections from the Options for PICkit 5 dialog:
- Interface: JTAG
- Speed: 1
Then click OK and Apply.
By default, only ELF and Hex format output files are generated. To generate application output in binary format, a post-build step needs to be added to the project properties. To do this, right click on the project and select Properties, select Building, check the box next to Execute this line after build, then enter the following command:
- ${MP_CC_DIR}/xc32-objcopy -O binary ${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.elf ${DISTDIR}/harmony.bin
In the Categories pane, select Bootstrap.
Observe that the box next to Use bootstrap is checked and the pre-compiled version of the at91bootstrap.elf is selected. (The pre-complied at91bootstrap.elf can be found here).
While in debug mode, the second-stage bootloader, at91bootstrap, is used by MPLAB X IDE to initialize DRAM so that it can continue loading the MPLAB Harmony v3 project binary (harmony.bin). Once the project has been loaded onto the SAMA7D65-Curiosity, MPLAB X IDE can be used to run and debug the application.To configure and build at91bootstrap to debug a Harmony application on MPLAB X IDE click here.
Clean and Build the project. The user should see a message on the output console that the project was successfully built. This completes the building of the MPLAB Harmony application.
The harmony.bin binaries will be available at ./project_directory/Graphics_Application_Getting_Started.X/dist/default/production.
Begin debugging the project. Before debugging using PICKit 5, click Release from Reset, which will update the firmware for the specified target if needed.
Debug can occur during the project by step-in, step-out, halt, or run.
Observe how the designed quick start graphics using Microchip Graphics Composer are displayed on the LVDS display.
Running the Pre-built Harmony Graphics Application from the SD Card
The pre-built application bin file on the SD card can be programmed by following the steps below.
Take an SD Card formatted with FAT32 file system.
Click here for the steps to Format and Partition an SD Card larger than 32 GB using DiskPart in Windows®.
Setup the hardware as mentioned in the hardware setup section of this page. Copy the boot.bin and harmony.bin files from the binaries.zip folder from here to the SD card.
Insert the SD card to J10 on the SAMA7D65-Curiosity Kit.
Press the START button and then press RESET button.
Then observe the quick start graphics getting displayed on the LVDS display.
Summary
In this training, you developed, configured, and built an MPLAB Harmony v3 Quick Start graphics application using MPLAB X IDE to run on the SAMA7D65-Curiosity Kit.
What’s Next?
Once an MPLAB Harmony v3 application (harmony.bin) has been developed and built for production, the next step is to configure and build the second-stage bootloader, at91bootstrap, for reading the harmony.bin binary image from NVM and writing to SDRAM. The following training topics show how this is done for NAND Flash, NOR Flash (QSPI), and an SD memory card.
For training topics on MGS, configuring and building at91bootstrap to load from Non-Volatile Memories (NVM), see:
- Getting Started with Microchip Graphics Suite (MGS) Harmony
- SAMA7D65-Curiosity – Configure and Build at91bootstrap for an MPLAB® Harmony v3 Project with MPLAB X IDE
- SAMA7D65-Curiosity – Configure and Build at91bootstrap to Load an MPLAB Harmony v3 Application from NOR Flash (QSPI) Memory
- SAMA7D65-Curiosity – Configure and Build at91bootstrap to Load an MPLAB Harmony v3 Application from SD Memory Card
- SAMA7D65-Curiosity – Configure and Build at91bootstrap to Load an MPLAB Harmony v3 Application from NAND Flash Memory