Power Monitoring (PAC1934) on SAM9X75 Curiosity Development Board Using MPLAB® Harmony Application

Last modified by Microchip on 2025/05/19 12:28

Introduction

In this training topic, you will learn how to measure power consumption on the SAM9X75 Curiosity Development Board using the PAC1934 power monitoring Integrated Circuit (IC). This guide provides comprehensive instructions on utilizing the PAC1934 IC via Inter-Integrated Circuit (I2C) or USB interfaces to monitor power usage effectively.

SAM9X75-Curiosity

The PAC1934 is a versatile power monitoring IC that can measure voltage, current, power, and energy across four channels. This allows you to monitor the power consumption of various components on the SAM9X75 curiosity development, including the CORE, CPU, DDR and 3.3V power supply. This capability is particularly useful for analyzing power consumption in different applications without the need for additional hardware.

PAC ChannelsDescription
PAC1934 Channel 1Core
PAC1934 Channel 2DDR & IO
PAC1934 Channel 3VDD 3V3
PAC1934 Channel 4DC-DC

Note: For more details, refer to the "SAM9X75-Curiosity User Guide" document section, “DC Power Monitoring”.

There are two primary methods for measuring and monitoring power using the PAC1934 power monitoring IC:

  • Method 1: To measure the power via PAC193X Windows® GUI
  • Method 2: To measure the power via I2C interface

Both methods are comprehensively detailed in the sections below, providing step-by-step instructions to ensure accurate power monitoring and measurement.

Hardware Used

Software Used

Hardware Setup

Connect the USB 2.0 Micro-B cable to connector J2 (USB_A) to power up the board.

Back to Top


Connect the USB 2.0 Micro-B cable to connector J37 (PAC) to monitor the power.

Back to Top


Connect the UART-TTL cable to connector J35 (UART DEBUG).

Back to Top


Remove/open the jumper from connector J10 to disable QSPI boot & connector J9 to disable NAND boot.

Back to Top


Close pin 1 and 2 of Jumper J38.

Back to Top


Close pin 1 and 2 of Jumper J39.

Back to Top


J38 and J39 jumper settings are required to measure power via USB. For more details, refer to the power measurement I2C connection PAC1934 table in the SAM9X75 Curiosity Development Board.

Hardware setup

Back to Top

Measuring/Monitoring the Power Using PAC1934

Method 1: To Measure the Power via PAC193X Windows GUI

Download and Install the PAC193X Windows GUI Application.

Back to Top


Close pin 2 and 3 of Jumper J38.

Back to Top


J38 and J39 jumper settings are required to measure power via SAM9X75. For more details, refer to the power measurement I2C connection PAC1934 table in the SAM9X75 Curiosity Development Board.

Power Measurement I2C Connection PAC1934 Table

Back to Top


Open the PAC193X Windows GUI application. Select the device, go to Setting > Set constants > Sense Resistor Value, and set the sensing resistor value to 0.01 Ohm for four channels.

PAC1934 Demo Application settings                                                                                         

PAC1934 Demo Application settings

 Note: For more details about Sense Resistor Values, refer to the "SAM9X75-Curiosity User Guide" document section, “DC Power Monitoring”.

Back to Top


Ensure the device is connected to the PAC193X Windows GUI application. In the PAC settings, select BiDirectional I measurement. In the Plot window, choose the measurement type, such as Power or Current, based on your monitoring needs.

Pac Settings and Status

                                                                                 
Measurement Types

Note: Refer to the table in the introduction to identify which PAC channel measures the power for CORE, CPU, DDR, and 3.3V.

Back to Top


Click the Start Acquisition button in the PAC193X Windows GUI application.

PAC1934 Demo Application Start acquisition

Back to Top


Run any application in the SAM9X75 Curiosity Development Board and monitor the power or current on the PAC193X Windows GUI application.

PAC193X Windows GUI Application

Back to Top

Method 1 Summary

In Method 1, we learned how to configure the SAM9X75 Curiosity Development Board and the PAC193 demo application on Windows to monitor the power consumption of various components, including the SAM9X75 Core, DDR_IO, DC-DC, and 3V3_VDD. This approach provides asynchronous monitoring as it does not rely on the SAM9X75 for power measurement.

Back to Top

Method 2: To Measure the Power via I2C

Download the PAC1934 generic library v1.2.

Back to Top


Open MPLAB X IDE from the main menu.

Back to Top


Create a new project by clicking the New Project icon or by selecting File > New Project.

Back to Top


In the New Project window, under Projects, choose Application Project(s) and click Next.

Create Project

Back to Top


In the Select Device pane, fill in or select the information for below:

Family: 32-bit MCUs and MPUs(PIC32C/SAM)
Device: SAM9X75D2G

Select Device

Back to Top


In the Select Compiler pane, for Compiler Toolchains select XC32 Compiler, and click Next.

Select compiler

Back to Top


Enterthe Project LocationProject Folder and Project Name. Click Finish.

Project Name

Back to Top


After the project is created, MPLAB Code Configurator (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.) It will launch MCC Content Manger Wizard. Then select MPLAB Harmony.

MCC wizard

Back to Top


Check the required packages (csp, bsp, core, dev_packs) and click Finish. Content download will take some time. Wait till all the content is downloaded.

