3.1.2 Low Power Application on SAM C21 Xplained Pro Evaluation Kit

Download

Description

The application demonstrates low power application on SAM C21 Xplained Pro Evaluation Kit. On power-up, the application is in sleep (standby) mode. The application wakes up from the sleep mode and enters active mode when the user covers the light sensor (by placing a hand over it) on the I/O1 Xplained Pro Extension Kit. The application periodically prints room temperature on a serial terminal while the light sensor is covered. The application goes back to sleep (standby) mode when the user uncovers the light sensor. LED0 in the SAM C21 Evaluation Kit is toggled every time the temperature is displayed on the serial console.

Modules/Technology Used

  • Peripheral Modules
    • I2C
    • RTC
    • USART
    • DMAC
    • ADC
    • PM
    • SUPC
    • EIC
    • EVSYS

Hardware Used

Software/Tools Used

This project has been verified to work with the following versions of software tools:

Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware/src/config/sam_c21_xpro.

Because Microchip regularly updates tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project does not seem to work and version incompatibility is suspected. It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature (DS90003305).

Setup

  • Connect the I/O1 Xplained Pro extension kit to Extension Header 2 (EXT2) of the SAMC21 Xplained Pro Evaluation Kit
  • Remove the current measurement jumper on the SAMC21 (highlighted in hardware setup with letter A) and connect to channel

    A of power debugger using burg connectors (highlighted in hardware setup with letter B) as shown in the Hardware Setup figure

  • Probe Pin #9 (PA28 - Switch pin) and Pin #10 (PA27 - wake-up test pin) on Extension Header 3 (EXT3) as highlighted in the Hardware Setup figure to measure wake-up time
  • Connect a USB cable to the DEBUG USB port for programming
  • Connect a USB cable to the power debugger DEBUG USB port for current measurement
Note:
  • Make sure common ground is connected with the board while using logic analyzer/CRO.
  • SAMC21 supports both 3.3V and 5V. The SAMC21 Xplained Pro kit operates at 3.3V since the VCC-SEL jumper on board is set to 3.3V.

Programming Hex File

The pre-built hex file can be programmed by following the below steps.

Steps to program the hex file:
  • Open MPLAB X IDE
  • Close all existing projects in IDE, if any project is opened.
  • Go to File -> Import -> Hex/ELF File.
  • In the Import Image File window,
    1. Create Prebuilt Project,
      • Click the Browse button to select the prebuilt hex file.
      • Select Device as ATSAMC21J18A.
      • Ensure the proper tool is selected under Hardware Tool and click on Next button.
    2. Select Project Name and Folder,
      • Select appropriate project name and folder and click on Finish button
  • In MPLAB X IDE, click on Make and Program Device button to program the device.
  • Follow the steps in Running the Demo section below.

Programming/Debugging Application Project

  • Open the project (low_power\firmware\sam_c21_xpro.X) in MPLAB X IDE.
  • Ensure SAMC21 Xplained Pro (EDBG) is selected as hardware tool to program/debug the application.
  • Build the code and program the device by clicking on the Make and Program button in MPLAB X IDE tool bar.
  • Follow the steps in Running the Demo section below.

Running the Demo

  • Open Tera Term, connect to serial console. If there is any connection issue on tera terminal, unplug the USB cable connected to Micro-B port, and reconnect it back.
  • Change the baud rate to 115200.
  • Perform a reset by pressing the RESET switch.
  • Cover the light sensor on the I/O Xplained Pro board by placing the hand over it (or another element to put the light sensor in a dark environment) to print the temperature and message on the terminal. The user 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.
  • The user should see the temperature values (in °F) getting printed on the terminal every 500 milliseconds for the duration the light sensor is covered.
  • Observe Current Consumption on MPLAB Data Visualizer.
    Note: The MPLAB Data Visualizer is a program that processes and visualizes data. The MPLAB 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 a correlation of code execution and power consumption when used together with a supported probe or board.
    • Open the Data Visualizer application from the MPLAB X IDE, and the Power Debugger CMSIS-DAP will be visible on the connection Control Panel.
    • Once the MPLAB Data Visualizer is connected to the Power Debugger, different interfaces will appear. Select the Power interface, click on the Power Settings icon and then click on the Calibrate button.
    • Note: Before calibrating the power, disconnect the SAMC21 Xplained Pro Evaluation Kit from the Power Debugger device. Once the 'Calibration Successful' message appears, reconnect the devices.
    • Select the Plot Raw in the “Start visualizing data” panel and then click Close
    • On the right-hand side of the Time Plot window, the image below shows the device in Standby mode; smaller peaks are the 500ms timer expiry peaks.
      • Note: Disconnect the wake-up test (PA27) and switch pin (PA28) connected from the Logic Analyzer for the power measurements.
    • Cover the light sensor on the IO Xplained Pro board (by placing the 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 the 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.
      Note: Above results highlight the power consumption is lower in Standby mode than in Idle mode.
  • 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.
    • 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.
    • The following image shows the wake-up time from Idle mode.

      By observing the outputs, the user can conclude that the wake-up time is greater in Standby mode than in Idle mode.

Comments