Download presentation
Presentation is loading. Please wait.
1
Embedded System Design Techniques™:
Mastering the ARM© Cortex-M© Processor Class 5: Low Power Design Techniques May 22, 2015 Jacob Beningo, CSDP
2
Course Overview Overview of STM32 ARM Cortex-M0+
Project Setup and Compilation ARM Cortex-M Architecture Writing Embedded Software with CMSIS Low Power Design Techniques
3
Session Overview Energy Profiling Wait for Interrupt Sleep-on-exit
Low Power Modes Low Power Example
4
Introduction So what is the problem? Consumer Level
Demand for longer battery lives Devices are used more often for longer periods of time Engineering Level Short design cycles Management Decisions Lack of low power experience Use of Proper tools
5
Energy Profiling 3.7 V Energy Profile Key Points
Power profile can be calculated from A x V Energy Profile can be approximated by current only! Integrating the energy profile will provide mAh used Can be used to identify heavy energy usage periods Can be used to estimate battery discharge time
6
Energy Profile – STM32CubeMx
7
Low Power Modes – STM32Lx
8
Low Power Mode Summary
9
Power Mode Registers
10
WFI vs WFE if(WakeupType == POWER_WAKE_WFI) { /* Wait For Interrupt */ __WFI(); } else /* Wait For Event */ __SEV(); __WFE();
11
Sleep on Exit
12
Wakeup Considerations
13
STM32 Sleep Mode Example DEBUGGER WARNING!
void Power_ModeStop(PowerWake_t WakeupType) { uint32_t temp = 0; temp = PWR->CR; temp &= (uint32_t)~(PWR_CR_PDDS | PWR_CR_LPSDSR); PWR->CR = temp; SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; if(WakeupType == POWER_WAKE_WFI) __WFI(); } WARNING! DEBUGGER Sleep
14
STM32 Sleep Mode Example // Enable the SYSCFG block RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; // Setup Interrupts on GPIO C13 SYSCFG->EXTICR[3] |= SYSCFG_EXTICR4_EXTI13_PC; // set pin to use // Configure GPIO C13 as an external interrupt for falling edge EXTI->IMR |= EXTI_IMR_IM13; // unmask interrupt EXTI->EMR |= EXTI_EMR_EM13; // unmask event EXTI->RTSR &= ~EXTI_RTSR_TR13; // set rising edge EXTI->FTSR |= EXTI_FTSR_TR13; // set falling edge // Interrupt to enable for button NVIC_EnableIRQ(EXTI4_15_IRQn);
15
STM32 Sleep Mode Example void EXTI4_15_IRQHandler(void) { if (EXTI->PR & (1<<13)) // clear pending interrupt EXTI->PR |= (1<<13); } void Tsk_1000ms(void) Power_ModeStop(POWER_WAKE_WFI);
16
Tips for Energy Conservation
Tip #1 – Turn Off Unused Module and Clocks If it is not being used then don’t let it consume energy! Clock gating stops the peripheral from causing logic to switch which uses energy P = C * F * Vcc2 + IL * Vcc
17
Tips for Energy Conservation
Tip #2 – Use a LPT or RTC Lower Energy Usage due to slower OSC Used to interrupt system and wake up from extremely low power state
18
Tips for Energy Conservation
Tip #3 – Beware Communication Channels Can be power hungry peripherals May require periodic waking Use DMA to lighten the Load Can keep the CPU asleep Transfer data from peripheral to memory Uart Serial Wake-Up Peripheral Sleeps until data is received Wakes up and then performs functions
19
Tips for Energy Conservation
Tip #4 – Use Energy Profiling Tools
20
Tips for Energy Conservation
Tip #5 - Think Outside the Box USB Device USB Host D+ D- USB Device USB Host Tx Rx
21
Additional Resources Download Course Material for
Updated C Doxygen Templates (May 2015) Example source code Templates Microcontroller API Standard EDN Embedded Basics Articles Embedded Bytes Newsletter From under - Blog and Articles > Software Techniques > CEC Mastering ARM Cortex-M
22
Jacob Beningo Newsletters P.O. Box 400 Embedded Bytes
Linden, Michigan 48451 Newsletters Embedded Bytes Training MicroPython Bootloaders Low Power Design Real-time Software C/C++ Embedded : : : Jacob_Beningo : Beningo Engineering : JacobBeningo : Embedded Basics Jacob Beningo Principal Consultant 22
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.