esp32-s3进入深度睡眠后快速重启

robbietree
Posts: 6
Joined: Mon Oct 17, 2022 8:26 am

esp32-s3进入深度睡眠后快速重启

Postby robbietree » Tue Nov 15, 2022 6:49 am

基本信息
芯片: esp32-s3r2
esp-idf版本: release/v4.4 commit-id: 76caa64286b0e93207ad06f68830a223be49cc88
外接32MB flash

现象:

长按关机后,芯片立即重启,重启原因USB_UART_CHIP_RESET

相关日志:
  1. I (31484) app-button: button long press
  2. read failed: [Errno 6] Device not configured
  3. Waiting for the device to reconnect
  4. ESP-ROM:esp32s3-20210327
  5. Build:Mar 27 2021
  6. rst:0x15 (USB_UART_CHIP_RESET),boot:0x29 (SPI_FAST_FLASH_BOOT)
  7. Saved PC:0x4201b2ba
  8. 0x4201b2ba: esp_pm_impl_waiti at /Users/robbietree/IdeaProjects/git/github/esp-idf/components/esp_pm/pm_impl.c:839
  9.  
  10. SPIWP:0xee
  11. mode:DIO, clock div:1
  12. load:0x3fce3808,len:0x1674
  13. load:0x403c9700,len:0xbb8
  14. load:0x403cc700,len:0x2f10
  15. entry 0x403c9954
  16. I (24) boot: ESP-IDF v4.4.3-145-g76caa64286-dirty 2nd stage bootloader
  17. I (25) boot: compile time 17:11:41
  18. I (25) boot: chip revision: 0
  19. I (28) boot.esp32s3: Boot SPI Speed : 80MHz
  20. I (33) boot.esp32s3: SPI Mode       : DIO
  21. I (38) boot.esp32s3: SPI Flash Size : 32MB
  22. I (42) boot: Enabling RNG early entropy source...
  23. I (48) boot: Partition Table:
  24. I (51) boot: ## Label            Usage          Type ST Offset   Length
  25. I (59) boot:  0 nvs              WiFi data        01 02 00009000 00004000
  26. I (66) boot:  1 phy_init         RF data          01 01 0000d000 00001000
  27. I (74) boot:  2 factory          factory app      00 00 00010000 00300000
  28. I (81) boot:  3 storage          Unknown data     01 82 00320000 00100000
  29. I (89) boot: End of partition table
  30. I (93) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=09e20h ( 40480) map
  31. I (108) esp_image: segment 1: paddr=00019e48 vaddr=3fc93ab0 size=02b8ch ( 11148) load
  32. I (112) esp_image: segment 2: paddr=0001c9dc vaddr=40374000 size=0363ch ( 13884) load
  33. I (121) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=1c2e8h (115432) map
  34. I (147) esp_image: segment 4: paddr=0003c310 vaddr=4037763c size=0c474h ( 50292) load
  35. I (159) esp_image: segment 5: paddr=0004878c vaddr=600fe000 size=0002ch (    44) load
  36. I (165) boot: Loaded app from partition at offset 0x10000
  37. I (166) boot: Disabling RNG early entropy source...
  38. I (179) spiram: Found 16MBit SPI RAM device
  39. I (179) spiram: SPI RAM mode: sram 40m
  40. I (179) spiram: PSRAM initialized, cache is in normal (1-core) mode.
  41. I (184) cpu_start: Pro cpu up.
  42. I (188) cpu_start: Starting app cpu, entry point is 0x403753fc
  43. 0x403753fc: call_start_cpu1 at /Users/git/github/esp-idf/components/esp_system/port/cpu_start.c:148
  44.  
  45. I (0) cpu_start: App cpu up.
  46. I (613) spiram: SPI SRAM memory test OK
  47. I (622) cpu_start: Pro cpu start user code
  48. I (622) cpu_start: cpu freq: 160000000
  49. I (622) cpu_start: Application information:
  50. I (625) cpu_start: Project name:     fusion_glasses_medical
  51. I (631) cpu_start: App version:      261c361-dirty
  52. I (637) cpu_start: Compile time:     Nov 15 2022 14:21:44
  53. I (643) cpu_start: ELF file SHA256:  44162d5beda2077b...
  54. I (649) cpu_start: ESP-IDF:          v4.4.3-145-g76caa64286-dirty
  55. I (655) heap_init: Initializing. RAM available for dynamic allocation:
  56. I (663) heap_init: At 3FC972A0 len 00052470 (329 KiB): D/IRAM
  57. I (669) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
  58. I (676) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
  59. I (682) heap_init: At 600FE02C len 00001FD4 (7 KiB): RTCRAM
  60. I (688) spiram: Adding pool of 2048K of external SPI memory to heap allocator
  61. I (697) spi_flash: detected chip: gd
  62. I (700) spi_flash: flash io: dio
  63. I (705) sleep: Configure to isolate all GPIO pins in sleep state
  64. I (711) sleep: Enable automatic switching of GPIO sleep configuration
  65. I (718) coexist: coexist rom version e7ae62f
  66. I (723) cpu_start: Starting scheduler on PRO CPU.
  67. I (0) cpu_start: Starting scheduler on APP CPU.
  68. I (734) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
  69. I (744) app-deep-sleep: init deep sleep on pin 5
  70. wakeup cause: 0
  71. Not a deep sleep reset
相关代码:
  1. #define FEATURE_TOGGLE_PIN 5
  2.  
  3. static void button_long_press_hold_cb(void *arg1, void *arg2)
  4. {
  5.     ESP_LOGI(TAG, "button long press");
  6.     enter_deep_sleep();
  7. }
  8.  
  9. static void setup_gpio_button()
  10. {
  11.     ESP_LOGI(TAG, "gpio button init on pin %d", FEATURE_TOGGLE_PIN);
  12.     button_config_t cfg = {
  13.         .type = BUTTON_TYPE_GPIO,
  14.         .gpio_button_config = {
  15.             .gpio_num = FEATURE_TOGGLE_PIN,
  16.             .active_level = 1,
  17.         },
  18.     };
  19.     button_handle_t btn = iot_button_create(&cfg);
  20.     iot_button_register_cb(btn, BUTTON_LONG_PRESS_START, button_long_press_hold_cb, "hold");
  21. }
  1. #define WAKEUP_PIN FEATURE_TOGGLE_PIN
  2. #define WAKEUP_LEVEL 1
  3.  
  4. void init_deep_sleep(void)
  5. {
  6.     ESP_LOGI(TAG, "init deep sleep on pin %d", WAKEUP_PIN);
  7.     esp_sleep_enable_ext0_wakeup(WAKEUP_PIN, WAKEUP_LEVEL);
  8.     printf("wakeup cause: %d\n", esp_sleep_get_wakeup_cause());
  9.     switch (esp_sleep_get_wakeup_cause()) {
  10.         case ESP_SLEEP_WAKEUP_EXT0: {
  11.             printf("Wake up from ext0\n");
  12.             break;
  13.         }
  14.         default: {
  15.             printf("Not a deep sleep reset\n");
  16.         }
  17.     }
  18. }
  19.  
  20. void enter_deep_sleep(void)
  21. {
  22.     esp_deep_sleep_start();
  23. }

Who is online

Users browsing this forum: No registered users and 31 guests