娇小w搡bbbb搡bbb,《第一次の人妻》,中国成熟妇女毛茸茸,边啃奶头边躁狠狠躁视频免费观看

歷史上的今天

今天是:2025年03月29日(星期六)

2019年03月29日 | USART從低功耗模式喚醒STM32F0

發(fā)布者:陳熙瓊 來(lái)源: eefocus關(guān)鍵字:USART  低功耗模式  喚醒  STM32F0 手機(jī)看文章 掃描二維碼
隨時(shí)隨地手機(jī)看文章

STM32F0的低功耗模式

詳細(xì)內(nèi)容見(jiàn)參考手冊(cè)—Power control (PWR)


在STM32應(yīng)用中,為了降低功耗共有以下三種工作模式:


Sleep mode 

CPU clock off, all peripherals including ARM? Cortex?-M0 core peripherals like NVIC, SysTick, etc. are kept running.. 

In Sleep mode, only the CPU is stopped. All peripherals continue to operate and can wake up the CPU when an interrupt/event occurs.

Stop mode 

all clocks are stopped 

(Stop mode achieves very low power consumption while retaining the content of SRAM and registers. All clocks in the 1.8 V domain are stopped, the PLL, the HSI RC and the HSE crystal oscillators are disabled. The voltage regulator can also be put either in normal or in low power mode. 

The device can be woken up from Stop mode by any of the EXTI lines. The EXTI line source can be one of the 16 external lines and RTC.)

Standby mode 

1.8V domain powered-off 

The Standby mode is used to achieve the lowest power consumption. The internal 

voltage regulator is switched off so that the entire 1.8 V domain is powered off. The 

PLL, the HSI RC and the HSE crystal oscillators are also switched off. After entering Standby mode, SRAM and register contents are lost except for registers in the RTC domain and Standby circuitry. 

The device exits Standby mode when an external reset (NRST pin), an IWDG reset, a rising edge on the WKUP pins, or an RTC event occurs.

備注: 

The RTC, the IWDG, and the corresponding clock sources are not stopped by entering Stop or Standby mode.


另外,在正常工作模式(Run mode)下,可以通過(guò)以下方法有效降低功耗:


降低系統(tǒng)時(shí)鐘(system clocks)


關(guān)閉不需要的APB和AHB外設(shè)時(shí)鐘


三種低功耗模式對(duì)比 


Low-power mode summary


官網(wǎng)參考資料

STM32F0-參考手冊(cè)–>6 Power control (PWR) 

RM0360 Reference manual STM32F030x4/x6/x8/xC and STM32F070x6/xB 

STM32F0-數(shù)據(jù)手冊(cè)–>3.5 Power management 

DS9773 STM32F030x4 STM32F030x6 STM32F030x8 

STM32F0-編程手冊(cè)–>2.5 Power management 

PM0215 STM32F0xxx單片機(jī)編程手冊(cè) 

STM32F0-應(yīng)用筆記 

如何使用USART或LPUART從低功耗模式喚醒STM32F0 / F3 / L0 / L4微控制器


官方參考代碼

應(yīng)用平臺(tái):STM32F030


main.c


#include "stm32f0xx.h"

/* Private variables ---------------------------------------------------------*/

uint8_t DataReceived = 0;

extern __IO uint8_t InterruptCounter;

/* Private function prototypes -----------------------------------------------*/

static void USART_Config(void);

static void WakeUp_StartBitMethod(void);

static void RestoreConfiguration(void);


/**

  * @brief   Main program

  * @param  None

  * @retval None

  */

int main(void)

{    

  /* Initialize LEDs available  ***********************************************/

  STM_EVAL_LEDInit(LED);


  /* USART configuration */

  USART_Config();


  /* Wake up from USART STOP mode by Start bit Method */

  WakeUp_StartBitMethod();


  /* Configure SystemClock*/

  RestoreConfiguration();


  /* Configure and enable the systick timer to generate an interrupt each 1 ms */

  SysTick_Config((SystemCoreClock / 1000));


  while (1)

  {}

}


/**

  * @brief  Start Bit Method to Wake Up USART from Stop mode Test.

  * @param  None

  * @retval None

  */

