3.2.2 Harmony 3 ICM Monitor Mode Example

This topic provides instructions and information about the MPLAB Harmony 3 ICM monitor mode demonstration application, which is included in the MPLAB Harmony Smart Energy Metrology Applications distribution.

Description

This demonstration application configures the ICM peripheral to monitor a memory region through the use of a transfer descriptor located in the ICM Descriptor area.
Figure 3-14. ICM Monitor Mode Descriptors Configuration

Harmony MCC Component Blocks

Figure 3-15. ICM Monitor Mode Project Graph for PIC32CXMTG EK

The virtual COM Port interface is enabled to provide an output console.

Figure 3-16. PIC32CXMTG EK Configuration

When enabling the Virtual COM Port interface, the SYS_CONSOLE is automatically loaded and connected to the FLEXCOM0 peripheral library. However, the application is designed to use the standard input/output service, so the SYS_CONSOLE service must be deleted and replaced by the STDIO service.

The TIME system service is required to be added to the Project Graph because the application launches a 2 seconds timer to simulate the corruption of the monitored data.

Figure 3-17. SYS_CONSOLE Automatic Activation
Figure 3-18. STDIO Selection

Harmony ICM Code Configuration Options

The ICM peripheral library is configured to enable just one memory region.

This application is designed to go through 2 stages:
  • The aim of the first step is to obtain the hash value of the memory region to be monitored.
  • Once the hash value has been written in the ICM hash area, the second step is used to configure and start the monitor mode.

Since the first stage of the application is focused on getting the hash value, the Region Hash Completed interrupt must be enabled in the region 0 configuration.

Figure 3-19. ICM Configuration Options

Building the Application

This section identifies the MPLAB X IDE project name and location and lists and describes the available configurations for the demonstration.

The parent folder for these files is smartenergy_metrology\apps\peripherals\icm\icm_monitor_mode. To build this project, the user must open the smartenergy_metrology\apps\peripherals\icm\icm_monitor_mode\pic32cxmtg_ek.X project file in MPLAB X IDE.

MPLAB X IDE Project Configurations

This table lists and describes the supported configurations of the demonstration, which are located within ./src/config.

Project NameConfigurationDescription
icm_monitor_mode_pic32cxmtg_ekpic32cxmtg_ekThis demonstration runs on the PI32CXMTG Evaluation Kit.

Running the Demonstration

Figure 3-20. ICM Monitor Mode Demo Application