我做了大量的测试,发现电源管理锁在ESP32中不生效,但是在ESP32S3中可以正常工作,我测试了IDF最新的代码(release/v5.1, release/v4.4)都是这样的情况。
我希望这不是IDF的Bug,但是我实在无法解决,请大佬们帮我看下,下面是我的代码:
// 启动时
```cpp
void app_main() {
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
#if CONFIG_PM_ENABLE
# if CONFIG_IDF_TARGET_ESP32
esp_pm_config_esp32_t pm_config = {
# elif CONFIG_IDF_TARGET_ESP32S2
esp_pm_config_esp32s2_t pm_config = {
# elif CONFIG_IDF_TARGET_ESP32C3
esp_pm_config_esp32c3_t pm_config = {
# elif CONFIG_IDF_TARGET_ESP32S3
esp_pm_config_esp32s3_t pm_config = {
# endif
.max_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ,
.min_freq_mhz = 80,
# if CONFIG_FREERTOS_USE_TICKLESS_IDLE
.light_sleep_enable = false
# endif
};
ESP_ERROR_CHECK(esp_pm_configure(&pm_config));
#endif
}
```
业务中加锁:
```
void somewhere(void) {
static esp_pm_lock_handle_t rmt_send_task_pm_lock;
ESP_ERROR_CHECK(esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "rmt_send_task",
&rmt_send_task_pm_lock));
ESP_ERROR_CHECK(esp_pm_lock_acquire(rmt_send_task_pm_lock));
// ... 业务代码
ESP_ERROR_CHECK(esp_pm_lock_release(rmt_send_task_pm_lock));
}
```
【Bug反馈】电源管理锁在ESP32中不生效,在S3中生效。
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 168 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.