static void WakeUp_StartBitMethod(void)

  /* Configure the wake up Method = Start bit */ 

  USART_StopModeWakeUpSourceConfig(USART1, USART_WakeUpSource_StartBit);


  /* Enable USART1 */ 

  USART_Cmd(USART1, ENABLE);


  /* Before entering the USART in STOP mode the REACK flag must be checked to ensure the USART RX is ready */

  while(USART_GetFlagStatus(USART1, USART_FLAG_REACK) == RESET)

  {}


  /* Enable USART STOP mode by setting the UESM bit in the CR1 register.*/

  USART_STOPModeCmd(USART1, ENABLE);


  /* Enable the wake up from stop Interrupt */ 

  USART_ITConfig(USART1, USART_IT_WU, ENABLE);   


  /* Enable PWR APB clock */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);


  /* Enter USART in STOP mode with regulator in low power mode */

  PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);


  /* Waiting Wake Up interrupt */

  while(InterruptCounter == 0x00)

  {}


  /* Disable USART peripheral in STOP mode */ 

  USART_STOPModeCmd(USART1, DISABLE);


  while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET)

  {}

  DataReceived = USART_ReceiveData(USART1);


  /* Clear the TE bit (if a transmission is on going or a data is in the TDR, it will be sent before efectivelly disabling the transmission) */

  USART_DirectionModeCmd(USART1, USART_Mode_Tx, DISABLE);


  /* Check the Transfer Complete Flag */

  while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)

  {}


  /* USART Disable */

  USART_Cmd(USART1, DISABLE);

}


/**

  * @brief Configure the USART Device

  * @param  None

  * @retval None

  */

static void USART_Config(void)

  USART_InitTypeDef USART_InitStructure;

  GPIO_InitTypeDef GPIO_InitStructure; 

  NVIC_InitTypeDef NVIC_InitStructure;


  /* Enable GPIO&USART clock */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA , ENABLE);  

  RCC_APB1PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);


  /* Configure the HSI as USART clock */

  RCC_USARTCLKConfig(RCC_USART2CLK_HSI);


  /* USARTx Pins configuration **************************************************/  

  /* Connect pin to Periph */

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_1);    

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_1); 


  /* Configure pins as AF pushpull */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOA, &GPIO_InitStructure); 


  /* USARTx configured as follow:

  - BaudRate = 115200 baud  

  - Word Length = 8 Bits

  - Stop Bit = 1 Stop Bit

  - Parity = No Parity

  - Hardware flow control disabled (RTS and CTS signals)

  - Receive and transmit enabled

  */


  USART_DeInit(USART1);

  USART_InitStructure.USART_BaudRate = 115200;

  USART_InitStructure.USART_WordLength = USART_WordLength_8b;

  USART_InitStructure.USART_StopBits = USART_StopBits_1;

  USART_InitStructure.USART_Parity = USART_Parity_No;

  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  USART_Init(USART1, &USART_InitStructure);


  /* USART2 IRQ Channel configuration */

  NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPriority = 0x01;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

}


/**

  * @brief  Restore peripheral config before entering STOP mode.

  * @param  None

  * @retval None

  */

static void RestoreConfiguration(void)

{

  __IO uint32_t StartUpCounter = 0, HSEStatus = 0;


  /* SYSCLK, HCLK, PCLK configuration ----------------------------------------*/    

  /* Enable HSE */    

  RCC_HSEConfig(RCC_HSE_ON);


  /* Wait till HSE is ready and if Time out is reached exit */

  HSEStatus = RCC_WaitForHSEStartUp();


  if (HSEStatus == (uint32_t)0x01)

  {

    /* Enable Prefetch Buffer */

    FLASH_SetLatency(FLASH_Latency_1);


    /* HCLK = SYSCLK */

    RCC_HCLKConfig(RCC_SYSCLK_Div1); 


    /* PCLK = HCLK */

    RCC_PCLKConfig(RCC_HCLK_Div1);


    /*  PLL configuration:  = HSE *  6 = 48 MHz */

    RCC_PREDIV1Config(RCC_PREDIV1_Div1);

    RCC_PLLConfig(RCC_PLLSource_PREDIV1, RCC_CFGR_PLLMULL6);


    /* Enable PLL */

    RCC_PLLCmd(ENABLE);


    /* PLL as system clock source */

    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

  } 

}


stm32f0xx_it.c


/* Includes ------------------------------------------------------------------*/

