当前位置:网站首页>ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
2022-07-07 06:15:00 【晨之清风】
陈拓 2022/07/06-2022/07/06
1. 概述
该示例展示了当 ULP 通过 WAKE 指令向 RTC 控制器发送中断信号时,主程序该如何配置中断处理函数以响应该中断信号。
- RTC GPIO
RTC GPIO 一共有 18 个 IO 口,这些 GPIO 管脚具有低功耗 RTC 性能和模拟功能,并且由 ESP32 的 RTC 子系统控制。这些功能不使用 IO_MUX 和 GPIO 交换矩阵,而是使用 RTC_MUX 将 IO 指向 RTC 子系统。
当这些管脚被配置为 RTC GPIO 管脚时,作为输出的管脚能够在芯片处于 Deep-Sleep 睡眠状态下保持输出电平值,或者作为输入管脚使用时可以将芯片从 Deep-Sleep 中唤醒。
下表列出了 RTC 管脚和其对应的 GPIO 管脚
ULP 中断发送官方例程在ESP-IoT-Solution库中:
- ESP-IoT-Solution 简介
RTC GPIO
官方文档:
https://docs.espressif.com/projects/espressif-esp-iot-solution/zh_CN/latest/gettingstarted.html
- ESP-IoT-Solution 版本
不同版本的 ESP-IoT-Solution 说明如下:
- ESP-IoT-Solution 编程指南
https://docs.espressif.com/projects/espressif-esp-iot-solution/zh_CN/latest/index.html
2. 获取 ESP-IoT-Solution
- 获取命令
如果从乐鑫官方的github库下载有困难,可以先在gitee上克隆一个库,然后从gitee上下载。下面是从我克隆的库下载,我的库是私有的,你需要自己克隆一个。
- 下载esp-iot-solution v1.1
cd ~/esp
git clone -b release/v1.1 --recursive https://gitee.com/chentuo2000/esp-iot-solution.git
从gitee克隆库下载时,主体很顺利,在下载子模块时遇到麻烦,需要手动下载下面的子模块:
按照源和对应的安装路径手工下载。
如果你还下载不了,可以从下面的链接下载这3个子模块:
下载Adafruit-GFX-Library.tar.gz
https://download.csdn.net/download/chentuo2000/85481416
下载ugfx.tar.gz
https://download.csdn.net/download/chentuo2000/85481491
下载lvgl.tar.gz
https://download.csdn.net/download/chentuo2000/85481538
3. 开发环境
《用乐鑫国内Gitee镜像搭建ESP32开发环境》
https://zhuanlan.zhihu.com/p/348106034
https://blog.csdn.net/chentuo2000/article/details/113424934?spm=1001.2014.3001.5501
4. 构建项目
- 官方例程
ULP 中断发送程序的例子:
https://github.com/espressif/esp-iot-solution/tree/release/v1.1/examples/ulp_examples/ulp_send_interrupt
根据 ULP 的 WAKE 指令说明:
-- 如果主CPU处于睡眠模式,且ULP唤醒被使能,则该中断信号会唤醒主CPU;
-- 如果主CPU处于非睡眠模式,且RTC中断使能寄存器(RTC_CNTL_INT_ENA_REG)中对应的ULP中断使能位(RTC_CNTL_ULP_CP_INT_ENA)被置位,则中断信号会触发RTC控制器产生一个中断;
以下为 ULP 中断注册和中断处理函数:
- 复制官方例程
将官方例子项目复制到ESP-IDF开发工具之外:
cd ~/esp
cp -r ~/esp/esp-iot-solution/examples/ulp_examples/ulp_send_interrupt ~/esp/
- 项目树
cd ulp_send_interrupt
- 刷新esp-idf环境
get_idf
注意:每次打开终端进入sdk都要执行一次此命令
- 设定目标芯片
idf.py set-target esp32
- 清除以前的构建
- 配置项目
idf.py menuconfig
1) 设置Flash存储器大小为4MB
2) ULP默认时开启的
3) 选择Support array 'rtc_gpio_desc' fot ESP32
否则编译时会出现error: 'rtc_gpio_desc' undeclared
保存,退出。
- 编译项目
idf.py build
- 烧写项目
查看USB转串口的COM口号:
烧写:
idf.py -p /dev/ttyS3 -b 115200 flash
- 启用监视器
idf.py monitor -p /dev/ttyS3
5. 示例测试
示例启动后,ULP会一直处于周期(时间为20ms)运行状态,检测GPIO0是否被按下。在按键被按下且释放时:
-- 如果主CPU处于睡眠模式,则该操作会唤醒主CPU;
-- 如果主CPU处于非睡眠模式,则该操作会发送一个RTC中断,中断程序完成相应的处理后,将主CPU设置进入睡眠模式;
系统的日志打印如下:

边栏推荐
- What is the method of manual wiring in PCB design in 22protel DXP_ Chengdu electromechanical Development Undertaking
- Greenplum 6.x common statements
- [MySQL] detailed explanation of trigger content of database advanced
- Input of mathematical formula of obsidan
- Greenplum6.x搭建_安装
- Tronapi wave field interface - source code without encryption - can be opened twice - interface document attached - package based on thinkphp5 - detailed guidance of the author - July 6, 2022 - Novice
- Speaking of a software entrepreneurship project, is there anyone willing to invest?
- [Yu Yue education] basic reference materials of electrical and electronic technology of Nanjing Institute of information technology
- 如何在快应用中实现滑动操作组件
- SSM integration
猜你喜欢

Mountaineering team (DFS)

Greenplum6.x搭建_安装

数字三角形模型 AcWing 1027. 方格取数

Greenplum6.x监控软件搭建

数据分片介绍
![[MySQL] detailed explanation of trigger content of database advanced](/img/6c/8aad649e4ba1160db3aea857ecf4a1.png)
[MySQL] detailed explanation of trigger content of database advanced

About using CDN based on Kangle and EP panel

Interpolation lookup (two methods)

Why choose cloud native database

Pointer advanced, string function
随机推荐
Enterprise manager cannot connect to the database instance
idea里使用module项目的一个bug
路由信息协议——RIP
Componentspace2022, assertions, protocols, bindings, and configuration files
使用AGC重签名服务前后渠道号信息异常分析
Calling the creation engine interface of Huawei game multimedia service returns error code 1002, error message: the params is error
What are the advantages of commas in conditional statements- What is the advantage of commas in a conditional statement?
Pointer advanced, string function
String operation
oracle一次性说清楚,多种分隔符的一个字段拆分多行,再多行多列多种分隔符拆多行,最终处理超亿亿。。亿级别数据量
数据库存储---表分区
Grpc, oauth2, OpenSSL, two-way authentication, one-way authentication and other column directories
Greenplum 6.x common statements
Teach you how to select PCB board by hand (II)
Gson converts the entity class to JSON times declare multiple JSON fields named
Gson转换实体类为json时报declares multiple JSON fields named
Data type - integer (C language)
JS的操作
详解华为应用市场2022年逐步减少32位包体上架应用和策略
leetcode135. Distribute candy
https://github.com/espressif/esp-iot-solution