当前位置:网站首页>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设置进入睡眠模式;
系统的日志打印如下:
边栏推荐
- A bug using module project in idea
- Routing information protocol rip
- All about PDF crack, a complete solution to meet all your PDF needs
- Explain Huawei's application market in detail, and gradually reduce 32-bit package applications and strategies in 2022
- Qt Charts使用(重写QChartView,实现一些自定义功能)
- [machine learning] watermelon book data set_ data sharing
- Image segmentation in opencv
- Greenplum 6.x build_ Environment configuration
- 求有符号数的原码、反码和补码【C语言】
- A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
猜你喜欢
xray的简单使用
Componentspace2022, assertions, protocols, bindings, and configuration files
Greenplum 6.x build_ Environment configuration
Laravel8 uses passport login and JWT (generate token)
LeetCode 715. Range 模块
指针进阶,字符串函数
let const
Mountaineering team (DFS)
Pointer advanced, string function
[MySQL] detailed explanation of trigger content of database advanced
随机推荐
Opencv converts 16 bit image data to 8 bits and 8 to 16
Greenplum6.x-版本变化记录-常用手册
Download and install orcale database11.2.0.4
Why choose cloud native database
Virtual address space
POJ - 3784 running medium
注解@ConfigurationProperties的三种使用场景
POJ - 3616 Milking Time(DP+LIS)
[南京大学]-[软件分析]课程学习笔记(一)-introduction
[Nanjing University] - [software analysis] course learning notes (I) -introduction
阿里p8手把手教你,自动化测试应该如何实现多线程?赶紧码住
Markdown编辑器Editor.md插件的使用
POJ - 3616 Milking Time(DP+LIS)
Greenplum 6.x reinitialization
調用華為遊戲多媒體服務的創建引擎接口返回錯誤碼1002,錯誤信息:the params is error
【微信小程序:缓存操作】
opencv 将16位图像数据转为8位、8转16
Required String parameter ‘XXX‘ is not present
JS operation
go写一个在一定时间内运行的程序