STM8L151 低功耗模式有什么要填的的坑———— Low power wait mode,read the f**k datasheet!

AN3147说了什么:
1..1 如何进入Wait模式
Entering Wait mode
Wait mode is entered by executing the WFI or WFE assembly instruction. This stops the
CPU, but other peripherals and the interrupt controller can continue to run. When entering
Wait mode, the global interrupts are automatically enabled.

——执行WFI或者WFE的汇编命令以停止CPU,但外围和中断控制器可以继续跑。进入wait mode之后,全局中断自动使能。
 Before entering WFI mode, at least one interrupt must be enabled.
 Before entering WFE mode, at least one event source must be enabled.
——至少有有一个需要使能。

 

 

1.2. 如何退出Wait模式

Exiting Wait for interrupt mode
 I2C
 USART
 SPI
 ADC
 Comparator
 AWU/RTC
External interrupt
Timers
Clock controller (clock switch execution)
Refer to the STM8L/STM8AL reference manuals for more details. Refer to the
STM8L/STM8AL datasheets.

以上这些中断都可以唤醒等待模式。

查看RM0031 datasheet for details.

2.1Low power run mode

This mode is based on code execution from RAM, using a low speed clock source. The      
main voltage regulator (MVR) is switched off and the low power voltage regulator (LPVR) is   
used to supply the voltage to internal structures. The Flash memory is configured by
software in IDDQ mode.
The ADC is not supported in this mode, as its clock source must have a minimum frequency
of 1 MHz.
No interrupt is allowed in this mode as the interrupt vectors are located in the Flash (which is
switched off). Consequently, all interrupts must be masked.
While using this mode, you have to switch from high speed clock sources to low speed clock
sources.

数据手册对此模式的定义:

Low-power run mode: The CPU and the selected peripherals are running. Execution
is done from RAM with a low speed oscillator (LSI or LSE). Flash memory and data
EEPROM are stopped and the voltage regulator is configured in ultra-low-power mode.
The microcontroller enters Low-power run mode by software and can exit from this
mode by software or by a reset.
All interrupts must be masked. They cannot be used to exit the microcontroller from this
mode

1.使用低速晶振运行。

2.Flash和EEPROM停止运行。

3.电压调整器运行在超低功耗模式。

4.进入低功耗运行模式可以通过软件进入,退出通过软件或者重启。

5.所有的中断必须屏蔽,他们不可唤醒MCU。

——Low power run mode 代码在RAM中执行

——ADC被禁止,因为ADC始终频率要求至少1M。
——此模式中断不可用,因为中断向量存储在Flash中。所以所有的中断都应该被屏蔽。
——使用此模式的时候,把始终降下来。

Note: This mode is not available on the STM8L101xx devices.

2.2 This mode is entered by executing the following software sequence:
1. Switch off all unused peripherals, oscillators (except LSI or LSE) and analog blocks
2. Mask all interrupts
3. Jump to RAM
4. Switch system clock to LSI or LSE clock sources
5. Configure the Flash memory in IDDQ mode by setting the EEPM bit in the FLASH_CR1
register
6. Add a software delay loop to make sure the Flash/Data EEPROM are off
7. Configure the ultralow power mode for the regulator by setting the REGOFF bit in the
CLK_REGCSR register (do not confuse with the ULP bit in the PWR_CSR2 which
configures the behavior of the internal reference voltage).
Steps 1 to 4 can be performed in any order.

3.1Low power wait mode——低功耗等待模式
This mode is entered by executing a WFE instruction, while the MCU is in Low power run
mode. It can be exited only by means of an external or internal event, in this case the MCU
returns to Low power run mode. WFI instruction cannot be used, because interrupts have to
be disabled in Low power run mode.

在MCU进入LPRM之后,通过执行WFE命令进入此模式。可通过外部或者内部时间退出后再进入LPRM。WFI指令不可用,因为中断再LPRM禁止了。

Low-power wait mode: This mode is entered when executing a Wait for event in Lowpower
run mode. It is similar to Low-power run mode except that the CPU clock is
stopped. The wakeup from this mode is triggered by a Reset or by an internal or
external event (peripheral event generated by the timers, serial interfaces, DMA
controller (DMA1), comparators and I/O ports). When the wakeup is triggered by an
event, the system goes back to Low-power run mode.
All interrupts must be masked. They cannot be used to exit the microcontroller from this
mode.

低功耗等待模式:可以重启触发退出,内部、外部事件(计时器,串口,DMA,比较器和IO产生的外设事件也可激活)。

当被激活后,回到LOW POWER RUN mode.所有的中断都得屏蔽。

 

datasheet

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值