Forum: Mikrocontroller und Digitale Elektronik ESP32: komisches Verhalten


von Zo R. (hsch1978)


Lesenswert?

Hallo ich habe eine kleine Applikation, die nur aus dem Hauptprogramm 
app_main mit while(1) Schleife besteht.
1
#include <stdio.h>
2
#include <inttypes.h>
3
#include "sdkconfig.h"
4
#include "esp_chip_info.h"
5
#include "esp_flash.h"
6
#include "esp_system.h"
7
#include "esp_log.h"
8
9
10
void app_main(void)
11
{
12
    while(1)
13
  {
14
15
  }
16
}

Wenn ich die Applikation auf meinem Device flashe erhalte ich auf der 
UART Schnittstelle immer diese Meldungen:

Die wird nur einmal ausgegeben:
1
I (31) boot: ESP-IDF v5.3.1 2nd stage bootloader
2
I (31) boot: compile time Nov 26 2024 15:18:11
3
I (31) boot: Multicore bootloader
4
I (35) boot: chip revision: v3.1
5
I (39) boot.esp32: SPI Speed      : 40MHz
6
I (44) boot.esp32: SPI Mode       : DIO
7
I (48) boot.esp32: SPI Flash Size : 2MB
8
I (53) boot: Enabling RNG early entropy source...
9
I (58) boot: Partition Table:
10
I (62) boot: ## Label            Usage          Type ST Offset   Length
11
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
12
I (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000
13
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
14
I (92) boot: End of partition table
15
I (96) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=089a4h ( 35236) map
16
I (116) esp_image: segment 1: paddr=000189cc vaddr=3ffb0000 size=021a4h (  8612) load
17
I (120) esp_image: segment 2: paddr=0001ab78 vaddr=40080000 size=054a0h ( 21664) load
18
I (132) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=11e20h ( 73248) map
19
I (157) esp_image: segment 4: paddr=00031e48 vaddr=400854a0 size=05cf4h ( 23796) load
20
I (172) boot: Loaded app from partition at offset 0x10000
21
I (173) boot: Disabling RNG early entropy source...
22
I (184) cpu_start: Multicore app
23
I (193) cpu_start: Pro cpu start user code
24
I (193) cpu_start: cpu freq: 160000000 Hz
25
I (193) app_init: Application information:
26
I (196) app_init: Project name:     hello_world
27
I (201) app_init: App version:      1
28
I (205) app_init: Compile time:     Nov 26 2024 15:17:27
29
I (211) app_init: ELF file SHA256:  29038780f...
30
I (217) app_init: ESP-IDF:          v5.3.1
31
I (221) efuse_init: Min chip rev:     v0.0
32
I (226) efuse_init: Max chip rev:     v3.99 
33
I (231) efuse_init: Chip rev:         v3.1
34
I (236) heap_init: Initializing. RAM available for dynamic allocation:
35
I (243) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
36
I (249) heap_init: At 3FFB2A60 len 0002D5A0 (181 KiB): DRAM
37
I (255) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
38
I (262) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
39
I (268) heap_init: At 4008B194 len 00014E6C (83 KiB): IRAM
40
I (276) spi_flash: detected chip: generic
41
I (279) spi_flash: flash io: dio
42
W (283) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
43
I (297) main_task: Started on CPU0
44
I (307) main_task: Calling app_main()

Wird immer wieder ausgegeben:
1
E (5307) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
2
E (5307) task_wdt:  - IDLE0 (CPU 0)
3
E (5307) task_wdt: Tasks currently running:
4
E (5307) task_wdt: CPU 0: main
5
E (5307) task_wdt: CPU 1: IDLE1
6
E (5307) task_wdt: Print CPU 0 (current core) backtrace
7
8
9
Backtrace: 0x400D5FFF:0x3FFB0F80 0x400829BD:0x3FFB0FB0 0x400E0D9C:0x3FFB3D50 0x400E17C0:0x3FFB3D70
10
--- 0x400d5fff: task_wdt_timeout_handling at C:/Espressif/esp-idf-v5.3.1/components/esp_system/task_wdt/task_wdt.c:434
11
 (inlined by) task_wdt_isr at C:/Espressif/esp-idf-v5.3.1/components/esp_system/task_wdt/task_wdt.c:507
12
0x400829bd: _xt_lowint1 at C:/Espressif/esp-idf-v5.3.1/components/xtensa/xtensa_vectors.S:1240
13
0x400e0d9c: app_main at C:/Entwicklung/Esp32/timer/main/hello_world_main.c:17
14
0x400e17c0: main_task at C:/Espressif/esp-idf-v5.3.1/components/freertos/app_startup.c:208
15
16
17
E (10307) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
18
E (10307) task_wdt:  - IDLE0 (CPU 0)
19
E (10307) task_wdt: Tasks currently running:
20
E (10307) task_wdt: CPU 0: main
21
E (10307) task_wdt: CPU 1: IDLE1
22
E (10307) task_wdt: Print CPU 0 (current core) backtrace

Für das Kompilieren verwende ich die Optimierungsstufe -Os.
So wie es aussieht erfolgt hier immer wieder einen Reset des Controller 
ausgelöst durch einen Watchdog.

: Bearbeitet durch User
von Sly G. (mcjunior)


Lesenswert?

Da würde ich ein TaskDelay in die while() - Schleife einfügen, damit das 
darunterlegende FreeRTOS-Betriebssystem mal dran kommt.

von Sherlock 🕵🏽‍♂️ (rubbel-die-katz)


Lesenswert?

Du sollst keine Endlosschleifen programmieren. app_main(void) wird aus 
dem main Task heraus aufgerufen. Jeder Task muss nach ein paar ms fertig 
werden.

: Bearbeitet durch User
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.