-
Notifications
You must be signed in to change notification settings - Fork 0
10. Configuring Options
There are many, many options to configure setting up the ESP32 hardware and software environment.
The readable settings file is sdkconfig
, which is autogenerated. Editing sdkconfig
manually will be overwritten. These parameters are accessible to your program if needed through sdkconfig.h
(also autogenerated).
For version control, this file may be storing setup information, but not yet verified:
.pio/build/featheresp32/config/kconfig_menus.json
WARNING: idf.py menuconfig
is incompatible with platformio and will mess up build.
- (optional) Exit VisualStudio so there is not a conflict with sdkconfig. Make a backup copy of
sdkconfig
just in case. - To edit sdkconfig use command prompt or shell:
- C:> ~/.platformio/penv/Scripts/pio.exe run -t menuconfig
(if pio.exe is not in search path, add it) - Alternatively, there is a command line interface (CLI) inside platformio, but up down arrow keys do not work. From VS, PlatformIO icon (ant) => QUICK ACCESS => Miscellaneous => PlatformIO Core CLI Then pio.exe run -t menuconfig
- In menuconfig, use slash to find symbol if option is hard to find from menus.
- Save, then exit.
- After restarting VS, allow VS to automatically remake CMakelist
- Would you like to configure project 'SkeletonHuzzah32'? YES
- If getting strange results,
- If get something like:
Error: Couldn't find target config target-__idf_cbor-a7ffc6f8bf1ed76651c1.json
Then do `clean' from toolbar in platformio. - the sdkconfig may have been corrupted. Start over with a fresh version, such as from examples directory.
- May be possible to close and open project folder in VS to read sdkconfig?
The documentation describes all the options:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html#component-config
-
CONFIG_FREERTOS_HZ
Component config > FreeRTOS ( -> Tick rate (Hz)
Tick rate (Hz) set to 1000 Hz (can update steering servo at 5 ms interval). This is a reasonable tradeoff considering task switch overhead, and gives potentially 1 ms slice for each task. -
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
Component config > FreeRTOS -> Enable FreeRTOS to collect run time stats
vTaskGetRunTimeStats() will display the run time of each task as a % of the total run time of all CPUs (task run time / no of CPUs) / (total run time / 100 ) -
CONFIG_ESP_COREDUMP_TO_FLASH_OR_UART
Component config → Core dump (22 down) → Data destination -> UART
Select place to store core dump: flash, uart or none (to disable core dumps generation). -
CONFIG_ESP_COREDUMP_DATA_FORMAT
Component config > Core dump -> Format -> ELF
Provide complete information in core dump, such as variable values -
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT or ESP_SYSTEM_PANIC_PRINT_HALT
Component config → ESP32-specific (8 down)→ Panic handler behavior -> Print Registers and halt
Outputs the relevant registers over the serial port and halt the processor. Needs a manual reset to restart. -
CONFIG_COMPILER_OPTIMIZATION
Compiler options -> Optimization Level
Optimization level: “None” with -O0 produces compiled code without optimization. (sometimes needed if scanning a value which is changed by an external routine such as an IO line or an interrupt.) -
CONFIG_COMPILER_STACK_CHECK_MODE
Compiler options -> Stack smashing protection mode
Stack smashing protection mode, Emit extra code to check for buffer overflows, such as stack smashing attacks -
CONFIG_ESP_MAIN_TASK_STACK_SIZE
Component config > Common ESP-related (11 from top) -> Main task stack size
check stack size here if run out, default is 3584 byes. ~450 doubles -
CONFIG_ESP_INT_WDT
Component config → Common ESP-related -> Interrupt Watchdog
This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time, either because a task turned off interrupts and did not turn them on for a long time, or because an interrupt handler did not return. (300 ms default timeout). Make this higher than the FreeRTOS tick rate. The INT WDT timeout should always be longer than the period between FreeRTOS ticks (see CONFIG_FREERTOS_HZ). -
CONFIG_ESP_TASK_WDT_TIMEOUT_S.
Component config > Common ESP-related > Task Watchdog timeout period (seconds)
Watch dog timer triggered (5 seconds by default) if a task does not yield. The Task Watchdog Timer can be used to make sure individual tasks are still running. Enabling this option will cause the Task Watchdog Timer to be initialized automatically at startup. The Task Watchdog timer can be initialized after startup as well (see Task Watchdog Timer API Reference)
A task can then subscribe to the TWDT using esp_task_wdt_add() in order to be watched. Each subscribed task must periodically call esp_task_wdt_reset() to reset the TWDT. Failure by any subscribed tasks to periodically call esp_task_wdt_reset() indicates that one or more tasks have been starved of CPU time or are stuck in a loop somewhere.