background image

  

 

Application Note 

29 of 38 

001-86233 Rev. *I  

 

 

2021-11-04

 

 

PSoC™ 4 MCU low

-power modes and power reduction techniques 

 

ModusToolbox™ hardware configuration

 

8

 

ModusToolbox™ hardware configuration

 

For 

ModusToolbox™ 

hardware configuration see the code example readme. The 

ModusToolbox™ 

code example 

readmes shows how to set up and configure all hardware. 

Summary of Contents for Cypress PSoC 4500S Pioneer Kit

Page 1: ...ed devices are 4000S 4100S 4100S plus 4100S plus 256KB 4100S max and 4500s Intended audience This application note is for anyone who uses PSoC 4 MCU devices Table of contents About this document 1 Table of contents 1 1 Introduction 3 2 Power mode summary 4 3 Low power mode details 6 3 1 Sleep mode 6 3 1 1 Sleep mode wakeup sources 6 3 1 2 Sleep mode transitions 7 3 1 3 Sleep mode use cases 7 3 2 D...

Page 2: ...ug interface 20 6 7 1 PSoC Creator 20 6 7 2 ModusToolbox software 20 7 Code examples 22 7 1 ModusToolbox software code examples 22 7 2 PSoC Creator projects 22 7 3 PSoC 4 MCU code examples 24 7 3 1 Power modes code example 24 7 3 2 Project 2 Low power comp 26 7 3 3 Project 3 Deep sleep ADC 26 7 3 3 1 Average power 27 8 ModusToolbox hardware configuration 29 9 PSoC Creator hardware configuration 30...

Page 3: ...vides information on active mode power saving methods and discusses other low power considerations The document assumes that you are familiar with developing applications using the ModusToolbox software environment or PSoC Creator If you are new to PSoC 4 MCU you can find an introduction in AN79953 Getting started with PSoC 4 MCU If you are new to ModusToolbox software or PSoC Creator see the Modu...

Page 4: ...rals are halted and logical states are not retained but GPIO states are retained or frozen Note Table 1 also shows that some PSoC 4 MCU devices do not support all five power modes Table 1 Power mode specs Power mode Current range typical VDD 3 3 V to 5 0 V PSoC 4000 4000S 4100S 4100S plus 4100S plus 256k 4100S max PSoC 4100 BLE PSoC 4200 BLE PSoC 4200DS PSoC 4500S PSoC 4700S PSoC analog coprocesso...

Page 5: ...Continuous time block CTB opamp and comparators ON ON ON OFF OFF Continuous time block mini CTBm opamp and comparators ADC ON ON OFF OFF OFF Low power comparators ON ON ON ON OFF GPIO output state ON ON ON ON Frozen4 1 Retention The configuration and state of the peripheral are retained The peripheral resumes its operation when the device enters active mode 2 The state of VDAC as well as any UDB b...

Page 6: ...rnal resets Stop WAKEUP asserts XRES brownout power on reset Firmware action Reset Internal reset event External reset event Firmware action Other external event Power mode Action KEY Sleep Figure 1 PSoC power mode transitions diagram Note Blocks in grey are not available in the PSoC 4000 4000S 4100S 4100S plus 4100S plus 256k 4100S max 4200DS 4500S 4700S 4100PS and analog coprocessor product line...

Page 7: ...e In deep sleep mode the high frequency clocks and peripherals that require high frequency clocks are disabled The high frequency clocks include the internal main oscillator IMO external crystal oscillator ECO and phase locked loops PLLs Note that the ECO and PLLs are not available in all PSoC 4 MCU devices The internal low speed oscillator ILO clock remains active and can be used to clock the wat...

Page 8: ...omponent s _Stop function before entering deep sleep mode and _Start after waking 3 2 4 Deep sleep mode use cases The deep sleep mode should be used when the PSoC 4 high performance analog and digital peripherals are not needed but the device still needs to be able to wake up periodically using the WDT or upon other events such as an I2 C address match Regular wakeup intervals enable periodic use ...

Page 9: ...hen be detected using the component APIs as those register states are retained Although not required you have the option to lock the state of all I O cells GPIOs by calling CySysPmfreezeIo before entering Hibernate mode The CySysPmUnfreezeIo function should be called after a wakeup from hibernate mode before the pins can again change state Using these functions prevents unexpected GPIO transitions...

Page 10: ...entering stop mode with the CySysPmSetWakeupPolarity function Exit from stop mode occurs when the dedicated pin wakeup is triggered the reset signal goes LOW or if power is cycled Upon exiting stop mode PSoC 4 MCU resets Upon return to active mode after reset you can call CySysPmGetResetReason to determine whether stop mode was exited by toggling the wakeup pin or a power cycle After a wakeup pin ...