#include "stm32f0xx_it.h"

/* Private variables ---------------------------------------------------------*/

__IO uint8_t InterruptCounter = 0x00;

__IO uint8_t Counter = 0;


/**

  * @brief  This function handles SysTick Handler.

  * @param  None

  * @retval None

  */

void SysTick_Handler(void)

{  

  if (Counter == 20)

  {

    /* Toggle LED's */

    STM_EVAL_LEDToggle(LED);


    /* Reset Counter */

    Counter = 0;

  }

  else

  {

    /* increment Counter */

    Counter++; 

  }

}


/**

* @brief  This function handles USART interrupt request.

* @param  None

* @retval None

*/

void USART1_IRQHandler(void)

{

  if (USART_GetITStatus(USART1, USART_IT_WU) == SET)

  { 

    /* Clear The USART WU flag */  

    USART_ClearITPendingBit(USART1, USART_IT_WU);

    InterruptCounter = 0x01;

  }

}


實(shí)際參考代碼

然而,在STM32F030中不能配置為USART的start位喚醒。


#define USART_IT_WU ((uint32_t)0x00140316) /*!< Not available for STM32F030 devices */


解決辦法,配置USART的接收非空中斷:USART_IT_RXNE 


這里寫(xiě)圖片描述

關(guān)鍵字:USART  低功耗模式  喚醒  STM32F0 引用地址:USART從低功耗模式喚醒STM32F0

上一篇:Stm32待機(jī)模式的進(jìn)入與喚醒
下一篇:STM32之低功耗——WKUP待機(jī)喚醒(LCD顯示)

推薦閱讀

  據(jù)Digital Trends網(wǎng)站報(bào)道,可穿戴技術(shù)普及程度在逐年提高。我們看到,健身追蹤器銷售飆升,智能珠寶開(kāi)始獲得成功,奢侈品牌在通過(guò)混合智能手表開(kāi)始進(jìn)軍這一領(lǐng)域。但是,在可穿戴科技的早期用戶中,真正的智能手表是最受歡迎的選擇之一。華為和LG這樣的大品牌提供運(yùn)行谷歌Wear OS操作系統(tǒng)(以前稱為Android Wear)智能手表平臺(tái)的設(shè)備,而蘋(píng)果公司則提...
季晨那輛曾經(jīng)令人艷羨的特斯拉Model S 70D如今已滿是灰塵。 過(guò)去近600個(gè)日夜里,這輛花費(fèi)近百萬(wàn)的豪車一直停放在北京來(lái)廣營(yíng)特斯拉特約維修中心。它的主人,還在堅(jiān)持與特斯拉中國(guó)對(duì)簿公堂。 近期接受《北京青年報(bào)》采訪時(shí),回憶起一年多前那場(chǎng)車禍,季晨依然心有余悸。 2017年8月20日凌晨4點(diǎn),他駕車從石景山回家。經(jīng)過(guò)輔路時(shí),突然車輛往右后方一沉,隨...
代碼很簡(jiǎn)單如下:#include <avrio.h>#include <avrinterrupt.h>#include <avreeprom.h>#include <util/delay.h>#include<math.h>#include<string.h>#include<stdio.h>#include<stdlib.h>int main(void){ uint8_t Edata=0; uint16_t t = 0x19F; //eeprom_write_byte((uint8_t*) t,0x55); Edata=eeprom_read_byte ((uint8_t*...
據(jù)相關(guān)媒體報(bào)道,在去年,蘋(píng)果公司推出一款內(nèi)部研發(fā)的定制化片上系統(tǒng)(SoC),由此開(kāi)啟了Macbook筆記本電腦系列產(chǎn)品的轉(zhuǎn)型之路。這款芯片被命名為M1,是基于臺(tái)積電的5納米半導(dǎo)體芯片所打造,也是迄今為止全球范圍內(nèi)最先進(jìn)的芯片制造工藝。盡管,M1芯片以及未來(lái)潛在的繼任產(chǎn)品旨在提升蘋(píng)果臺(tái)式電腦和筆記本電腦的性能,但如果從更高層面去看待這款芯片的設(shè)...

史海拾趣

問(wèn)答坊 | AI 解惑

跪求8255單片機(jī)交通燈控制(定時(shí)器)

