FreeRTOS / iot-reference-esp32

MIT License
75 stars 45 forks source link

[Feature Request] <Reboot> #102

Closed JasonYan324 closed 1 month ago

JasonYan324 commented 1 month ago

After merge main branch which fix issue with #99, app can not run, auto reboot. hardware: ESP32-C3 IDF version: V5.2.2 and V5.3 IDE: VS code

what i did: 1.Write cert int to ESP32 by: python managed_components/espressif__esp_secure_cert_mgr/tools/configure_esp_secure_cert.py -p "COM19" --configure_ds --keep_ds_data_on_host --ca-cert "D:/0/main/certs/aws-root-ca.pem" --device-cert "D:/0/main/certs/certificate.pem.crt" --private-key "D:/0/main/certs/private.pem.key" --target_chip "esp32c3" --secure_cert_type cust_flash --priv_key_algo "RSA" "2048" 2.write endpoint and thing name by menuconfig 3.bulid and flash 4.running log(always reboot): PS D:\0> & set IDF_PATH='D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/' PS D:\0> & 'D:/_00SDK/Espressif/python_env/idf5.3_py3.11_env/Scripts/python.exe' 'D:_00SDK\Espressif\frameworks\esp-idf-v5.3\tools\idf_monitor.py' -p COM19 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c3 'd:\0\build\FeaturedFreeRTOSIoTIntegration.elf' --- WARNING: GDB cannot open serial ports accessed as COMx --- Using \.\COM19 instead... --- esp-idf-monitor 1.4.0 on \.\COM19 115200 --- --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- ESP-ROM:esp32c3-api1-20210207 Build:Feb 7 2021 rst:0x15 (USB_UART_CHIP_RESET),boot:0xe (SPI_FAST_FLASH_BOOT) Saved PC:0x4038903e 0x4038903e: rv_utils_wait_for_intr at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/riscv/include/riscv/rv_utils.h:55 (inlined by) esp_cpu_wait_for_intr at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/esp_hw_support/cpu.c:62

SPIWP:0xee mode:DIO, clock div:1 load:0x3fcd5820,len:0x1188 load:0x403cc710,len:0x8d4 load:0x403ce710,len:0x2c8c entry 0x403cc710 I (235) cpu_start: Unicore app I (244) cpu_start: Pro cpu start user code I (244) cpu_start: cpu freq: 160000000 Hz I (244) app_init: Application information: I (244) app_init: Project name: FeaturedFreeRTOSIoTIntegration I (244) app_init: App version: v202212.00-100-ge45d25b I (244) app_init: Compile time: Jul 29 2024 15:42:29 I (245) app_init: ELF file SHA256: eba7b8572... I (245) app_init: ESP-IDF: v5.3-dirty I (245) efuse_init: Min chip rev: v0.3 I (245) efuse_init: Max chip rev: v1.99 I (245) efuse_init: Chip rev: v0.4 I (245) heap_init: Initializing. RAM available for dynamic allocation: I (245) heap_init: At 3FCA9250 len 00016DB0 (91 KiB): RAM I (246) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM I (246) heap_init: At 3FCDC710 len 00002950 (10 KiB): Retention RAM I (246) heap_init: At 50000200 len 00001DE8 (7 KiB): RTCRAM I (247) spi_flash: detected chip: generic I (247) spi_flash: flash io: dio I (248) sleep: Configure to isolate all GPIO pins in sleep state I (248) sleep: Enable automatic switching of GPIO sleep configuration I (248) coexist: coex firmware version: dab85ae96 I (249) coexist: coexist rom version 9387209 I (249) main_task: Started on CPU0 I (249) main_task: Calling app_main() I (249) esp_secure_cert: Pre-provisioned partition information: I (249) esp_secure_cert: partition format: CUST_FLASH, partition name: esp_secure_cert
W (249) mmap: paddr block is mapped already, vaddr_start: 0x3c120000, size: 0x10000 W (249) mmap: paddr block is mapped already, vaddr_start: 0x3c120000, size: 0x10000 I (249) main: Device Cert: Length: 1221 -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----

I (249) main: CA Cert: Length: 1207 -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- W (249) mmap: paddr block is mapped already, vaddr_start: 0x3c120000, size: 0x10000 W (249) mmap: paddr block is mapped already, vaddr_start: 0x3c120000, size: 0x10000 I (249) main: Private Key: Length: 1703 ... -----END RSA PRIVATE KEY-----

I (269) uart: queue free spaces: 10 I (269) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (269) main: CS Cert: Length: 0

