Migrating a MPLAB® Harmony 3 Software Framework Application from the SAM9X60-EK to SAM9X60-Curiosity: rtt_periodic_timeout

Last modified by Microchip on 2024/06/20 12:43

In this training topic, you will learn how to migrate an MPLAB® Harmony 3 application developed for the SAM9X60-EK Evaluation Kit to the SAM9X60-Curiosity Development Board. We will use a CSP Application, RTT Periodic Timeout, as an example. When an RTT timer interrupt occurs, the project blinks the RGB LED once per second.

The functions of MPLAB Harmony 3 Content Manager (MHCM) and Configurator (MHC) are being migrated to MPLAB Code Configurator (MCC), you will use MCC for configuring and building the project.

Prerequisites

Alert: It is assumed that all MPLAB Harmony 3 libraries and packages associated with the project are loaded onto the host computer using the MPLAB Harmony 3 Content Manager (MHCM).

Note: This training topic was developed with MPLAB X IDE v6.00 and XC32 v4.20.

Beginning with MPLAB X IDE v6.05, MPLAB Harmony 3 Content Manager (MHCM) and Configurator (MHC) are no longer available. Their functionality has been migrated into MPLAB Code Configurator (MCC).

Hardware

For this training, you will use the SAM9X60-Curiosity Development Board.

SAM9X60-Curiosity Development Board

SAM9X60-Curiosity Development Board - Features

SAM9X60-Curiosity Development Board - Comparison

Setup

Set up the SAM9X60-Curiosity Development Board as listed below to the host computer running MPLAB X IDE.

Jumpers

  • Open NAND BOOT jumper J4 to disable booting from NAND Flash
  • Close J14-RX and J15-TX in the DBGU position to enable the UART Debug port for Console Serial Communications

SD Memory Cards

  • Ensure no SD Memory Cards plugged into J3 SDMMC0 or J5 SDMMC1 connectors.

Power

  • Apply power to the SAM9X60-Curiosity Development Board by connecting a Micro-B USB cable to J1 USB-A port and a USB power supply. Typically, a USB port from the host computer.

Debug Communications

  • Connect a debug probe, such as the Microchip J-32 Debug Probe, to J12 JTAG connector and the host computer.

Console Serial Communications

  • Connect a USB-to-Serial 3.3 VDC TTL Level adapter with a 6-pin single-in-line 0.1” pitch connector to J11 UART DEBUG connector and establish serial communications with the host computer running a terminal emulation program. For more information on establishing serial communications with the target console see: SAM9X60-Curiosity - Console Serial Communications

Back to Top

Porting an Application from the SAM9X60-EK to SAM9X60-Curiosity

To demonstrate how to port an application that was developed for the SAM9X60-EK we will use a CSP Application, RTT Periodic Timeout (rtt_periodic_timeout_sam_9x60_ek), developed for the SAM9X60-EK as an example. The project blinks the RGB LED once per second when an RTT timer interrupt occurs.

Open Project: rtt_periodic_timeout_sam_9x60_ek

From MPLAB X IDE, select File > Open project. An Open Project window will open.

Locate the following project in the Harmony 3 path:

C:\Users\<user>\Harmony3\csp_apps_sam_9x60\apps\rtt\rtt_periodic_timeout\firmware\sam_9x60_ek.X

Click on the Open Project button. The rtt_periodic_timeout_sam_9x60_ek project loads into MPLAB X IDE.

open project window

Back to Top


Open Project Properties

Open the rtt_periodic_timeout_sam_9x60_ek Project Properties. The Projects Properties – rtt_periodic_timeout_sam_9x60_ek Project dialog box opens.

project configure window

Back to Top


Configure Project for Debugging on the SAM9X60-Curiosity

In the Categories pane, select Config: [sam_9x60_ek]

Select the version of DFP, CMSIS, and XC32 Compiler you require for the application.

This may be the versions used when the application was originally developed or you may use the latest versions available at the time of migration.

Note: It is a good practice to keep the same versions of Packs and Compiler for both the application and AT91Bootstrap.

In the Connected Hardware Tool drop-down menu, select the debug probe. In the figure below we are selecting the J-32 Debug Probe.

Note: The debug probe must be connected to the host computer to see it available in the drop-down menu.

project config tool

In the Categories pane, select Bootstrap.

bootstrap in the config pane

Ensure Use Bootstrap is checked.
Click on the Load button and locate and select the at91bootstrap.elf that was compiled as shown in SAM9X60-Curiosity - Configuring and building AT91Bootstrap with MPLAB X IDE for a  MPLAB Harmony 3 Project
In the Categories pane, select J-32.
Click on the Options categories drop-down box and select Communication.

Click on the JTAG Method drop-down box and select 4-wire JTAG.

4 wire form the drop down

Click the Apply and the OK button.

Back to Top


Harmony Content Path

In this step, you will let MCC know the location (directory) of the Harmony Software Framework on your host computer.

From the MPLAB X IDE menu, select Tools > Options
From the Options window, select Plugins from the ribbon.
Click on the MPLAB Code Configurator 5.x tab
Under Harmony Content Path, click on the finder and select the path of the Harmony Content.

Click on Apply and the OK button.

options window with the plugins tab set the path

Back to Top


Start MCC

