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

歷史上的今天

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

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

發布者:陳熙瓊 來源: eefocus關鍵字:USART  低功耗模式  喚醒  STM32F0 手機看文章 掃描二維碼
隨時隨地手機看文章

STM32F0的低功耗模式

詳細內容見參考手冊—Power control (PWR)


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


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)下,可以通過以下方法有效降低功耗:


降低系統時鐘(system clocks)


關閉不需要的APB和AHB外設時鐘


三種低功耗模式對比 


Low-power mode summary


官網參考資料

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

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

STM32F0-數據手冊–>3.5 Power management 

DS9773 STM32F030x4 STM32F030x6 STM32F030x8 

STM32F0-編程手冊–>2.5 Power management 

PM0215 STM32F0xxx單片機編程手冊 

STM32F0-應用筆記 

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


官方參考代碼

應用平臺: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;

  }

}


實際參考代碼

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


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


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


這里寫圖片描述

關鍵字:USART  低功耗模式  喚醒  STM32F0 引用地址:USART從低功耗模式喚醒STM32F0

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

推薦閱讀

  近日消息傳出中國聯通將于2018年4月1日起,新開用戶將不再支持2G網絡,2019年徹底關閉所有聯通用戶的2G網絡。下面就隨網絡通信小編一起來了解一下相關內容吧。一個時代即將終結 傳聯通明年關停全部2G網絡  實際上,早在兩年前,以中國聯通和中國移動為首的國內運營商就已經開始籌劃關閉2G網絡。眼下,中國聯通已經陸續在一些地區下發了關閉2G網絡的...
3月28-31日,第二十屆深圳國際機械制造工業展覽會(SIMM 2019)深圳會展中心隆重舉辦,作為國內機械自動化行業大型盛會,本次展會重點展示了機器人、機床、3D打印、智能裝備等機械自動化產品,并帶來了眾多3C電子、汽車制造、金屬加工、機械等領域的制造技術和方案。近年來,智能制造模式已經成為現代制造業發展的主要方向,越來越多的企業開始利用人工智...
如今,可以執行基本任務的自動化已經在大型企業中占有一席之地,企業的首席信息官們正在尋求為業務流程帶來更高的效率。 這項技術被稱為機器人流程自動化(RPA),它使IT部門能夠配置或訓練軟件來執行日常任務,例如生成對郵件的自動響應;或者處理更復雜的工作,例如保險系統中的流程。與和人工智能(組織也采用這些技術實現工作負載的自動化運行)不同...
文/陳根作為新一輪產業變革的核心驅動力,人工智能將深刻改變人類生產生活方式,推動社會生產力的整體躍升。同時,人工智能的廣泛應用給就業市場帶來的影響也引發了社會高度關注和擔憂。當前,人工智能在全球范圍內的加速發展引發各國高度關注,無論是簡單的機械動作還是復雜的感知任務,人工智能所展現出的實力都可圈可點。并且,隨著機器學習、大數據以及計算能...

史海拾趣

問答坊 | AI 解惑

運放的一些資料

感覺挺好就上傳上來了…

查看全部問答∨

電源紋波噪聲測試注意事項 (zt)

今天的電子電路(比如手機、服務器等領域)的切換速度、信號擺率比以前更高,同時芯片的封裝和信號擺幅卻越來越小,對噪聲更加敏感。因此,今天的電路設計者們比以前會更關心電源噪聲的影響。實時示波器是用來進行電源噪聲測量的一種常用工具,但是 ...…

查看全部問答∨

WinCE5.0網絡開發的若干問題

各位大人~~~~        最近用C#在WinCE5.0系統下開發一個簡單的小游戲,有網絡連接功能(能兩個人一個玩,像QQ的找茬一樣),使用TCP/IP傳輸協議。實驗箱是博創的UP-NETARM2410-s。現在遇到一個很大的問題,就是用網 ...…

查看全部問答∨

有人在6410上移植過ucos嗎?

使用stepstone,如何將booterload和ucos整合在一起。…

查看全部問答∨

wince新手:build新建項目出錯啦:Command returned non-zero exit code 1 (dec),跪求答案

build run-time image時出現錯誤.請大蝦指教。從網上看到在項目->屬性->配置屬性->Build Option->Run-time image can be larger than 32MB(IMGRAM64=1)復選框給選中了,還是不行。 我用的是vs2005+windows embbeded 6.0…

查看全部問答∨

DIY電源面板PCB

DIY電源面板PCB已經布好了。。。供大家拍磚! TOP: BOTTOM: …

查看全部問答∨

電源構建中布局的注意事項

本文大概就是講講散熱設計,并列舉在自然條件及強制通風條件制冷環境下溫度上升計算的范例。 看起來很厲害,小編也不太懂的。還有DC寄生現象等等等。 大家下來看看咯。。。 好羨慕大家都能看懂。。。…

查看全部問答∨

瑞薩DIY獲獎感言

    首先,很感謝瑞薩和EEWORLD推出這樣的活動。以前聽朋友說過日系單片機的抗干擾能力相當好,一直沒機會接觸到,很高興有這次試用機會。這些年也用過不少廠家的MCU,但是這一次的試用印象非常深刻。     瑞薩單片機是我用過 ...…

查看全部問答∨

CCS的SVPWM波形圖誰有啊急用

最好有標注是那一塊的波形     3-4張就可以了     謝謝  只要CCS調試出的SVPWM波形 …

查看全部問答∨

程序中有一個關于重復定義的問題,求解答

Error[e27]: Entry \"Delay5ms\" in module play ( F:\\工程\\Debug\\Obj\\play.r43 ) redefined in module playmain ( F:\\工程\\Debug\\Obj\\playmain.r43 )    具體是我的play.c中有void Delay5ms(void),然后我的playmain.c里有 ...…

查看全部問答∨
小廣播
設計資源 培訓 開發板 精華推薦

最新單片機文章
何立民專欄 單片機及嵌入式寶典

北京航空航天大學教授,20余年來致力于單片機與嵌入式系統推廣工作。

 
EEWorld訂閱號

 
EEWorld服務號

 
汽車開發圈

 
機器人開發圈

電子工程世界版權所有 京ICP證060456號 京ICP備10001474號-1 電信業務審批[2006]字第258號函 京公網安備 11010802033920號 Copyright ? 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
主站蜘蛛池模板: 凯里市| 汉沽区| 苏尼特左旗| 宜兰市| 砚山县| 巴里| 景谷| 都江堰市| 宜丰县| 永城市| 新蔡县| 航空| 镇江市| 沂南县| 旬邑县| 伊通| 大新县| 新兴县| 临城县| 龙陵县| 栖霞市| 基隆市| 任丘市| 定日县| 交口县| 宝山区| 石家庄市| 辛集市| 察隅县| 行唐县| 蓬安县| 邹平县| 平顶山市| 集贤县| 崇文区| 木里| 长治县| 南宫市| 镇赉县| 榆中县| 团风县|