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

歷史上的今天

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

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

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

STM32F0的低功耗模式

詳細內(nèi)容見參考手冊—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)下,可以通過以下方法有效降低功耗:


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


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


三種低功耗模式對比 


Low-power mode summary


官網(wǎng)參考資料

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

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

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

DS9773 STM32F030x4 STM32F030x6 STM32F030x8 

STM32F0-編程手冊–>2.5 Power management 

PM0215 STM32F0xxx單片機編程手冊 

STM32F0-應(yīng)用筆記 

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


官方參考代碼

應(yīng)用平臺: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 


這里寫圖片描述

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

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

推薦閱讀

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

史海拾趣

問答坊 | AI 解惑

運放的一些資料

感覺挺好就上傳上來了…

查看全部問答∨

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

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

查看全部問答∨

WinCE5.0網(wǎng)絡(luò)開發(fā)的若干問題

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

查看全部問答∨

有人在6410上移植過ucos嗎?

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

查看全部問答∨

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

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

查看全部問答∨

DIY電源面板PCB

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

查看全部問答∨

電源構(gòu)建中布局的注意事項

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

查看全部問答∨

瑞薩DIY獲獎感言

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

查看全部問答∨

CCS的SVPWM波形圖誰有啊急用

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

查看全部問答∨

程序中有一個關(guān)于重復(fù)定義的問題,求解答

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里有 ...…

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

最新單片機文章

 
EEWorld訂閱號

 
EEWorld服務(wù)號

 
汽車開發(fā)圈

 
機器人開發(fā)圈

電子工程世界版權(quán)所有 京ICP證060456號 京ICP備10001474號-1 電信業(yè)務(wù)審批[2006]字第258號函 京公網(wǎng)安備 11010802033920號 Copyright ? 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
主站蜘蛛池模板: 龙门县| 瑞昌市| 嘉峪关市| 永泰县| 娄底市| 澳门| 南平市| 门源| 通化市| 海林市| 甘洛县| 大田县| 临桂县| 安新县| 五莲县| 上思县| 龙山县| 乳山市| 乐陵市| 磐安县| 巨野县| 凤阳县| 齐河县| 兰溪市| 平度市| 蒙自县| 连南| 伊金霍洛旗| 灵寿县| 望江县| 南平市| 清河县| 综艺| 阿拉善右旗| 类乌齐县| 图木舒克市| 罗定市| 来凤县| 永安市| 温宿县| 天全县|