Closed
Description
Environment
- Development Kit: [ESP32-C3-DevKitM-1]
- Kit version : [v1]
- IDF version (run
git describe --tags
to find it):
v5.0-dev-1730-g229ed08484
f31694c9f1746ba189a4bcae2e34db15135ddb22 components/asio/asio (asio-1-12-0-201-gf31694c9)
d037ec89546fad14b5c4d5456c2e23a71e554966 components/bootloader/subproject/components/micro-ecc/micro-ecc (v1.0)
26afd7bb31c9bf1c7072b47d06293321ddcd5775 components/bt/controller/lib_esp32 (heads/master)
a3f7d7ffa2b261b1415042d8b7cd457cc2b4b1de components/bt/controller/lib_esp32c3_family (heads/master)
1dc1ec6e76b0ab3bf93cc9f1ff7a2a09141e7c61 components/bt/host/nimble/nimble (heads/nimble-1.3.0-idf-1-g1dc1ec6e)
eeecc49ce8af123cf8ad40efdb9673e37b56230f components/cmock/CMock (v2.5.2-2-geeecc49)
fced1a554f1b870f5a4e336431ab9915c4d90326 components/esp_phy/lib (heads/master)
d464572fa5be0b6508cdb6a93124f9ea72280225 components/esp_wifi/lib (heads/master)
ded13e025628d4c5ca350378b391e9b0d38bcb57 components/esptool_py/esptool (v3.2-47-gded13e0)
5545eb14d1117a7865a05a6b4a0f19c62760f8c7 components/ieee802154/lib (heads/master)
d348621ca93571343a56862df7de4ff3bc9b5667 components/json/cJSON (v1.7.15)
2749568fe15df2003f6c3f37f0dfd44f8f01fcd6 components/lwip/lwip (remotes/origin/master-224-g2749568f)
8b0e35f2ad477fcc2a267cf434528024b8499085 components/mbedtls/mbedtls (mbedtls-2.13.1-8771-g8b0e35f2a)
985078affa8a2d2b56b87c8e6455252850f895c6 components/mqtt/esp-mqtt (ESP-MQTT_FOR_IDF_3.1-293-g985078a)
901353a8c17d5c3040b3850d571550b0472b921b components/openthread/lib (heads/master)
e736d2488d9d4f787650d81f2b84f59a194f2b41 components/openthread/openthread (thread-reference-20200818-1424-ge736d2488)
dac1a65feac4ad72f612aab99f487056fbcf5c1a components/protobuf-c/protobuf-c (v1.3.0)
f5e26c4e933189593a71c6b82cda381a7b21e41c components/spiffs/spiffs (0.2-221-gf5e26c4)
c1986586098643edfa6b75a776299c576ad0ce8b components/tinyusb/tinyusb (remotes/origin/esp-based_on_9e992698)
7d2bf62b7e6afaf38153041a9d53c21aeeca9a25 components/unity/unity (v2.4.3-51-g7d2bf62)
7e8e249990ec491ec15990cf95b6d871a66cf64a examples/build_system/cmake/import_lib/main/lib/tinyxml2 (2.0.2-659-g7e8e249)
077758db50d4b55addab56e723a5a379f09077d0 examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib (077758d)
- Build System: [idf.py]
- Compiler version (run
xtensa-esp32-elf-gcc --version
to find it):
(crosstool-NG esp-2021r2-patch3) 8.4.0 - Operating System: [Windows]
- (Windows only) environment type: [ESP Command Prompt].
- Using an IDE?: [No]
- Power Supply: [USB]
Problem Description
USB stops working if light_sleep_enable
is true in esp_pm_configure
.
According to the doc:
If the application enters light-sleep (including automatic light-sleep) or software reset, etc. The USB CDC device will still work on the system.
if you don’t need USB CDC in sleep and want to keep low power consumption, please disable the menuconfig CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB
So I set CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB=y
alongside with CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set
& CONFIG_PM_SLP_DISABLE_GPIO is not set
Expected Behavior
USB keep working under light sleep.
Actual Behavior
USB stops working under light sleep, Unknown USB device (descriptor request failed)
Steps to reproduce
- Connect USB pins of dev kit to PC.
- Compile & run following code
- Remove
.light_sleep_enable = true
- Compile & run again
Code to reproduce this issue
#include <string.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_pm.h"
#include "esp_log.h"
static const char *TAG = "example";
static void example_task(void * parm)
{
while(1)
{
vTaskDelay(100);
ESP_LOGI(TAG, "Loop");
}
}
void app_main(void)
{
esp_pm_config_esp32c3_t pm_config = {
.max_freq_mhz = 80,
.min_freq_mhz = 80,
};
ESP_ERROR_CHECK(esp_pm_configure(&pm_config));
xTaskCreate(example_task, "example_task", 4096, NULL, 3, NULL);
}
Debug Logs
From UART console, USB console no output
I (30) boot: ESP-IDF v5.0-dev-1730-g229ed08484-dirty 2nd stage bootloader
I (30) boot: compile time 14:32:46
I (30) boot: chip revision: 3
I (34) boot.esp32c3: SPI Speed : 80MHz
I (39) boot.esp32c3: SPI Mode : DIO
I (43) boot.esp32c3: SPI Flash Size : 4MB
I (48) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (57) boot: ## Label Usage Type ST Offset Length
I (65) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (72) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (79) boot: 2 coredump Unknown data 01 03 00010000 00010000
I (87) boot: 3 factory factory app 00 00 00020000 00140000
I (94) boot: 4 ota_0 OTA app 00 10 00160000 00140000
I (102) boot: 5 ota_1 OTA app 00 11 002a0000 00140000
I (109) boot: End of partition table
I (114) esp_image: segment 0: paddr=00020020 vaddr=3c020020 size=07e60h ( 32352) map
I (127) esp_image: segment 1: paddr=00027e88 vaddr=3fc8d600 size=02920h ( 10528) load
I (132) esp_image: segment 2: paddr=0002a7b0 vaddr=40380000 size=05868h ( 22632) load
I (143) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=18448h ( 99400) map
I (163) esp_image: segment 4: paddr=00048470 vaddr=40385868 size=07c5ch ( 31836) load
I (176) esp_image: segment 5: paddr=000500d4 vaddr=50000010 size=00010h ( 16) load
I (180) boot: Loaded app from partition at offset 0x20000
I (180) boot: Disabling RNG early entropy source...
I (196) cpu_start: Pro cpu up.
I (204) cpu_start: Pro cpu start user code
I (204) cpu_start: cpu freq: 80000000 Hz
I (205) cpu_start: Application information:
I (207) cpu_start: Project name: template
I (212) cpu_start: App version: 1
I (217) cpu_start: Compile time: Mar 5 2022 14:32:09
I (223) cpu_start: ELF file SHA256: 0384805c96134d09...
I (229) cpu_start: ESP-IDF: v5.0-dev-1730-g229ed08484-dirty
I (236) heap_init: Initializing. RAM available for dynamic allocation:
I (243) heap_init: At 3FC91690 len 0002E970 (186 KiB): DRAM
I (249) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (256) heap_init: At 50000020 len 00001FE0 (7 KiB): RTCRAM
I (263) spi_flash: detected chip: generic
I (267) spi_flash: flash io: dio
I (282) sleep: Configure to isolate all GPIO pins in sleep state
I (283) esp_core_dump_uart: Init core dump to UART
I (283) coexist: coexist rom version 9387209
I (289) cpu_start: Starting scheduler.
I (293) pm: Frequency switching config: CPU_MAX: 80, APB_MAX: 80, APB_MIN: 80, Light sleep: ENABLED
I (293) sleep: Enable automatic switching of GPIO sleep configuration
I (1303) example: Loop
I (2313) example: Loop
I (3323) example: Loop
I (4333) example: Loop
Other items if possible
- sdkconfig file (attach the sdkconfig file from your project folder)
- elf file in the
build
folder (note this may contain all the code details and symbols of your project.) - coredump (This provides stacks of tasks.)
template.zip