Low Power Application on SAMC2x using Harmony v3 Peripheral Libraries: Step 7

Step 7.1: Build and program the application


Verify that the temperature sensor (I/O1 Xplained Pro Extension Kit) is connected to Extension Header 2 (EXT2) on the SAM C21 Xplained Pro Evaluation Kit.



Go to File > Project Properties and make sure that the EDBG is selected as the debugger under the Hardware Tools and XC32 (v4.30) is selected as the Compiler Toolchain for XC32.



Clean and build your application by clicking on the Clean and Build button.


In case of compilation errors, recheck the steps and build the project again.


Program your application to the device by clicking on the Make and Program button.



Open the Tera Term application on your PC. Navigate to File > New connection > Serial. Select COM PORT (Embedded Debugger (EDGB) Virtual COM Port) and press OK to make a serial connection open. Go to Setup > Serial port… and make sure the baud rate is set to 115200.



Cover the light sensor on the IO Xplained Pro board (by placing your hand over it) to print the temperature on the terminal.


You should see the temperature values (in °F) getting printed on the terminal every 500 milliseconds for the duration the light sensor is covered, as shown.


Step 7.2: Observe current consumption on the Data Visualizer

The Data Visualizer is a tool used to measure the power consumption of the device.

The Data Visualizer is a program to process and visualize data. The Data Visualizer is capable of receiving data from various sources such as the EDBG Data Gateway Interface (DGI) and COM ports. Track your application's run-time using a terminal graph or oscilloscope, or analyze the power consumption of your application through correlation of code execution and power consumption, when used together with a supported probe or board. Having full control of your codes’ run-time behavior has never been easier.

Download and install stand-alone Data Visualizer.


Open the Data Visualizer application from your PC and select Power Debugger Data Gateway on DGI Control Panel.



Click on the Connect button to have the Data Visualizer ready to receive information from the Power Debugger Data Gateway.



After the Data Visualizer is connected to the Power Debugger Data Gateway, select the Power interface and click on the Start button.



On the right-hand side of the Power Analysis window, click on the Control Panel tab and Disable Channel B.

The accompanying image shows the device in Standby mode, smaller peaks are the 500ms timer expiry peaks.


Cover the light sensor on the IO Xplained Pro board (by placing your hand over it) to print the temperature on the terminal. The following image shows the power consumption values in Standby mode and CPU Active mode.


Press Switch SW0 to switch from Standby mode to Idle mode. The following image shows the transition power consumption values from Standby to Idle mode. Idle mode consumes more power compared to Standby mode.


Place your hand nearer to the light sensor. The device wakes up, reads and prints the temperature value on the serial console, and re-enters the Standby mode. The following image shows the transition power consumption values from Idle to Standby mode.



Note that from the above results the power consumption is low in Standby mode compared to Idle mode.

Step 7.3: Wake Up time measurement using Logic Analyser/CRO

Logic Analyser or CRO can be used to measure device wake-up time.


Relatively, the wake-up time is more in Standby mode compared to Idle mode, since the CPU and all peripherals will be stopped.

To demonstrate the CPU wake-up time, switch SW0 is configured to generate an interrupt. A General Purpose Input/Output (GPIO) is toggled in the Interrupt Service Routine (ISR) of the switch press event. The MCU comes out of the Sleep mode when an interrupt occurs (in this case, the switch press interrupt). The time between the switch press and the GPIO toggle in the ISR is wake-up time.

Press the switch SW0 and capture the signals to measure the wake-up time in Standby and Idle mode.

Setup Trigger (High to Low) on SWITCH0 probe is configured to capture the signals.

The following image shows the time taken to wake up the device from Standby mode.


The following image shows the time taken to wake up the device from Idle mode.


By observing the outputs, you can conclude that wake-up time is more in Standby mode compared to Idle mode.


You successfully created a low power application using SAMC21 Xplained Pro Evaluation Kit and I/O1 Xplained Pro Kit and experienced how, where, and which Low Power mode to use depending on the application requirements like power and wake up response times.


In this lab, you have successfully created a project from scratch, added Peripheral Libraries (PLIBs) and learned how to use an Event System to drive events received from the peripherals without CPU intervention. You also learned how to configure a device to work in Sleep modes and measure wake up time.


In this tutorial, you discovered how to configure the device to work in Sleep modes, this tutorial can be used as a reference when you develop a real-time application where the power and wake up response time plays a crucial role.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.