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

Last modified by Microchip on 2023/11/09 09:07

Build and program the application

Clean and build your application by clicking on the Clean and Build Clean Build Icon 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 Program Icon​​​​​ 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.

Opening the Tera Term application​​​​​

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

Covering the light sensor on the IO Xplained Pro board​​​​​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 below.

Temperature values (in °F)​​​​​

Back to Top


Observe current consumption on 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 Here.

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

Opening Data Visualizer

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

Clicking on the Connect button

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

Selecting the Power interface

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

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

Device in Standby modeCover 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.

Power consumption values in Standby modePress 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.

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

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

Back to Top


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 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.

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.

Time taken to wake up the device from Idle modeBy observing the outputs, you can conclude that wake-up time is more in Standby mode compared to Idle mode.

Back to Top

Results

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.

Analysis

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.

Conclusions

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.

Back to Top