MCC wizard

Back to Top


In the project graph, add the Board Support Package (BSP) for SAM9X75 Curiosity from Device Resource. Then, from Device Resource > Peripheral, add DBGU, FLEXCOM7 and TC0. These modules and configurations are required to run the demo application.

Project graph

Pinout

Note: To know more details about how to add modules in the project graph, refer to the "Developing a USB Host Demo Application" section in the "USB Host Getting Started Application on SAM9X75 Early Access Evaluation Board" page.

Back to Top


Save all and then click the Generate button. This will generate code for all the device resources that have been added in the project graph.

MCC project generate

Back to Top


There is a library folder inside the PAC1934 generic library v1.2. In that folder, PAC193x.h and PAC193x.c files are available.

Back to Top


Add the PAC193x.h in header files and PAC193x.c in Source Files of the project.

     Add PAC header Add Project source

Functions to be called from application to monitor power/current via I2C are as follows:

  • PAC193x_Device_Initialize(): Initializes the PAC1934 device
  • PAC193x_RefreshV(): This commands is used before reading the register of PAC1934
  • PAC193x_GetVBUSn_mV(): To get the V_Bus voltage in millivolts
  • PAC193x_GetVPOWERn_mW(): To get the V_Power voltage in milliwatts
  • PAC193x_GetEnergy_mWh(): To get the Energy in milliwatt-hours
  • PAC193x_GetISENSEn_AVG_mA(): To get the average current in milliamps

Back to Top


Refer to main.c for demo code.

Back to Top

Run the Harmony Application

Connect the J38 and J39 jumpers to SAM9X75, which will connect PAC1934 to SAM9X75. Refer to the Power measurement I2C connection PAC1934.

Jumper settings

Back to Top


Connect the USB 2.0 Micro-B cable in J2 (USB_A) to power up the board.

Back to Top


Take a microSD card formatted with FAT32 file system.

Back to Top


Download the pre-built binaries and copy the boot.bin and harmony.bin files to the microSD card.

Back to Top


Insert the microSD card to J14 on the SAM9X75 Curiosity Development Board.

Back to Top


Perform a reset by pressing RESET button on the SAM9X75 Curiosity Development Board.

Back to Top


PAC1934 power monitoring can be done through SAM9X75 Curiosity Development Board using pre-built application.

Back to Top


Open the terminal to see the output.

Serial Outputs

Back to Top

Method 2 Summary

In Method 2, we learned how to create, configure, build, and run a project using the MPLAB Harmony v3 software framework within MPLAB X IDE. This method enables power consumption monitoring directly using the SAM9X75, eliminating the need for external software. Additionally, this approach allows for real-time integrated monitoring of power usage across various components, providing a streamlined and efficient solution for power analysis on the target hardware.

Back to Top

Results

The following results are recorded while running ROM BOOT without loading AT91 and MPLAB Harmony application.

ROM BOOT
VDDCORE (1.15V)VDDIODDR (1.35V)VDD_3V3 (3.3V)
45 mA14.9 mW8 mA0.01W87 mA10.4 mW

The following results are recorded while running AT91Bootstrap without the MPLAB Harmony application. AT91Bootstrap loaded from an SD card.

AT91Bootstrap (SD Card)
VDDCORE (1.15V)VDDIODDR (1.35V)VDD_3V3 (3.3V)
40 mA13 mW8 mA0.0097W118 mA13.5 mW

The following results are recorded while running MPLAB Harmony application with endless loop from JTAG.

Clock Speed Endless application with JTAG
CPU CLK
(MHz)
MAIN SYSTEM BUS CLK
(MHz)
DDRAM CLK
(MHz)
VDDCORE (1.15V)VDDIODDR (1.35V)VDD_3V3 (3.3V)
80026626640 mA13 mW8 mA1.0 mW129 mA14.8 mW
 
 
60020020037 mA12.2 mW9 mA1.1 mW101.5 mA11.6 mW
 
 
40013313340 mA13 mW10 mA1.2 mW102 mA11.6 mW
 
 

The following results are recorded while running the MPLAB Harmony application from JTAG.

Clock SpeedApplication (I2C + UART + JTAG)
CPU CLK
(MHz)
MAIN SYSTEM BUS CLK
(MHz)
DDRAM CLK
(MHz)
VDDCORE (1.15V)VDDIODDR (1.35V)VDD_3V3 (3.3V)
80026626649.744 mA163.414 mW7.019 mA8.032 mW129.089 mA148.251 mW
 
 
60020020046.997 mA154.393 mW7.935 mA9.081 mW104.065 mA119.512 mW
 
 
40013313343.945 mA144.696 mW7.935 mA9.143 mW78.735 mA90.289 mW
 
 
Clock SpeedMIPI@60MHz
CPU CLK
(MHz)
MAIN SYSTEM BUS CLK
(MHz)
DDRAM CLK
(MHz)
VDDCORE (1.15V)VDDIODDR (1.35V)VDD_3V3 (3.3V)
80026626659 mA19.5 mW9 mA10 mW185 mA21 mW
 
 
60020020045 mA14.5 mW8 mA8 mW112 mA12.5 mW
 
 
40013313340 mA13 mW8 mA8 mW110 mA12.5 mW
 
 

Back to Top

Learn More

Back to Top