Low Power Application on SAMC2x using MPLAB® Harmony v3 Peripheral Libraries: Step 7
Build and program the application
Clean and build your application by clicking on the Clean and Build 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 below.
Observe current consumption on Data Visualizer
Open 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.
Below 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. 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.
5. Note that from above results the power consumption is low in Standby mode compared to Idle mode.
Wake Up time measurement using Logic Analyser/CRO
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.
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.
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.