Migrating a MPLAB® Harmony 3 Software Framework Application from the SAM9X60-EK to SAM9X60-Curiosity: rtt_periodic_timeout
Contents
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
- MPLAB X IDE Installed with the following Plugins:
- MPLAB Harmony 3 Content Manager (MHCM)
- MPLAB Harmony 3 Configurator (MHC)
- MPLAB Code Configurator (MCC)
- XC32 Compiler Installed
- MPLAB Harmony 3 Software Framework Installed
- csp_apps_sam_9x60
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
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
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 Properties
Open the rtt_periodic_timeout_sam_9x60_ek Project Properties. The Projects Properties – rtt_periodic_timeout_sam_9x60_ek Project dialog box opens.
Configure Project for Debugging on the SAM9X60-Curiosity
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.
In the Connected Hardware Tool drop-down menu, select the debug probe. In the figure below we are selecting the J-32 Debug Probe.
In the Categories pane, select Bootstrap.
Click on the JTAG Method drop-down box and select 4-wire JTAG.
Harmony Content Path
In this step, you will let MCC know the location (directory) of the Harmony Software Framework on your host computer.
Click on Apply and the OK button.
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.
A 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.
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.
Click on the Apply button.
The package versions will be downloaded and installed. MCC will restart.
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 Order dropdown box, select Ports. This will order the pins by Pin ID (Ports).
The pin configurations displayed are those for the SAM9X60-EK.
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 Names | SAM9X60-EK | SAM9X60-Curiosity |
---|---|---|
LED_RED | PB11 | PD17 |
LED_GREEN | PB12 | PD19 |
LED | PB13 | PD21 |
Change the Custom Name field to the RGB Pin Names listed in the table above and shown in the figure below.
If a merge window is displayed, merge all. You will observe in the source code the changes in pin assignments.
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.
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
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.
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.
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