Low Power Application on SAM L10 Using MPLAB® Harmony v3 Peripheral Libraries: Step 7

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

Build and Program the Application

Verify that the temperature sensor (I/O1 Xplained Pro Extension Kit) is connected to Extension Header 1 (EXT1) on the SAM L10 Xplained Pro Evaluation Kit.

Hardware Setup

Back to top


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.

compiler setup

Back to top


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

clean and build

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

Back to top


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

Build Icon

Back to top


Open the Tera Term application (or another terminal console) on your PC and navigate to File > New connection.

tera term new connection

Back to top


Navigate to the Serial box in the opened window and select the port number that corresponds to the Embedded Debugger (EDGB) Virtual COM Port of your connected SAM L10 Xplained Pro. Then, press OK to open a serial connection.

tera term new connection window

Back to top


Open the Serial port configuration of Tera Term by navigating to Setup > Serial port.

tera term serial port

Back to top


In the Serial Port window, verify that the Baud rate is set to 115200 and other elements are set as shown in the image, then press OK.

tera term serial port setup

Back to top


Now that the serial console is configured, reset the board, and verify the application title message is displayed.

console message after reset

Back to top


Cover the light sensor on the I/O Xplained Pro board by placing your hand over it (or another element to put the light sensor in a dark environment) to print the temperature and message on the terminal. You should see the following messages (containing the temperature value in °F) on the terminal every 500 milliseconds for the duration the light sensor is covered:

console message after covering lightsensor

Back to top


Observe Current Consumption on Data Visualizer

Data Visualizer is a program to process and visualize data. The Data Visualizer can receive data from various sources such as the Embedded Debugger Data Gateway Interface (EDBG DGI) and COM ports. It is possible to track an application in run-time using a terminal graph or oscilloscope. It analyzes the power consumption of an application through correlation of code execution and power consumption when used together with a supported probe or board.

Download and install Atmel Data Visualizer.

Open the Data Visualizer application from your PC and select the connected SAM L10 Xplained Pro board on the DGI Control Panel, then click on Connect. The Data Visualizer will then start searching for protocols from the SAM L10 Xplained Pro board through the EDBG.

data visualizer dgi control panel selection

Back to top


Once the Data Visualizer is connected to the SAM L10 EDBG, different interfaces will appear. Select the Power interface and click on the Start button to start measuring the power consumption of the device.

data visualizer power start buttons

Ensure that the jumpers for Current Measurement on the SAM L10 Xplained Pro are set to MEASURE for the MCU and BYPASS for the I/Os.
current measurement hw setup
 

The Power Analysis window will appear on the Data Visualizer tool interface

data visualizer power analysis window

Back to top


The image below shows the device in Standby mode with its measured power consumption. You can observe small peaks that illustrate the 500 milliseconds Real-Time Clock (RTC) timer expiry.

device in standby mode

The average value is considered when measuring the power consumption of the device because the instant value is not stable.

Back to top


Cover the light sensor on the I/O Xplained Pro board by placing your hand over it (or another element) to print the temperature on the terminal and observe the power consumption of the device.

device wakes up and print temperature

The power consumption of the device in Active mode is 525 µA and the power consumption of the same device in Standby mode is 7.5 µA. This shows the device in Standby mode will consume less power.

Back to top


Press the SW0 button to switch from Standby mode to Idle mode. The following image shows the transition of the power consumption from Standby mode to Idle mode.

standby idle transition

Back to top


The following image shows the device in Idle mode with a measured power consumption of 140 µA.

device in idle mode

You can observe that the small peaks coming from RTC timer expiry disappeared because the power consumption in Idle mode is higher than the power required to start ADC conversion.

Back to top


Place your hand over the light sensor. The device will wake up on the next ADC window monitor interrupt, read and print data on serial, and then re-enter Standby mode. The following image shows the transition of the power consumption by switching from Idle mode to Standby mode.

transition from idle to standby

Note that the above results highlight the power consumption is lower in Standby mode than in Idle mode.

Back to top


Wake-up Time Measurement Using Logic Analyzer/ Cathode-Ray Oscilloscope (CRO)

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 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 the wake-up time.

Connect your logic analyzer or your CRO to the board according to the image below:

hardware setup

Back to top


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

The following image shows the wake-up time from Standby mode:

wakeup time from standby

The following image shows the wake-up time from Idle mode:

wakeup time from idleBy observing the outputs, you can conclude that the wake-up time is greater in Standby mode than in Idle mode.

Back to top


Results

You successfully created a low power application using the SAM L10 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 such as power and wake up response times.

Back to top

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.

Back to top

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