Page 11: ...et Deep sleep GPIO interrupt Interrupt Low power comparator Interrupt CTB CTBm comparator Interrupt SCB I2 C address match Interrupt WDT5 Interrupt or device reset XRES external reset pin 6 Device reset Hibernate GPIO interrupt Device reset Low power comparator Device reset XRES external reset pin 6 Device reset Stop WAKEUP pin P0 7 Device reset XRES external reset pin 6 Device reset ModusToolbox ...

Page 12: ...isable TCPWM MY_TCPWM_CNT_NUM Restart the peripheral by calling the _Enable function It is recommended that the peripheral be re initialized before enabling Initialize the peripheral Cy_TCPWM_Counter_Init TCPWM MY_TCPWM_CNT_NUM config Enable the peripheral Cy_TCPWM_Counter_Enable TCPWM MY_TCPWM_CNT_NUM Some peripherals such as the TCPWM may need to be trigger started This is a software trigger tha...

Page 13: ...initialized to its default state Wake the Component MyComponent_Wakeup _Sleep and _Stop both result in the same amount of power savings The difference lies in whether the component needs to resume from exactly where it left off 5 3 Run components at a lower speed Clocked integrated circuits consume more current as their clock rates increase This is because parasitic and designed capacitances are c...

Page 14: ...sistance changes Figure 2 Typical thermistor application The ADC can be turned OFF when not in use but external components still consume power because the current path through the resistor and thermistor remains A simple solution with PSoC 4 MCU is to use a second pin as a switch to ground as Figure 3 shows Figure 3 Using a GPIO as a ground switch In this configuration the current flow can be stop...

Page 15: ...in parallel The DMA engine can be used in both active and sleep modes to transfer data with no CPU use The power saved is either the difference between CPU active and CPU stop power modes if the CPU can be halted or lower CPU active current if the CPU can be clocked at a slower frequency and still get the same work done The following devices support DMA 4000DS 4100 BLE 4100M 4100PS 4100S plus 4100...

Page 16: ... device is idle but the average current consumption is higher because of the time spent in active mode Figure 4 is a representation of the current consumption of this example with the system clocks set at 3 MHz Average current Current Time Active Sleep Figure 4 Example current profile with 3 MHz clock Depending on the tasks or calculations that are being performed when the PSoC 4 MCU device is awa...

Page 17: ...s With a 12 MHz clock the time spent in active mode is about half as long as with a 3 MHz clock Figure 7 shows that the peak current consumption is greater when the clocks are faster but the overall average is lower A B C D E A Wake from sleep B Read sensor data C Manipulate data D Transmit result E Go back to sleep Current Time Figure 6 Analysis of tasks in active mode at 12 MHz Average current C...

Page 18: ...GPIOs during low power operation If holding a digital output pin at logic 1 or 0 is best then use the GPIO or Pin _Write function to set it ModusToolbox software Set MyPin to 0 for low power Cy_GPIO_Write MYPIN_0_PORT MYPIN_0_NUM 0u Configure all unused GPIOs to analog High Z unless there is a specific reason to use a different drive mode A port wide drive mode may be set using the _SetDriveMode f...

Page 19: ...hot mode the ADC samples only when triggered by software or hardware 6 6 Deep sleep and hibernate regulators PSoC 4 MCU has two low power regulators that are used to maintain logic states in deep sleep and hibernate The deep sleep regulator supplies the circuits that remain powered in deep sleep mode such as the ILO and SCB The deep sleep regulator is available in all power modes except the hibern...

Page 20: ...is attached even if the PSoC 4 MCU device is not in debug mode 6 7 1 PSoC Creator Debug interface pins are set to GPIO mode on all chips from the factory but a new PSoC Creator project sets them to SWD mode by default The registers that control the debug interface can be changed only at programming time Use the System tab in the cydwr file of the PSoC Creator project to set the pins to GPIO mode a...

Page 21: ...ide the PSoC MCU device This means that the only thing you cannot do is attach the debugger to a running project If the pins are in SWD mode either of the following things should be done before entering a low power mode to achieve minimum power pull the pins up or down using external components or change the pin mode to High Z It is recommended that you set the debug interface pins to GPIO mode fo...

Page 22: ... can be chosen either mtb example psoc4 power modes and mtb example psoc4 deep sleep adc can then be selected 7 2 PSoC Creator projects Three projects are included with this application note for all PSoC 4 MCU devices and one project for PSoC 4100PS to demonstrate several of the concepts discussed in this application note All the source code for each example is included in its main c file and is h...

Page 23: ...001 86233 Rev I 2021 11 04 PSoC 4 MCU low power modes and power reduction techniques Code examples Figure 11 Select the device selector option 3 Select the appropriate device from the pop up menu that appears as Figure 12 shows ...

Page 24: ... is located on GitHub at mtb example psoc4 power modes you can easily compare all sleep and deep sleep modes with active mode To change the power mode the device is in press the on board button longer than two seconds to put the device into Deep Sleep To switch the device into sleep mode press the button between 200 ms and two seconds This allows the device to easily switch power modes so that the...