You will use the MCC to download and configure the MPLAB Harmony 3 software libraries. In this section, you will start MCC and download the software packages required for the project.

Start MCC by clicking on the MCC shield in the toolbar.

Package Versions Used vs Available dialog may appear if the MPLAB Harmony package versions that the project was developed with do not match the versions available locally. You will roll-back the versions in the following steps.

Click on the Continue button.

MCC is active and displayed in the IDE.

Start MCC by clicking on the MCC shield in the toolbar.

 In the Device Resources pane, click on the Content Manager button.

In the Device Resources pane, click on the Content Manager button.

Roll-back the packages that you were alerted to in Step b above. In this example, the csp and dev_packs.

Roll-back the packages that you were alerted to

Click on the Apply button.

The package versions will be downloaded and installed. MCC will restart.

Back to Top


Update Pin Configurations using MCC

In this section, you will change pin assignments for the RGB LED from SAM9X60-EK to SAM9X60-Curiosity.

From the Plugins dropdown box, select Pin Configuration. A Pin Settings tab will be displayed.

From the Plugins dropdown box, select Pin Configuration. A Pin Settings tab will be displayed

From the Order dropdown box, select Ports. This will order the pins by Pin ID (Ports).

The pin configurations displayed are those for the SAM9X60-EK. 

From the Order dropdown box, select Ports. This will order the pins by Pin ID (Ports).

Scroll down to Pins PB11, PB12, and PB13. These are the pin assignments for the RGB LED (LD1) on the SAM9X60-EK. You need to change them to the pins on the SAM9X60-Curiosity.

Refer to the SAM9X60-Curiosity Users Guide (DS60001783) Section 3.5.4 RGB LED. Note the pin assignments for the Curiosity RGB LED (D1). The table below summarizes the pin assignments for the SAM9X60-EK and Curiosity.

RGB Pin NamesSAM9X60-EKSAM9X60-Curiosity
LED_REDPB11PD17
LED_GREENPB12PD19
LEDPB13PD21
To change pin assignments, first select Function: Available for PB11, PB12, and PB13. This will remove the pin assignments.
Next, scroll down to pin PD17, PD19, and PD21 and select Function: GPIO.
Finally, click on the Direction to toggle In to Out and Latch to Low.

Change the Custom Name field to the RGB Pin Names listed in the table above and shown in the figure below.

Change the Custom Name field to the RGB Pin Names

In the Project Resources pane (upper left), click on the Generate button. This will generate new source code with the Curiosity’s RGB LED pin assignments.

If a merge window is displayed, merge all. You will observe in the source code the changes in pin assignments.

If a merge window is displayed, merge all

Close MCC by clicking on the MCC shield in the toolbar.

Back to Top


Debugging the Application

At this point you have configured the MPLAB X IDE Project, MPLAB Harmony 3 Project using Project Properties, and configured and generated code using MPLAB Code Configurator (MCC). In this section, you will set up the application project for debugging using MPLAB X IDE.

Note:  In this training, we show you how to debug the project. There are two methods for running the application examples:

Debugging: In this training, we show you how to debug the project using MPLAB X IDE.

Production: In production, the application is booted from the external NVM. Instructions on GitHub Pages show you how to open, configure, build, load to SD Memory Card, and run the example project.

Set debug reset and startup options:

  • In MPLAB X IDE, click on Tools > Options. An Options window opens.
  • Click on the Embedded icon at the top and the Generic Settings tab.
  • Configure the settings for:
    • Debug Reset @ – Main
    • Debug startup – Halt at Main

Click on the Embedded icon at the top and the Generic Settings tab

D. Click on the OK button.

Click on the Debug Project icon on the toolbar.

The project will build with debugging parameters, load the application binary to the SAM9X60-Curiosity Development Board using the AT91Bootstrap to initialize DRAM, and Halt at Main. Once the build is complete and the application binary is loaded into the target, the toolbar expands to show additional debugging icons.

Note: MPLAB X IDE uses AT91Bootstrap to initialize the SAM9X60 and then exits without loading any additional binary files to SDRAM. MPLAB X IDE then loads the application program to SDRAM.For more information see: SAM9X60 Boot Process

Note: For more information on establishing serial communications with the target console see: SAM9X60 Curiosity Development Board - Console Serial Communications

terminal window for serial comms

debug the project

Click on the Continue button. The application binary runs within the target. Observe the RGB LED D1 flashes blue at a 1 Hz rate.

Congratulations! You migrated an MPLAB Harmony 3 application developed for the SAM9X60-EK Evaluation Kit to the SAM9X60-Curiosity Development Board.

You can now pause, insert breakpoints, and continue running the project.

If you change the source code, don’t forget to (re)build the project.

Alert: If you stop a debug session you must press the Reset button on the SAM9X60-Curiosity Development Board to initiate the boot process before launching another debug session.

Back to Top

Summary

In this training, you migrated a MPLAB Harmony 3 application that was developed for the SAM9X60-EK Evaluation Kit to the SAM9X60-Curiosity Development Board. You use a CSP Application, RTT Periodic Timeout, as an example to make the RGB LED (D1) once per second when a RTT timer interrupt occurs.

Back to the SAM9X60 Curiosity Development Board - Introduction

Back to Top