I (269) main: Application version number: 0.0.0 E (269) temp_sub_pub_and_led_control_demo: Subscribe Topic: /Meshed/Jason/Subscribe I (269) temp_sub_pub_and_led_control_demo: Sending subscribe request to agent for topic filter: /Meshed/Jason/Subscribe with id 1 I (269) ota_over_mqtt_demo: OTA over MQTT demo, Application version 0.0.0 I (269) pp: pp rom version: 9387209 I (269) net80211: net80211 rom version: 9387209 I (279) wifi:wifi driver task: 3fcb79a4, prio:23, stack:6656, core=0 I (279) wifi:wifi firmware version: 0caa81945 I (279) wifi:wifi certification version: v7.0 I (279) wifi:config NVS flash: enabled I (279) wifi:config nano formating: disabled I (279) wifi:Init data frame dynamic rx buffer num: 32 I (279) wifi:Init static rx mgmt buffer num: 5 I (279) wifi:Init management short buffer num: 32 I (279) wifi:Init dynamic tx buffer num: 32 I (279) wifi:Init static tx FG buffer num: 2 I (279) wifi:Init static rx buffer size: 1600 I (279) wifi:Init static rx buffer num: 10 I (279) wifi:Init dynamic rx buffer num: 32 I (279) wifi_init: rx ba win: 6 I (279) wifi_init: accept mbox: 6 I (279) wifi_init: tcpip mbox: 32 I (279) wifi_init: udp mbox: 6 I (279) wifi_init: tcp mbox: 6 I (279) wifi_init: tcp tx win: 5760 I (279) wifi_init: tcp rx win: 5760 I (279) wifi_init: tcp mss: 1440 I (279) wifi_init: WiFi IRAM OP enabled I (279) wifi_init: WiFi RX IRAM OP enabled I (279) wifi_prov_scheme_ble: BT memory released I (289) app_wifi: Already provisioned, starting Wi-Fi STA I (289) wifi_prov_scheme_ble: BTDM memory released I (289) phy_init: phy_version 1180,01f2a49,Jun 4 2024,16:34:25 I (319) wifi:mode : sta (40:4c:ca:89:c1:84) I (319) wifi:enable tsf I (2729) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0 I (2729) wifi:state: init -> auth (0xb0) I (2729) wifi:state: auth -> assoc (0x0) I (2759) wifi:state: assoc -> run (0x10) I (2759) wifi:[ADDBA]RX DELBA, reason:39, delete tid:0, initiator:1(originator) I (2769) wifi:[ADDBA]RX DELBA, reason:39, delete tid:0, initiator:0(recipient) I (2769) wifi:[ADDBA]RX DELBA, reason:39, delete tid:4, initiator:1(originator) I (2779) wifi:connected with Rompa Guest, aid = 17, channel 1, BW20, bssid = f6:2a:7d:1e:d6:b9 I (2779) wifi:security: WPA2-PSK, phy: bgn, rssi: -49 I (2779) wifi:pm start, type: 1

I (2779) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (2789) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 25000, mt_pti: 14, mt_time: 10000 I (2819) wifi:AP's beacon interval = 102400 us, DTIM period = 1 I (2819) wifi:idx:0 (ifx:0, f6:2a:7d:1e:d6:b9), tid:4, ssn:6, winSize:64 I (3789) core_mqtt_agent_manager: WiFi connected. I (3789) app_wifi: Connected with IP Address:192.168.2.158 I (3789) esp_netif_handlers: sta ip: 192.168.2.158, mask: 255.255.255.0, gw: 192.168.2.1
I (3789) main_task: Returned from app_main() I (3809) wifi:idx:1 (ifx:0, f6:2a:7d:1e:d6:b9), tid:0, ssn:78, winSize:64 I (6819) core_mqtt_agent_manager: TLS connection established. I (7539) coreMQTT: MQTT connection established with the broker. I (7539) core_mqtt_agent_manager: Session present: 0

I (7539) core_mqtt_agent_manager: coreMQTT-Agent connected. I (7539) sub_pub_unsub_demo: coreMQTT-Agent connected. I (7539) ota_over_mqtt_demo: coreMQTT-Agent connected. Resuming OTA agent. I (7539) temp_sub_pub_and_led_control_demo: coreMQTT-Agent connected. I (7549) sub_pub_unsub_demo: Task "SubPub0" sending subscribe request to coreMQTT-Agent for topic filter: /Meshed/Jason/Filter/SubPub0 with id 1 Guru Meditation Error: Core 0 panic'ed (Stack protection fault).

Detected in task "OTADemoTask" at 0x42009362 0x42009362: processOTAEvents at D:/0/main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c:1071

