Power Monitoring (PAC1934) on SAMA7D65 Curiosity Development Board Using an MPLAB® Harmony Application
Introduction
In this training, you will learn how to measure power consumption on the SAMA7D65 Curiosity Development Board using the PAC1934 power monitoring IC. This guide provides comprehensive instructions on utilizing the PAC1934 IC via I2C or USB interfaces to monitor power usage effectively.
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 SAMA7D65 Curiosity, 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 Channel's | Description |
PAC1934 Channel 1 | VDD 3V3 |
PAC1934 Channel 2 | DDR and IO |
PAC1934 Channel 3 | Core |
PAC1934 Channel 4 | CPU |
There are two primary methods for measuring and monitoring power using the PAC1934 power monitoring IC:
- Method 1: Measure the power via PAC193X Windows® GUI
- Method 2: Measure the power via I2C interface
Both methods are comprehensively detailed in the following sections, providing step-by-step instructions to ensure accurate power monitoring and measurement.
Hardware Used
- SAMA7D65 Curiosity Development Board
- MPLAB® PICkit™ 5 In-Circuit Debugger
- Two USB2.0 Micro-B cables
- DEBUGGER ADAPTER BOARD
- UART-TTL cable
- microSD™ card
Software Used
- MPLAB X IDE v6.25
- MPLAB XC32 Compiler
- PAC193X Windows Application
- Tera Term or any other serial terminal software
- PAC193x generic library (v1.2)
Hardware Setup
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 USB2.0 Micro-B cable to connector J5 (PAC) to monitor the power.
Connect the FTDI cable to the serial debug port (J35) on the SAMA7D65 Curiosity Kit.
Remove/open the jumper from connector J3 to disable QSPI boot and connector J to disable NAND boot.
Connect the external MPLAB PICkit 5 debugger to the 20-pin JTAG debug port (J38).
Measuring/Monitoring the Power Using PAC1934
Method 1: Measure the Power via PAC193X Windows GUI
Download and install the PAC193X Windows GUI Application.
Close pin 1 and 2 of Jumper J6.
Close pin 1 and 2 of Jumper J7.
J6 and J7 jumper settings are required to measure power via SAMA7D65. For more details, refer to the power measurement I2C connection PAC1934 table on the SAMA7D65 Curiosity.
Open the PAC193X Windows GUI Application. Select the device and go to Setting > Set Constants. In the Sense Resistor Value window, set 0.047 ohms for the four channels.
Ensure the device is connected to the PAC193X Windows GUI application. In the PAC Settings, select Bi-Directional I measurement. In the plot pane, choose the measurement type, such as Power or Current, based on your monitoring needs.
Click the Start Acquisition button in the PAC193X Windows GUI application .
Run any application in the SAMA7D65 Curiosity and monitor the power or curent on the PAC193X Windows GUI application .
Summary
In Method 1, we learned how to configure the SAMA7D65 Curiosity Development Board and the PAC193 Demo Application on Windows to monitor the power consumption of various components, including the SAMA7D65 core, DDR_IO, DC-DC, and 3V3_VDD. This approach provides asynchronous monitoring, as it does not rely on the SAMA7D65 itself for power measurement.
Method 2: Measure the Power via I2C
Close pin 2 and 3 of Jumper J6.
Close pin 2 and 3 of Jumper J7.
J6 and J7 jumper settings are required to measure power via SAMA7D65. For more details, refer to the power measurement I2C connection PAC1934 table in the SAMA7D65 Curiosity.
Download the PAC1934 generic library v1.2.
Open 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) and click Next.
In the Select Device dialog window, fill in or select the following information:
- Family: 32-bit MCUs and MPUs (PIC32C/SAM)
- Device: SAMA7D65
In the Select Compiler pane, for Compiler Toolchains select XC32, and click Next.
Enter the Project Location, Project Folder and Project Name. Click Finish.
After 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. It will launch the MCC Content Manger Wizard. Select MPLAB Harmony.
Add the required packages (csp, bsp, core, dev_packs) and click Finish. The content download will take some time; wait until all the contents are downloaded.
In the project graph, add the Board Support Package (BSP) for SAMA7D65 Curiosity from Device Resource. Then, from Device Resource > Peripheral, add FLEXCOM6, FLEXCOM10, and TC0. These modules and configurations are required to run the demo application.
Save all and then click the Generate button. This will generate code for all the Device Resources that have been added to the Project Graph.
There is a library folder inside the PAC1934 generic library v1.2, where the PAC193x.h and PAC193x.c files are available.
Add the PAC193x.h to the header files and PAC193x.c to the source files of the project.
Functions to be called from the application to monitor power/current via I2C are as follows:
PAC193x_Device_Initialize() : initialize the PAC1934 device.
PAC193x_RefreshV() : This command 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.
Refer to the main.c for demo code.
Run the MPLAB Harmony Application
Connect the J6 and J7 jumpers to SAMA7D65, which will connect PAC1934 to MPU (SAMA7D65). Refer to the Power measurement I2C connection PAC1934.
Power up the board through the USB-A port (J3) ( USB-C connector) or by an external 5.0 VDC power supply to (J1).
Download the pre-built binaries and copy the boot.bin and harmony.bin files to an SD card formatted with the FAT32 file system.
Insert the SD memory card into the slot (J10) located on the bottom side of the development board.
Perform a reset by pressing the RESET button on the SAMA7D65 Curiosity Development Board.
PAC1934 power monitoring can be done through the SAMA7D65 Curiosity Development Board using a pre-built application.
Open the terminal to see the output.
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 SAMA7D65, 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.
Results
The following results are recorded while running ROM BOOT without loading the at91 and MPLAB Harmony application.
ROM BOOT | |||||||
VDD_3V3 (3.3V) | VDDIODDR (1.35V) | VDDCORE (1.15V) | VDD_CPU (1.25V) | ||||
78mA | 250mw | 17mA | 23mw | 106mA | 120mw | 51mA | 58.5mW |
The following results are recorded while running AT91Bootstrap without the MPLAB Harmony application. AT91bootstrap is loaded from the SD card.
AT91Bootstrap (SD Card) | |||||||
VDD_3V3 (3.3V) | VDDIODDR (1.35V) | VDDCORE (1.15V) | VDD_CPU (1.25V) | ||||
75mA | 247mw | 77mA | 105mw | 155.25mA | 178mw | 129mA | 148.5mw |
The following results are recorded while running the MPLAB Harmony application with an endless loop from JTAG.
Clock Speed | Endless application with JTAG | |||||||||||
CPU CLK (MHz) | MASTER CLOCK - MCK0 (MHz) | DDRPLL CLOCK (MHz) | VDD_3V3 (3.3V) | VDDIODDR (1.35V) | VDDCORE (1.15V) | VDD_CPU (1.25V) | ||||||
800 | 266 | 533 | 82.1mA | 271mW | 78mA | 102.5mW | 168mA | 194mW | 99mA | 113.7mW | ||
600 | 200 | 200 | 82.7mA | 275mW | 76mA | 105mW | 164.5mA | 189mW | 76.5mA | 88mW | ||
400 | 120 | 133 | 81mA | 270mW | 76mA | 105mW | 161.5mA | 186mW | 55.8mA | 63.5mW | ||
The following results are recorded while running the MPLAB Harmony application from JTAG.
Clock Speed | Application (I2C + UART + JTAG) | |||||||||||
CPU CLK (MHz) | MASTER CLOCK - MCK0 (MHz) | DDRPLL CLOCK (MHz) | VDD_3V3 (3.3V) | VDDIODDR (1.35V) | VDDCORE (1.15V) | VDD_CPU (1.25V) | ||||||
800 | 266 | 533 | 78.6mA | 259.1mW | 68.7mA | 92.3mW | 166.9mA | 191.1mW | 80.45mA | 265.23mW | ||
600 | 200 | 200 | 81.42mA | 268.125mW | 72.78mA | 97.52mW | 162.65mA | 186.833mW | 81.242mA | 268.12mW | ||
400 | 120 | 133 | 80.1mA | 264.1mW | 62.7mA | 84.3mW | 160.2mA | 184mW | 80.1mA | 264.1mW | ||
Clock Speed | LVDS | |||||||||||
CPU CLK (MHz) | MASTER CLOCK - MCK0 (MHz) | DDRPLL CLOCK (MHz) | VDD_3V3 (3.3V) | VDDIODDR (1.35V) | VDDCORE (1.15V) | VDD_CPU (1.25V) | ||||||
800 | 266 | 533 | 106mA | 350mW | 95mA | 125mW | 175mA | 201mW | 152.5mA | 176mW | ||
600 | 200 | 200 | 101mA | 340mW | 95mA | 130mW | 171mA | 196mW | 117mA | 134.5mW | ||
400 | 120 | 133 | 102mA | 335mW | 94mA | 125mW | 166.5mA | 191.5mW | 82.5mA | 94.5mW | ||
Learn More
- SAMA7D65 Curiosity Development Board
- SAMA7D65-Curiosity – Features
- SAMA7D65 Curiosity Board - Quick Start Guide for Linux®
- SAMA7D65 Curiosity Board - Quick Start Guide for MPLAB® Harmony v3
- SAMA7D65-Curiosity – Booting Demo Linux® Image
- SAMA7D65-Curiosity – Console Serial Communications
- SAMA7D65-Curiosity - Getting Started MPLAB® Harmony v3 Graphics Application Using Microchip Graphics Suite