跪求8255單片機(jī)交通燈控制(定時(shí)器)~~~~~~ 只學(xué)了用中斷的,定時(shí)器的真不會(huì)啊~高手幫忙下啊~有沒(méi)有以前做過(guò)的扔個(gè)程序給我啊~ 題目:采用8255并行口的交通燈的控制 南北燈2秒---綠燈2s --綠燈2s--黃燈2s 東西綠燈2S--黃燈2S--紅燈2S---綠燈2S ...…

查看全部問(wèn)答∨

C語(yǔ)言專題——標(biāo)準(zhǔn)庫(kù)

1 三角函數(shù) double sin (double); double cos (double); double tan (double); 2 反三角函數(shù) double asin (double);   結(jié)果介于[-PI/2, PI/2] double acos (double);   結(jié)果介于[0, PI] double atan (double);  ...…

查看全部問(wèn)答∨

MCU的選用

MCU的選用,重為學(xué)習(xí)可用SCT12 2052/4052,便于編程,如要做成微功耗麻雀俱全型可選用MSP430系列,…

查看全部問(wèn)答∨

8*8點(diǎn)陣 奧運(yùn)會(huì)開(kāi)幕式模擬

本帖最后由 paulhyde 于 2014-9-15 03:41 編輯 奧運(yùn)會(huì)開(kāi)幕式模擬  …

查看全部問(wèn)答∨

C#應(yīng)用程序可以對(duì)驅(qū)動(dòng)的訪問(wèn)嗎?

非使用C#編寫(xiě)驅(qū)動(dòng)程序,而是使用C#對(duì)驅(qū)動(dòng)的訪問(wèn)。 如果有,有哪些方案呢,是否能否提供些資料給我,謝謝。 我指的是USB方面的驅(qū)動(dòng)。…

查看全部問(wèn)答∨

2410的USB Host不能識(shí)別U盤(pán)!硬件問(wèn)題

生產(chǎn)的時(shí)候,所有的板子都是一樣的,系統(tǒng)也是一樣的,用的是2410的host和device復(fù)用口,配置成HOST口,一些板子能夠正常識(shí)別U盤(pán) 而一些板子卻不能識(shí)別,請(qǐng)問(wèn)這是什么原因,謝謝…

查看全部問(wèn)答∨

zstack安裝問(wèn)題 請(qǐng)大俠救我!!!

安裝ZStack-CC2430-1.4.2-1.1.0的時(shí)候老是出現(xiàn)問(wèn)題,           要怎么解決啊!!…

查看全部問(wèn)答∨

How to set up the development environment for AM335X 中文手冊(cè)

How to set up the development environment for AM335X 中文手冊(cè)…

查看全部問(wèn)答∨

調(diào)試stm32時(shí)運(yùn)行一條語(yǔ)句后進(jìn)入硬中斷HardFault_Handler

typedef struct _PARA_SET { #if STRING_STORE_USE_ARRAY     char                name[NAME_STRING_MAX];          char     &n ...…

查看全部問(wèn)答∨
小廣播
設(shè)計(jì)資源 培訓(xùn) 開(kāi)發(fā)板 精華推薦

最新單片機(jī)文章

 
EEWorld訂閱號(hào)

 
EEWorld服務(wù)號(hào)

 
汽車開(kāi)發(fā)圈

 
機(jī)器人開(kāi)發(fā)圈

電子工程世界版權(quán)所有 京ICP證060456號(hào) 京ICP備10001474號(hào)-1 電信業(yè)務(wù)審批[2006]字第258號(hào)函 京公網(wǎng)安備 11010802033920號(hào) Copyright ? 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
主站蜘蛛池模板: 安顺市| 五指山市| 什邡市| 泰州市| 德庆县| 色达县| 永安市| 溧水县| 莫力| 朝阳县| 介休市| 曲水县| 扶绥县| 和林格尔县| 邵阳市| 蚌埠市| 扶风县| 长子县| 张家界市| 洪江市| 呼图壁县| 邹城市| 本溪| 昔阳县| 锡林郭勒盟| 美姑县| 巴青县| 江川县| 阿瓦提县| 镇江市| 鹤岗市| 邵东县| 当阳市| 江永县| 济阳县| 天门市| 新干县| 迁安市| 黄龙县| 大连市| 河东区|