Stack pointer: 0x3fcb2970 Stack bounds: 0x3fcb2ec4 - 0x3fcb3ac0

Core 0 register dump: MEPC : 0x42009364 RA : 0x42009fc8 SP : 0x3fcb2970 GP : 0x3fc97600
0x42009364: processOTAEvents at D:/0/main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c:1072 0x42009fc8: prvOTADemoTask at D:/0/main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c:1397

TP : 0x3fcb3ac0 T0 : 0xfffff000 T1 : 0x3fca7000 T2 : 0xffffffff
S0/FP : 0x3c0e7000 S1 : 0x0000000b A0 : 0x00000001 A1 : 0x00000001
A2 : 0x3fca7000 A3 : 0x00001000 A4 : 0x000010d0 A5 : 0x00000000
A6 : 0xa0000000 A7 : 0x00000014 S2 : 0x3fca7000 S3 : 0x00000000
S4 : 0x00000000 S5 : 0x00000000 S6 : 0x00000000 S7 : 0x00000000
S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000
T3 : 0x3fca7000 T4 : 0x00000001 T5 : 0x3fca7000 T6 : 0x00000001
MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x0000001b MTVAL : 0x000077fd
0x40380001: _vector_table at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/riscv/vectors_intc.S:54

MHARTID : 0x00000000

Stack memory: 3fcb2970: 0x3fcb2974 0xffffffff 0x3fcb2974 0x3fcb2974 0x00000000 0x3fcb2988 0xffffffff 0x3fcb2988 3fcb2990: 0x3fcb2988 0x00000001 0x00000001 0x00000000 0x0001ffff 0x00000000 0x00000000 0x3fcb2954 3fcb29b0: 0x00000054 0x3fcb29b4 0x3fcb29b4 0x3fcb29b4 0x3fcb29b4 0x00000000 0x3fcb29cc 0xffffffff 3fcb29d0: 0x3fcb29cc 0x3fcb29cc 0x00000000 0x3fcb29e0 0xffffffff 0x3fcb29e0 0x3fcb29e0 0x00000000 3fcb29f0: 0x00000001 0x00000000 0xff01ffff 0x00000000 0x3fcb29f8 0x3fcb29ac 0x00000054 0x3fcb2a0c 3fcb2a10: 0x3fcb2a0c 0x3fcb2a0c 0x3fcb2a0c 0x00000000 0x3fcb2a24 0xffffffff 0x3fcb2a24 0x3fcb2a24 3fcb2a30: 0x00000000 0x3fcb2a38 0xffffffff 0x3fcb2a38 0x3fcb2a38 0x00000000 0x00000001 0x00000000 3fcb2a50: 0xff01ffff 0x00000000 0x3fcb2a50 0x3fcb2a04 0x00000054 0x3fcb2a64 0x3fcb2a64 0x3fcb2a64 3fcb2a70: 0x3fcb2a64 0x00000000 0x3fcb2a7c 0xffffffff 0x3fcb2a7c 0x3fcb2a7c 0x00000000 0x3fcb2a90 3fcb2a90: 0xffffffff 0x3fcb2a90 0x3fcb2a90 0x00000001 0x00000001 0x00000000 0xff01ffff 0x00000000 3fcb2ab0: 0x3fcb2aa8 0x3fcb2a5c 0x00000028 0x3fca9264 0x3fca9264 0x3fcb2abc 0x00000000 0x00000001 3fcb2ad0: 0x00000000 0x9d01ffff 0x00000000 0x1211ffd6 0x3fcb2ab4 0x0000000c 0x3fcb2af8 0x00000000 3fcb2af0: 0x3fcb2ae0 0x0000000c 0x05540008 0x00000000 0x3fcb2e10 0x00000028 0x42042cac 0x42042ae6 0x42042cac: led_strip_rmt_set_pixel at D:/0/managed_components/espressifled_strip/src/led_strip_rmt_dev.c:39 0x42042ae6: led_strip_rmt_set_pixel_rgbw at D:/0/managed_components/espressifled_strip/src/led_strip_rmt_dev.c:54

3fcb2b10: 0x42042b7e 0x42042c80 0x42042d1a 0x3fcb2b34 0x3fcb2e3c 0x00000001 0x00000003 0x3f000000 0x42042b7e: led_strip_rmt_refresh at D:/0/managed_components/espressifled_strip/src/led_strip_rmt_dev.c:66 0x42042c80: led_strip_rmt_clear at D:/0/managed_components/espressifled_strip/src/led_strip_rmt_dev.c:81 0x42042d1a: led_strip_rmt_del at D:/0/managed_components/espressif__led_strip/src/led_strip_rmt_dev.c:89

3fcb2b30: 0x000000f4 0x00000000 0x00000002 0x00000001 0x00000001 0x3fcb2dc8 0x00000000 0x00000000 3fcb2b50: 0x00989680 0x3fcb2e00 0x00000001 0x00000000 0x60016400 0x00000000 0x00000000 0x4204e996 0x4204e996: rmt_del_tx_channel at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_rmt/src/rmt_tx.c:384

3fcb2b70: 0x4204e5fe 0x4204e776 0x4204e47e 0x00000000 0x00000000 0x0000001a 0x00000018 0x00000018 0x4204e5fe: rmt_tx_modulate_carrier at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_rmt/src/rmt_tx.c:870 0x4204e776: rmt_tx_enable at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_rmt/src/rmt_tx.c:755 0x4204e47e: rmt_tx_disable at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/esp_driver_rmt/src/rmt_tx.c:801

3fcb2b90: 0x00000004 0x00000000 0x3fcb2c2c 0x3fcb2c98 0x3fcb2d04 0x00000000 0x00000000 0x00000000 3fcb2bb0: 0x00000000 0x00000000 0x3fcb2e3c 0x3fcb2b29 0x00000003 0x00000000 0x00000000 0x0000001a 3fcb2bd0: 0x00000002 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 3fcb2bf0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 3fcb2c10: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000054 0x3fcb2c84 3fcb2c30: 0x3fcb2c88 0x3fcb2c94 0x3fcb2c84 0x00000000 0x3fcb2c44 0xffffffff 0x3fcb2c44 0x3fcb2c44 3fcb2c50: 0x00000000 0x3fcb2c58 0xffffffff 0x3fcb2c58 0x3fcb2c58 0x00000004 0x00000004 0x00000004 3fcb2c70: 0x7f01ffff 0x00000000 0x00000000 0x3fcb2c24 0x00000010 0x3fcb2bb8 0x3fcb2bd4 0x3fcb2bf0 3fcb2c90: 0x3fcb2c0c 0x00000054 0x3fcb2cf0 0x3fcb2cf4 0x3fcb2d00 0x3fcb2cf0 0x00000000 0x3fcb2cb0 3fcb2cb0: 0xffffffff 0x3fcb2cb0 0x3fcb2cb0 0x00000000 0x3fcb2cc4 0xffffffff 0x3fcb2cc4 0x3fcb2cc4 3fcb2cd0: 0x00000000 0x00000004 0x00000004 0xff01ffff 0x00000000 0x05c00492 0x3fcb2c90 0x00000010 3fcb2cf0: 0x3fcb2bb8 0x3fca9264 0x30100100 0x3fcb2ce8 0x00000054 0x3fcb2d5c 0x3fcb2d60 0x3fcb2d6c 3fcb2d10: 0x3fcb2d5c 0x00000000 0x3fcb2d1c 0xffffffff 0x3fcb2d1c 0x3fcb2d1c 0x00000000 0x3fcb2d30 3fcb2d30: 0xffffffff 0x3fcb2d30 0x3fcb2d30 0x00000000 0x00000004 0x00000004 0x0001ffff 0x00000000 3fcb2d50: 0x3fcb2d7c 0x3fcb2cfc 0x00000010 0x3fcb2bb8 0x3fca9264 0x000a0000 0x3fcb2d54 0x00000054

ELF file SHA256: eba7b8572

Rebooting... ESP-ROM:esp32c3-api1-20210207 Build:Feb 7 2021 rst:0xc (RTC_SW_CPU_RST),boot:0xe (SPI_FAST_FLASH_BOOT) Saved PC:0x40380702 0x40380702: esp_restart_noos at D:/_00SDK/Espressif/frameworks/esp-idf-v5.3/components/esp_system/port/soc/esp32c3/system_internal.c:110