Page 25: ..._SLEEP After this selection is made build the project and program the device The project starts in active mode until the switch on the development board is pressed The LED flashes quickly according to the number of times assigned to the power mode constant In this example the LED flashes twice for deep sleep The project stays in the low power mode until the switch is pressed again It then flashes ...

Page 26: ... 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 t...

Page 27: ...es is consistent This period of the firmware is about 1 second So if you add up the time that the PSoC 4 MCU device stays in Active and deep sleep modes in one period it would be about 1 second First measure the current consumption and the time that the device stays in active mode Figure 15 shows that the duration in active mode is about 630 µs and it consumes about 5000 µA 5 0 mA during that time...

Page 28: ...tive Total Unit Time ms 999 4 0 63 1000 ms Current µA 3 5 5000 µA Time I 3498 3150 6648 ms µA Average current 6 7 µA To put all this into perspective if this project were running on a 300 mAh battery without using the low power mode the battery life would be about 60 hours 300 mAh 5 mA With power mode cycling the same 300 mAh battery would last almost 44 800 hours or over 5 years Of course the dut...

Page 29: ...power modes and power reduction techniques ModusToolbox hardware configuration 8 ModusToolbox hardware configuration For ModusToolbox hardware configuration see the code example readme The ModusToolbox code example readmes shows how to set up and configure all hardware ...

Page 30: ...dwired to the onboard KitProg USB to UART bridge Table 6 Pin mapping across PSoC MCU prototyping kits Function CY8CKIT 049 PSoC 4200 CY8CKIT 043 PSoC 4200M CY8CKIT 147 PSoC 4100PS Blue LED active HIGH P1 6 P1 6 P0 2 Switch active LOW P0 7 P0 7 P0 3 UART Tx P4 1 P7 1 P0 5 Other compatible pins also can be used to connect to the UART Tx On CY8CKIT 049 and CY8CKIT 043 the pins listed in the table are...

Page 31: ...switch that are compatible with CY8CKIT 042 Power can be provided from one of the P4VDD pins on the side or through the USB connector at the end Figure 17 shows the kit hardware Figure 17 CY8CKIT 049 42xx kit hardware This kit does not have a built in debugger but it includes a USB to serial adapter that can be used to bootload the project The projects must first be modified to include a bootloada...

Page 32: ... be provided from one of the P4VDD pins on the side or through the USB connector at the end To measure the project current with the kit when the kit is powered from the USB port remove the zero ohm resistor R22 and add pins or wires in J4 that can be connected to an ammeter or DMM Figure 18 shows the kit hardware LED P1 6 PSoC 4200M Target KitProg Power Jumper J4 Switch P0 7 Figure 18 CY8CKIT 043 ...

Page 33: ... currents in deep sleep hibernate and stop modes a good technique is to use a zero or low resistance shunt until the device enters low power mode After entering low power mode the code should keep the device in that mode and switch to a high resistance shunt for current measurement As an alternative to relying on the DMM shunt both kits include a place for a shunt resistor CY8CKIT 049 42xx has a z...

Page 34: ...do not share all the same blocks 2 Pinouts change from kit to kit Some pins may need to be moved See the Pin layout tab in PSoC Creator To port the code to a new device in PSoC Creator select Project Device selector and change to the target device In some cases a resource used by a code example for example an IP block is not supported on another device In that case the example will not work If you...

Page 35: ...r reduction techniques Summary 12 Summary Power consumption can make the difference between a good idea and a successful design By taking advantage of the many power saving features available in PSoC 4 MCU you can optimize your design and ensure that it consumes the lowest amount of power ...

Page 36: ... application notes give you more information relating to topics that are not fully discussed here 1 AN79953 Getting started with PSoC 4 MCU 2 AN85951 PSoC 4 and PSoC 6 MCU CAPSENSE design guide 3 AN86439 PSoC 4 Using GPIO pins 4 AN90114 PSoC 4000 MCU family low power system design techniques 5 AN77900 PSoC 3 and PSoC 5LP MCU low power modes and power reduction techniques ...

Page 37: ... C 2015 06 19 Clarified retention of UDBs when exiting deep sleep and hibernate in Table 2 Cleaned up several minor typos D 2015 08 24 Updated the document for PSoC 4200L MCU Updated the power calculation spreadsheet E 2015 12 31 Updated the projects to PSoC Creator 3 3 SP1 F 2016 03 22 Updated the document for PSoC analog coprocessor Updated the power calculation spreadsheet G 2017 10 04 Updated ...

Page 38: ...on note The data contained in this document is exclusively intended for technically trained staff It is the responsibility of customer s technical departments to evaluate the suitability of the product for the intended application and the completeness of the product information given in this document with respect to such application For further information on the product technology delivery terms ...

Reviews: