Project 2: Low Power Comp; Project 3: Deep Sleep Adc - Infineon PSoC 4000S Manual

4 mcu low-power modes and power reduction techniques
Table of Contents

Advertisement

PSoC™ 4 MCU low-power modes and power reduction techniques
Code examples
7.3.2

Project 2: Low power comp

The PSoC™ Creator project (AN86233_LPComp) is available in the zip file associated with this application note.
This project demonstrates how the low-power comparator (LPComp) can be used to wake the PSoC™ 4 MCU
device from hibernate and return to active mode. Two 1-MΩ external resistors and a potentiometer, or a
voltage source must be added to the development kit to complete the project. The two resistors form a voltage
divider to provide a reference voltage that is one-half of V
The potentiometer simulates an external changing voltage that triggers an exit from hibernate back to active
mode by causing an interrupt. An interrupt occurs when the potentiometer voltage makes a transition from
higher than the reference to lower than the reference, or vice versa.
After a reset, the project is in active mode. The LED is lit anytime the project is in active mode and turned OFF in
hibernate. Pressing the kit button puts the PSoC™ 4 MCU device in hibernate mode until LPComp senses that
the input voltage is changing from above to below the reference voltage (V
You can change the code so that instead of going into hibernate when the kit button is pressed, the device goes
into sleep or deep sleep. The operation should be identical, but the power consumption differs among low-
power modes.
Note:
Currently, this project is supported only in PSoC™ Creator.
7.3.3

Project 3: Deep sleep ADC

This project works for both ModusToolbox™ software and PSoC™ Creator.
ModusToolbox™ software: The code example is located on GitHub at mtb-example-psoc4-deep-sleep-adc.
PSoC™ Creator: The project (AN86233_DeepSleepADC) is available in the zip file associated with this
application note.
This project is an example of how to periodically wake up, take a reading with the SAR ADC, do a transform on
the data, send the data out the serial port (UART), and switch back to deep sleep mode. It performs this
sequence about once a second but remains in deep sleep 99.9 percent of the time between samples to reduce
power by almost three orders of magnitude.
The project uses the ILO and a WDT (WDT0) to wake from deep sleep once a second. The ILO is a low-power
oscillator but is not very accurate, with a specification of 32 kHz –50 percent to +100 percent. The IMO, on the
other hand, is much more accurate at ±2 percent, but it requires more power and does not operate during Deep
Sleep. It always operates when the PSoC™ 4 MCU device is in active mode. You can use the IMO to calibrate the
ILO with the System ILO functions.
The ILO Trim is used to adjust the WDT0 counter period so that it is within ±10 percent. The large drift of the ILO
is mainly a function of the voltage and temperature, so you do not have to adjust the trim that often. In the
example, it is trimmed every 60th time the component wakes from deep sleep or once a minute. You can
change that from a fixed 60-second update to whenever the measured die temperature or supply voltage
changes by more than a set value. See
Note:
The WDT interrupt vector number must be updated in the project depending on the target device,
using the WDT_IRQN macro in the main.c file. To know the vector number (IRQx), see the
"Interrupts" chapter of the architecture reference manual of the target device.
Application Note
.
DDD
Figure 14
for the program flow of the example project.
26 of 38
/2 in this case), or vice versa.
DDD
001-86233 Rev. *I
2021-11-04

Advertisement

Table of Contents
loading

Table of Contents