SPIWP:0xee mode:DIO, clock div:1 load:0x3fcd5820,len:0x1188 load:0x403cc710,len:0x8d4 load:0x403ce710,len:0x2c8c entry 0x403cc710 I (235) cpu_start: Unicore app I (243) cpu_start: Pro cpu start user code I (243) cpu_start: cpu freq: 160000000 Hz I (243) app_init: Application information: I (243) app_init: Project name: FeaturedFreeRTOSIoTIntegration I (244) app_init: App version: v202212.00-100-ge45d25b I (244) app_init: Compile time: Jul 29 2024 15:42:29 I (244) app_init: ELF file SHA256: eba7b8572... I (244) app_init: ESP-IDF: v5.3-dirty I (244) efuse_init: Min chip rev: v0.3 I (244) efuse_init: Max chip rev: v1.99 I (244) efuse_init: Chip rev: v0.4 I (245) heap_init: Initializing. RAM available for dynamic allocation: I (245) heap_init: At 3FCA9250 len 00016DB0 (91 KiB): RAM I (245) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM I (245) heap_init: At 3FCDC710 len 00002950 (10 KiB): Retention RAM I (245) heap_init: At 50000200 len 00001DE8 (7 KiB): RTCRAM I (246) spi_flash: detected chip: generic I (247) spi_flash: flash io: dio I (247) sleep: Configure to isolate all GPIO pins in sleep state I (247) sleep: Enable automatic switching of GPIO sleep configuration I (248) coexist: coex firmware version: dab85ae96 I (248) coexist: coexist rom version 9387209 I (249) main_task: Started on CPU0 I (249) main_task: Calling app_main() I (249) esp_secure_cert: Pre-provisioned partition information: I (249) esp_secure_cert: partition format: CUST_FLASH, partition name: esp_secure_cert
W (249) mmap: paddr block is mapped already, vaddr_start: 0x3c120000, size: 0x10000 W (249) mmap: paddr block is mapped already, vaddr_start: 0x3c120000, size: 0x10000 5.but if i disable "Enable OTA demo", then rebulid and flash, app can be run no reboot

ActoryOu commented 1 month ago

Hi @JasonYan324, Could you elaborate on the steps you did for this? Is it a clean clone? What configurations have you checked in menuconfig?

Thank you.

JasonYan324 commented 1 month ago

Hi @JasonYan324, Could you elaborate on the steps you did for this? Is it a clean clone? What configurations have you checked in menuconfig?

Thank you.

Hi @ActoryOu, What I did following as below(wifi setup before, no need to setup again):

  1. git clone again by using git clone https://github.com/FreeRTOS/iot-reference-esp32c3.git --recurse-submodules from the log clone done without any fail
  2. idf.py menuconfig to setup MQTT endpoint and thing name, log out change from UART0 to USB
  3. python managed_components/espressif__esp_secure_cert_mgr/tools/configure_esp_secure_cert.py ... to write the MQTT certs again
  4. vs code open the soure code, then select target esp32c3,com port ,uart to flash
  5. then build,and no error image
  6. then flash, and done image
  7. then start monitor,and got the same result as above, alway detect ota_over_mqtt_demo/ota_over_mqtt_demo then reboot image
  8. and idf.py menuconfig to uncheck "Enable OTA demo", rebuild, flash, then can be running.
  9. even worse, I compiled with IDF5.2 version and couldn't start it directly, restarting as soon as it started. We won't discuss this for now. If necessary, we can open another issue
JasonYan324 commented 1 month ago

@ActoryOu so, what do you suggest I do for this issue. Thanks

JasonYan324 commented 1 month ago

what i did in menuconfig image image

ActoryOu commented 1 month ago

Hi @JasonYan324, Thanks for the detail! Is it possible to chage back to UART logging for testing purpose? We'd find some time try this but it might take a few days.

Thank you.

JasonYan324 commented 1 month ago

Hi @JasonYan324, Thanks for the detail! Is it possible to chage back to UART logging for testing purpose? We'd find some time try this but it might take a few days.

Thank you.

Thanks a lot! I have try from a new soure code, olny setup endpoint and thing name in menuconifg, but the result is the same as above.

ActoryOu commented 1 month ago

Hi @JasonYan324, We found the root cause and raised #103 to fix this. Could you help try once?

Note that you have to reset your menuconfig to apply new setting on the PR.

Thank you.

ActoryOu commented 1 month ago

This issue is being closed as the proposed fix has been merged into the codebase. However, if the same problem persists, feel free to reopen this issue for further investigation and resolution.

JasonYan324 commented 1 month ago

This issue is being closed as the proposed fix has been merged into the codebase. However, if the same problem persists, feel free to reopen this issue for further investigation and resolution.

the code has no merge now, can you tell me where and what to change for test? image

JasonYan324 commented 1 month ago

This issue is being closed as the proposed fix has been merged into the codebase. However, if the same problem persists, feel free to reopen this issue for further investigation and resolution.

the code has no merge now, can you tell me where and what to change for test? image

Sorry, I foud what you change

ActoryOu commented 1 month ago

Sorry for confusing. #103 is the patch to fix this issue, and it's yet merged. Please give it a try.

ActoryOu commented 1 month ago

Note that it's merged.