YTM32的电源管理与低功耗系统详解

本文详细解析了YTM32微控制器的电源管理系统,包括各种功耗模式、RCU、WKU和PCU模块的作用,以及如何通过软件驱动实现低功耗模式的管理和唤醒。重点讨论了GPIO在不同模式下的唤醒能力。

YTM32的电源管理与低功耗系统详解

苏勇,2023年10月

缘起

前几天有客户在技术交流群里问,YTM32的LE产品能不能使用任意GPIO的中断将芯片从StandBy模式下唤醒?按照我对功耗管理架构的理解,常规的MCU低功耗模式分浅睡和深睡,浅睡可以用常规中断唤醒,从哪里睡着就可以从哪里醒来;深睡需要专门的唤醒模块(例如Kinetis的LLWU模块),醒来之后效果同硬件复位效果等同,入睡之前的记忆全无,整个断片了。为了确认YTM32的微控制器如我理解一致,我专门查阅了LE和ME的手册进行核实,顺带梳理了YTM32平台上的电源管理与低功耗管理系统的实际资源和工作机制。

原理与机制

深入到微控制器的内部模块,大多数软件开发者了解时钟系统的重要性,却对供电系统所知不多。诚然,供电系统在芯片上电后,就基本稳定下来,几乎不需要开发者进行任何额外的操作。不过,对于对供电敏感的应用场景,为了充分利用有限的电能,需要根据电路系统的需求,动态调整整个芯片的功耗模式,此时,就需要充分了解芯片的电源系统及功耗管理机制,以合理的方式进行编程。

YTM32微控制器的电源管理系统,涉及到电源控制单元(Power Control Unit,PCU)、唤醒单元(Wakeup Unit,WKU), 复位控制单元(Reset Control Unit,RCU)等专门的外设模块,以及低电压检测(Low Voltage Detection,LVD)、POR(Power On Reset)等电路单元,以及一个包含多种功耗模式的电源管理模型,控制和管理芯片内部的多个调压器(对应不同电压、不同带载能力)以及对多外设模块的供电开关。

在这里插入图片描述

图x YTM32B1ME的电源管理系统

以YTM32B1ME为例,图x展示了YTM电源管理系统的功能框图。其中VDD是整颗芯片的输入电压源,在芯片工作的整个生命周期中,需要保持稳定的供电。VDD25VDD11分别对应两个内部调压器的输出,其中VDD11为内部的处理器内核和逻辑电路供电。PD0(Power Domain 0)所在的供电线路是常供电的电源域,PD1(Power Domain 1)所在的供电线路在PowerDown模式下会被停电。像FIRCPLLSXOSCSXOSCSIRC等时钟发生器,若被停电,则使用这些时钟作为时钟源的外设模块也会随之停止工作。

电源管理模型的功耗模式

YTM32微控制器的电源管理体系中,按照功耗从高向低排列,最多包括:正常模式(Normal/Active)、休眠模式(Sleep)、深度休眠模式(DeepSleep)、待机模式(StandBy)及掉电模式(PowerDown)。对于使用Arm Cortex-M0+内核的YTM32B1L系列,精简了其中的PowerDown模式。其中,Normal、Sleep和DeepSleep都是基本的Arm架构低功耗模式,可按照常规操作方式,先对SCB_SCR寄存器进行配置,然后通过WFI指令进行进入Sleep或DeepSleep模式。如图x所示。

在这里插入图片描述

图x Arm内核的SCB_SCR寄存器

StandBy和PowerDown是YTM32在自家SoC上,进一步实现更低功耗的工作模式,还需要配合另外的PCU模块(Power Control Unit),设置复位相关的功能,才能正常工作。如图x所示。

在这里插入图片描述

图x 进入StandBy模式的使能开关
正常模式(Normal)

几乎所有的外设模块都可以全功能正常工作(除了像WKU这种尽在掉电模式才开始工作的模块除外)。芯片内部的调压器全部以最高性能状态工作,对绝大多数的外设模块开放供电。此时,处理器可以以最高性能运行。上电复位之后进入工作的初始状态。

休眠模式(Sleep)

CPU停止工作,内核中的部分模块仍在工作(NVIC)

### YTM32 IIC (I²C) Programming Tutorial #### Overview of I²C Configuration on YTM32B1MC0 The configuration and use of the Inter-Integrated Circuit (I²C) protocol with the YTM32B1MC0 microcontroller involve setting up specific registers to enable communication between devices over two wires: SDA (Serial Data Line) and SCL (Serial Clock Line). The setup process includes configuring clock speeds, enabling interrupts if necessary, and handling start/stop conditions as well as read/write operations. For initializing an I²C interface on a YTM32 device like the B1 series, one should refer closely to the provided demo examples which serve both demonstration purposes and detailed explanations about how each part works together[^1]. #### Key Points in Setting Up I²C Communication To establish proper I²C communication using YTM32 chips: - **Initialization**: Initialize the I²C peripheral by specifying parameters such as speed mode (standard/fast), address format, own slave address when acting as master/slave. - **Clock Control**: Adjust prescalers within the I²C module according to desired bit rates while ensuring stability under varying power supply voltages. - **Interrupt Handling**: Implement interrupt service routines that can handle events during data transfer including ACKnowledge failures, bus errors, etc., thus maintaining robustness against potential issues arising from hardware bugs similar to those reported for STM32's implementation[^2]. Here is a simplified example demonstrating initialization steps written in C language targeting GCC compiler toolchain commonly used alongside ARM Cortex-M cores found inside these MCUs: ```c #include "ytm32fxxx_hal.h" // Assume `hi2c` has been declared globally somewhere earlier... void MX_I2C_Init(I2C_HandleTypeDef* hi2c){ /* USER CODE BEGIN I2C_Init 0 */ /* USER CODE END I2C_Init 0 */ // Configure I2C settings here... } ``` This code snippet provides only placeholders where actual configurations would take place based upon application requirements. For more comprehensive guidance tailored specifically towards cloud chip products manufactured by YunTu Semiconductor Co Ltd, consulting their official reference manuals becomes essential since they contain precise instructions regarding register mappings along with other critical details pertinent to successful integration into projects involving serial communications protocols like UARTs too[^3]. #### Additional Resources Beyond direct coding practices, understanding underlying principles behind boot processes also plays a significant role especially concerning security aspects related to firmware updates via bootloader mechanisms present even at lower levels affecting higher-level functionalities indirectly through system-wide resets triggered post-update activities[^4]. Moreover, executing commands directly onto flash memory controllers could impact overall performance metrics associated with swapping out executable images stored across different regions depending upon design choices made prior to deployment phases[^5].
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值