# HG changeset patch # User Michiel Broek # Date 1695734109 -7200 # Node ID 7425fa11f23efb72ae82a379da251e218dadca22 # Parent 34da2d2b12d53758050fe20cc97751b66cc67c6c# Parent 3ac60b34794cba0b65df827ce3d31fbb4ad71c40 Merged diff -r 3ac60b34794c -r 7425fa11f23e CMakeLists.txt --- a/CMakeLists.txt Tue Sep 26 10:39:56 2023 +0200 +++ b/CMakeLists.txt Tue Sep 26 15:15:09 2023 +0200 @@ -5,5 +5,6 @@ set(PROJECT_VER "0.2.7") set(PROJECT_NAME "co2meter") +set(EXTRA_COMPONENT_DIRS components/esp32-ds18b20 components/esp32-owb components/esp32-rotary-encoder components/u8g2) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(co2meter) diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/CMakeLists.txt --- a/components/esp32-owb/CMakeLists.txt Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/CMakeLists.txt Tue Sep 26 15:15:09 2023 +0200 @@ -1,2 +1,12 @@ -idf_component_register(SRCS owb_rmt.c owb.c owb_gpio.c INCLUDE_DIRS include) +if (NOT IDF_VERSION_MAJOR) + set(IDF_VERSION_MAJOR 3) +endif() +if (IDF_VERSION_MAJOR LESS 5) + message(FATAL_ERROR "Can't build: requires ESP-IDF version 5.0 or above.") +endif() + +set(COMPONENT_ADD_INCLUDEDIRS include) +set(COMPONENT_SRCS "owb.c" "owb_gpio.c" "owb_rmt.c") +set(COMPONENT_REQUIRES "soc" "driver" "esp_rom") +register_component() diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/README.md --- a/components/esp32-owb/README.md Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/README.md Tue Sep 26 15:15:09 2023 +0200 @@ -2,15 +2,20 @@ This is a ESP32-compatible C component for the Maxim Integrated "1-Wire" protocol. -It is written and tested for version 3.0 of the [ESP-IDF](https://github.com/espressif/esp-idf) environment, using the xtensa-esp32-elf toolchain (gcc version 5.2.0, crosstool-ng-1.22.0-80-g6c4433a). +It is written for the `idf.py` target `esp32`, although it may work on other ESP-32 devices with minor modifications. + +It is tested for version 4.4.4 and 5.0.1 of the [ESP-IDF](https://github.com/espressif/esp-idf) environment. -Support for v2.1 is available on the [ESP-IDF_v2.1](https://github.com/DavidAntliff/esp32-owb/tree/ESP-IDF_v2.1) branch. +Legacy support for v2.1 is available on the [ESP-IDF_v2.1](https://github.com/DavidAntliff/esp32-owb/tree/ESP-IDF_v2.1) branch. This is no longer maintained. + +Legacy support for v3.0-v3.3 and v4.1-beta1 is available on the [ESP-IDF_v3.0-3.3_4.1-beta1](https://github.com/DavidAntliff/esp32-owb/tree/ESP-IDF_v3.0-3.3_4.1-beta1) branch. This is no longer maintained. ## Features This library includes: - * External power supply mode (parasitic mode not yet supported). + * External power supply mode. + * Parasitic power mode. * Static (stack-based) or dynamic (malloc-based) memory model. * No globals - support any number of 1-Wire buses simultaneously. * 1-Wire device detection and validation, including search for multiple devices on a single bus. @@ -23,7 +28,10 @@ however this proved to be too unreliable. A second method, using the ESP32's RMT peripheral, results in very accurate read/write timeslots and more reliable operation. -Therefore I highly recommend that you use the RMT driver. The GPIO driver should be considered deprecated. +Therefore I highly recommend that you use the RMT driver. *The GPIO driver is deprecated and will be removed.* + +See documentation for [esp32-ds18b20](https://www.github.com/DavidAntliff/esp32-ds18b20#parasitic-power-mode) +for further information about parasitic power mode, including strong pull-up configuration. ## Documentation @@ -39,16 +47,17 @@ ## Links - * [esp32-ds18b20](https://github.com/DavidAntliff/esp32-ds18b20) - ESP32-compatible DS18B20 Digital Thermometer component for ESP32 + * [esp32-ds18b20](https://github.com/DavidAntliff/esp32-ds18b20) - ESP32-compatible DS18B20 Digital Thermometer + component for ESP32 * [1-Wire Communication Through Software](https://www.maximintegrated.com/en/app-notes/index.mvp/id/126) * [1-Wire Search Algorithm](https://www.maximintegrated.com/en/app-notes/index.mvp/id/187) * [Espressif IoT Development Framework for ESP32](https://github.com/espressif/esp-idf) ## Acknowledgements -Thank you to [Chris Morgan](https://github.com/chmorgan) for his contribution of adding RMT peripheral support for more reliable operation. +Thank you to [Chris Morgan](https://github.com/chmorgan) for his contribution of adding RMT peripheral support for more +reliable operation. Parts of this code are based on references provided to the public domain by Maxim Integrated. "1-Wire" is a registered trademark of Maxim Integrated. - diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/doc/Doxyfile --- a/components/esp32-owb/doc/Doxyfile Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/doc/Doxyfile Tue Sep 26 15:15:09 2023 +0200 @@ -1072,6 +1072,25 @@ VERBATIM_HEADERS = YES +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -2195,7 +2214,7 @@ # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO -# The default value is: NO. +# The default value is: YES. HAVE_DOT = NO @@ -2351,7 +2370,9 @@ # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, +# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd, +# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo, +# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo, # png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and # png:gdiplus:gdiplus. # The default value is: png. diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/include/owb.h --- a/components/esp32-owb/include/owb.h Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/include/owb.h Tue Sep 26 15:15:09 2023 +0200 @@ -30,7 +30,8 @@ * This component provides structures and functions that are useful for communicating * with devices connected to a Maxim Integrated 1-Wire® bus via a single GPIO. * - * Currently only externally powered devices are supported. Parasitic power is not supported. + * Externally powered and "parasite-powered" devices are supported. + * Please consult your device's datasheet for power requirements. */ #ifndef ONE_WIRE_BUS_H @@ -39,6 +40,7 @@ #include #include #include +#include "driver/gpio.h" #ifdef __cplusplus extern "C" { @@ -46,14 +48,18 @@ // ROM commands -#define OWB_ROM_SEARCH 0xF0 ///< Command ROM search -#define OWB_ROM_READ 0x33 ///< ROM read -#define OWB_ROM_MATCH 0x55 ///< ROM address match -#define OWB_ROM_SKIP 0xCC ///< Skip device -#define OWB_ROM_SEARCH_ALARM 0xEC ///< Search device with alarm set +#define OWB_ROM_SEARCH 0xF0 ///< Perform Search ROM cycle to identify devices on the bus +#define OWB_ROM_READ 0x33 ///< Read device ROM (single device on bus only) +#define OWB_ROM_MATCH 0x55 ///< Address a specific device on the bus by ROM +#define OWB_ROM_SKIP 0xCC ///< Address all devices on the bus simultaneously +#define OWB_ROM_SEARCH_ALARM 0xEC ///< Address all devices on the bus with a set alarm flag #define OWB_ROM_CODE_STRING_LENGTH (17) ///< Typical length of OneWire bus ROM ID as ASCII hex string, including null terminator +#ifndef GPIO_NUM_NC +# define GPIO_NUM_NC (-1) ///< ESP-IDF prior to v4.x does not define GPIO_NUM_NC +#endif + struct owb_driver; /** @@ -63,8 +69,9 @@ { const struct _OneWireBus_Timing * timing; ///< Pointer to timing information bool use_crc; ///< True if CRC checks are to be used when retrieving information from a device on the bus - - const struct owb_driver *driver; + bool use_parasitic_power; ///< True if parasitic-powered devices are expected on the bus + gpio_num_t strong_pullup_gpio; ///< Set if an external strong pull-up circuit is required + const struct owb_driver * driver; ///< Pointer to hardware driver instance } OneWireBus; /** @@ -94,45 +101,45 @@ */ typedef struct { - OneWireBus_ROMCode rom_code; - int last_discrepancy; - int last_family_discrepancy; - int last_device_flag; + OneWireBus_ROMCode rom_code; ///< Device ROM code + int last_discrepancy; ///< Bit index that identifies from which bit the next search discrepancy check should start + int last_family_discrepancy; ///< Bit index that identifies the last discrepancy within the first 8-bit family code of the ROM code + int last_device_flag; ///< Flag to indicate previous search was the last device detected } OneWireBus_SearchState; /** - * @brief Status codes + * @brief Represents the result of OWB API functions. */ typedef enum { - OWB_STATUS_OK, ///< Ok - OWB_STATUS_NOT_INITIALIZED, ///< Init error - OWB_STATUS_PARAMETER_NULL, ///< NULL parameter - OWB_STATUS_DEVICE_NOT_RESPONDING, ///< Device does not respond - OWB_STATUS_CRC_FAILED, ///< CRC error - OWB_STATUS_TOO_MANY_BITS, ///< Too many bits - OWB_STATUS_HW_ERROR ///< Hardware error + OWB_STATUS_NOT_SET = -1, ///< A status value has not been set + OWB_STATUS_OK = 0, ///< Operation succeeded + OWB_STATUS_NOT_INITIALIZED, ///< Function was passed an uninitialised variable + OWB_STATUS_PARAMETER_NULL, ///< Function was passed a null pointer + OWB_STATUS_DEVICE_NOT_RESPONDING, ///< No response received from the addressed device or devices + OWB_STATUS_CRC_FAILED, ///< CRC failed on data received from a device or devices + OWB_STATUS_TOO_MANY_BITS, ///< Attempt to write an incorrect number of bits to the One Wire Bus + OWB_STATUS_HW_ERROR ///< A hardware error occurred } owb_status; /** NOTE: Driver assumes that (*init) was called prior to any other methods */ struct owb_driver { const char* name; - owb_status (*uninitialize)(const OneWireBus * bus); - - owb_status (*reset)(const OneWireBus * bus, bool *is_present); - - /** NOTE: The data is shifted out of the low bits, eg. it is written in the order of lsb to msb */ + owb_status (*reset)(const OneWireBus *bus, bool *is_present); owb_status (*write_bits)(const OneWireBus *bus, uint8_t out, int number_of_bits_to_write); - - /** NOTE: Data is read into the high bits, eg. each bit read is shifted down before the next bit is read */ + owb_status (*write_bytes)(const OneWireBus *bus, uint8_t *bytes, int number_of_bytes_to_write); owb_status (*read_bits)(const OneWireBus *bus, uint8_t *in, int number_of_bits_to_read); + owb_status (*read_bytes)(const OneWireBus *bus, uint64_t *in, int number_of_bytes_to_read); }; +/// @cond ignore +// note: the new owb_rmt driver uses the ESP-IDF's built-in `__containerof()` macro instead of this #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) +/// @endcond /** * @brief call to release resources after completing use of the OneWireBus @@ -150,29 +157,82 @@ owb_status owb_use_crc(OneWireBus * bus, bool use_crc); /** + * @brief Enable or disable use of parasitic power on the One Wire Bus. + * This affects how devices signal on the bus, as devices cannot + * signal by pulling the bus low when it is pulled high. + * @param[in] bus Pointer to initialised bus instance. + * @param[in] use_parasitic_power True to enable parasitic power, false to disable. + * @return status + */ +owb_status owb_use_parasitic_power(OneWireBus * bus, bool use_parasitic_power); + +/** + * @brief Enable or disable use of extra GPIO to activate strong pull-up circuit. + * This only has effect if parasitic power mode is enabled. + * signal by pulling the bus low when it is pulled high. + * @param[in] bus Pointer to initialised bus instance. + * @param[in] gpio Set to GPIO number to use, or GPIO_NUM_NC to disable. + * @return status + */ +owb_status owb_use_strong_pullup_gpio(OneWireBus * bus, gpio_num_t gpio); + +/** * @brief Read ROM code from device - only works when there is a single device on the bus. * @param[in] bus Pointer to initialised bus instance. * @param[out] rom_code the value read from the device's rom * @return status */ -owb_status owb_read_rom(const OneWireBus * bus, OneWireBus_ROMCode *rom_code); +owb_status owb_read_rom(const OneWireBus * bus, OneWireBus_ROMCode * rom_code); /** * @brief Verify the device specified by ROM code is present. * @param[in] bus Pointer to initialised bus instance. * @param[in] rom_code ROM code to verify. - * @param[out] is_present set to true if a device is present, false if not + * @param[out] is_present Set to true if a device is present, false if not * @return status */ -owb_status owb_verify_rom(const OneWireBus * bus, OneWireBus_ROMCode rom_code, bool* is_present); +owb_status owb_verify_rom(const OneWireBus * bus, OneWireBus_ROMCode rom_code, bool * is_present); /** * @brief Reset the 1-Wire bus. * @param[in] bus Pointer to initialised bus instance. - * @param[out] a_device_present set to true if at least one device is present on the bus + * @param[out] is_present set to true if at least one device is present on the bus + * @return status + */ +owb_status owb_reset(const OneWireBus * bus, bool * is_present); + +/** + * @brief Read a single bit from the 1-Wire bus. + * @param[in] bus Pointer to initialised bus instance. + * @param[out] out The bit value read from the bus. + * @return status + */ +owb_status owb_read_bit(const OneWireBus * bus, uint8_t * out); + +/** + * @brief Read a single byte from the 1-Wire bus. + * @param[in] bus Pointer to initialised bus instance. + * @param[out] out The byte value read from the bus (lsb only). * @return status */ -owb_status owb_reset(const OneWireBus * bus, bool* a_device_present); +owb_status owb_read_byte(const OneWireBus * bus, uint8_t * out); + +/** + * @brief Read a number of bytes from the 1-Wire bus. + * @param[in] bus Pointer to initialised bus instance. + * @param[in, out] buffer Pointer to buffer to receive read data. + * @param[in] len Number of bytes to read, must not exceed length of receive buffer. + * @return status. + */ +owb_status owb_read_bytes(const OneWireBus * bus, uint8_t * buffer, unsigned int len); + +/** + * @brief Write a bit to the 1-Wire bus. + * @param[in] bus Pointer to initialised bus instance. + * @param[in] bit Value to write (lsb only). + * @return status + */ +owb_status owb_write_bit(const OneWireBus * bus, uint8_t bit); /** * @brief Write a single byte to the 1-Wire bus. @@ -183,23 +243,6 @@ owb_status owb_write_byte(const OneWireBus * bus, uint8_t data); /** - * @brief Read a single byte from the 1-Wire bus. - * @param[in] bus Pointer to initialised bus instance. - * @param[out] out The byte value read from the bus. - * @return status - */ -owb_status owb_read_byte(const OneWireBus * bus, uint8_t *out); - -/** - * @brief Read a number of bytes from the 1-Wire bus. - * @param[in] bus Pointer to initialised bus instance. - * @param[in, out] buffer Pointer to buffer to receive read data. - * @param[in] len Number of bytes to read, must not exceed length of receive buffer. - * @return status. - */ -owb_status owb_read_bytes(const OneWireBus * bus, uint8_t * buffer, size_t len); - -/** * @brief Write a number of bytes to the 1-Wire bus. * @param[in] bus Pointer to initialised bus instance. * @param[in] buffer Pointer to buffer to write data from. @@ -267,6 +310,16 @@ */ char * owb_string_from_rom_code(OneWireBus_ROMCode rom_code, char * buffer, size_t len); +/** + * @brief Enable or disable the strong-pullup GPIO, if configured. + * @param[in] bus Pointer to initialised bus instance. + * @param[in] enable If true, enable the external strong pull-up by setting the GPIO high. + * If false, disable the external strong pull-up by setting the GPIO low. + * @return status + */ +owb_status owb_set_strong_pullup(const OneWireBus * bus, bool enable); + + #include "owb_gpio.h" #include "owb_rmt.h" diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/include/owb_gpio.h --- a/components/esp32-owb/include/owb_gpio.h Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/include/owb_gpio.h Tue Sep 26 15:15:09 2023 +0200 @@ -23,6 +23,16 @@ * SOFTWARE. */ +/** + * @file + * @brief Interface definitions for the ESP32 GPIO driver used to communicate with devices + * on the One Wire Bus. + * + * @deprecated + * This driver is deprecated and may be removed at some stage. It is not recommended for use + * due to issues with imprecise timing. + */ + #pragma once #ifndef OWB_GPIO_H #define OWB_GPIO_H @@ -34,7 +44,7 @@ #endif /** - * @brief 1-wire bus connection on the gpio. + * @brief GPIO driver information */ typedef struct { diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/include/owb_rmt.h --- a/components/esp32-owb/include/owb_rmt.h Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/include/owb_rmt.h Tue Sep 26 15:15:09 2023 +0200 @@ -23,34 +23,79 @@ * SOFTWARE. */ +/** + * @file + * @brief Interface definitions for ESP32 RMT driver used to communicate with devices + * on the One Wire Bus. + * + * This is the recommended driver. + */ + #pragma once #ifndef OWB_RMT_H #define OWB_RMT_H #include "freertos/FreeRTOS.h" #include "freertos/queue.h" -#include "freertos/ringbuf.h" -#include "driver/rmt.h" + +#include "driver/rmt_tx.h" +#include "driver/rmt_rx.h" + +#include "owb.h" // for tyoe OneWireBus #ifdef __cplusplus extern "C" { #endif +/** + * @brief RMT driver information + */ typedef struct { - int tx_channel; ///< RMT channel to use for TX - int rx_channel; ///< RMT channel to use for RX - RingbufHandle_t rb; ///< Ring buffer handle - int gpio; ///< OneWireBus GPIO - OneWireBus bus; ///< OneWireBus instance + rmt_channel_handle_t tx_channel_handle; ///< RMT transmit channel, allocated by RMT driver + rmt_channel_handle_t rx_channel_handle; ///< RMT receive channel, allocated by RMT driver + rmt_encoder_handle_t copy_encoder_handle; ///< RMT built-in data encoder that sends pre-defined symbols + rmt_encoder_handle_t bytes_encoder_handle; ///< RMT built-in data encoder that converts bits into symbols + rmt_symbol_word_t *rx_buffer; ///< RMT receive channel symbol buffer + size_t rx_buffer_size_in_bytes; ///< Size of the RMT received buffer, in bytes + QueueHandle_t rx_queue; ///< xQueue to receive RMT symbols from the `on_recv_done` callback + int gpio; ///< OneWireBus GPIO + OneWireBus bus; ///< OneWireBus instance (see owb.h) } owb_rmt_driver_info; /** * @brief Initialise the RMT driver. - * @return OneWireBus*, pass this into the other OneWireBus public API functions + * @param[in] info Pointer to an uninitialized owb_rmt_driver_info structure. + * Note: the structure must remain in scope for the lifetime of this component. + * @param[in] gpio_num The GPIO number to use as the One Wire bus data line. + * @param tx_channel NOW IGNORED: the new RMT driver allocates channels dynamically. + * @param rx_channel NOW IGNORED: the new RMT driver allocates channels dynamically. + * @return OneWireBus *, pass this into the other OneWireBus public API functions */ -OneWireBus* owb_rmt_initialize(owb_rmt_driver_info *info, uint8_t gpio_num, - rmt_channel_t tx_channel, rmt_channel_t rx_channel); +OneWireBus* owb_rmt_initialize(owb_rmt_driver_info * info, gpio_num_t gpio_num, + /*rmt_channel_t*/ int tx_channel, /* rmt_channel_t*/ int rx_channel); + + +/** + * @brief Legacy RMT channel IDs. + * + * These are no longer used for anything. They are defined here purely so + * that code written for the old rmt driver can still compile. + */ +typedef enum { + RMT_CHANNEL_0, /*!< RMT channel number 0 */ + RMT_CHANNEL_1, /*!< RMT channel number 1 */ + RMT_CHANNEL_2, /*!< RMT channel number 2 */ + RMT_CHANNEL_3, /*!< RMT channel number 3 */ +#if SOC_RMT_CHANNELS_PER_GROUP > 4 + RMT_CHANNEL_4, /*!< RMT channel number 4 */ + RMT_CHANNEL_5, /*!< RMT channel number 5 */ + RMT_CHANNEL_6, /*!< RMT channel number 6 */ + RMT_CHANNEL_7, /*!< RMT channel number 7 */ +#endif + RMT_CHANNEL_MAX /*!< Number of RMT channels */ +} rmt_channel_t; + #ifdef __cplusplus } diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/include/owb_rmt_bus_symbols.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/esp32-owb/include/owb_rmt_bus_symbols.h Tue Sep 26 15:15:09 2023 +0200 @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2023 mjcross + * + * SPDX-License-Identifier: MIT +**/ + +#include "owb_rmt_bus_timings.h" + +// RMT transmit channel symbols for the onewire bus signals and conditions +// + +// basic bus levels +// ---------------- +// note: we configure the transmit channel to be hardware inverted, +// so that the bus initialises in the 'released' state +#define OWB_RMT_BUS_ASSERTED 1 +#define OWB_RMT_BUS_RELEASED 0 + +// bus symbols as `rmt_symbol_word_t` +// ---------------------------------- + +// send 'zero' bit +#define OWB_RMT_SYMBOL_0BIT { \ + .level0 = OWB_RMT_BUS_ASSERTED, \ + .duration0 = OWB_TIMING_PARAM_C, \ + .level1 = OWB_RMT_BUS_RELEASED, \ + .duration1 = OWB_TIMING_PARAM_D } + +// send 'one' bit +#define OWB_RMT_SYMBOL_1BIT { \ + .level0 = OWB_RMT_BUS_ASSERTED, \ + .duration0 = OWB_TIMING_PARAM_A, \ + .level1 = OWB_RMT_BUS_RELEASED, \ + .duration1 = OWB_TIMING_PARAM_B } + +// send bus reset +#define OWB_RMT_SYMBOL_RESET { \ + .level0 = OWB_RMT_BUS_ASSERTED, \ + .duration0 = OWB_TIMING_PARAM_H, \ + .level1 = OWB_RMT_BUS_RELEASED, \ + .duration1 = OWB_TIMING_PARAM_I + OWB_TIMING_PARAM_J } + diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/include/owb_rmt_bus_timings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/esp32-owb/include/owb_rmt_bus_timings.h Tue Sep 26 15:15:09 2023 +0200 @@ -0,0 +1,20 @@ +// onewire bus master timings + +// standard rate master timings recommended in the 1-Wire specification +// the values below are the ones recommended by the specification. + +// for the meaning of each parameter, see the following document: +// https://www.analog.com/en/technical-articles/1wire-communication-through-software.html + +// all values in microsec +#define OWB_TIMING_PARAM_A 6 +#define OWB_TIMING_PARAM_B 64 +#define OWB_TIMING_PARAM_C 60 +#define OWB_TIMING_PARAM_D 10 +#define OWB_TIMING_PARAM_E 9 +#define OWB_TIMING_PARAM_F 55 +#define OWB_TIMING_PARAM_G 0 +#define OWB_TIMING_PARAM_H 480 +#define OWB_TIMING_PARAM_I 70 +#define OWB_TIMING_PARAM_J 410 + diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/library.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/esp32-owb/library.json Tue Sep 26 15:15:09 2023 +0200 @@ -0,0 +1,30 @@ +{ + "name": "esp32-owb", + "keywords": "onewire, 1-wire, bus, sensor, temperature", + "description": "ESP32-compatible C component for the Maxim Integrated 1-Wire protocol.", + "repository": + { + "type": "git", + "url": "https://github.com/DavidAntliff/esp32-owb.git" + }, + "authors": + [ + { + "name": "David Antliff", + "url": "https://github.com/DavidAntliff", + "maintainer": true + }, + { + "name": "Chris Morgan", + "url": "https://github.com/chmorgan" + } + ], + "version": "0.1", + "frameworks": "espidf", + "platforms": "espressif32", + "build": { + "flags": [ + "-I include/" + ] + } +} diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/owb.c --- a/components/esp32-owb/owb.c Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/owb.c Tue Sep 26 15:15:09 2023 +0200 @@ -38,6 +38,7 @@ #include "esp_log.h" #include "sdkconfig.h" #include "driver/gpio.h" +#include "rom/gpio.h" // for gpio_pad_select_gpio() #include "owb.h" #include "owb_gpio.h" @@ -102,7 +103,7 @@ do { crc = _calc_crc(crc, *buffer++); - ESP_LOGD(TAG, "crc 0x%02x, len %d", (int)crc, (int)len); + ESP_LOGD(TAG, "buffer 0x%02x, crc 0x%02x, len %d", (uint8_t)*(buffer - 1), (int)crc, (int)len); } while (--len > 0); return crc; @@ -112,7 +113,7 @@ * @param[out] is_found true if a device was found, false if not * @return status */ -static owb_status _search(const OneWireBus * bus, OneWireBus_SearchState * state, bool *is_found) +static owb_status _search(const OneWireBus * bus, OneWireBus_SearchState * state, bool * is_found) { // Based on https://www.maximintegrated.com/en/app-notes/index.mvp/id/187 @@ -126,7 +127,7 @@ uint8_t search_direction = 0; bool search_result = false; uint8_t crc8 = 0; - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; // if the last call was not the last one if (!state->last_device_flag) @@ -160,21 +161,27 @@ if (id_bit && cmp_id_bit) { break; - } else + } + else { // all devices coupled have 0 or 1 if (id_bit != cmp_id_bit) { search_direction = (id_bit) ? 1 : 0; // bit write value for search - } else + } + else { // if this discrepancy if before the Last Discrepancy // on a previous next then pick the same as last time if (id_bit_number < state->last_discrepancy) + { search_direction = ((state->rom_code.bytes[rom_byte_number] & rom_byte_mask) > 0); + } else + { // if equal to last pick 1, if not then pick 0 search_direction = (id_bit_number == state->last_discrepancy); + } // if 0 was picked then record its position in LastZero if (search_direction == 0) @@ -183,16 +190,22 @@ // check for Last discrepancy in family if (last_zero < 9) + { state->last_family_discrepancy = last_zero; + } } } // set or clear the bit in the ROM byte rom_byte_number // with mask rom_byte_mask if (search_direction == 1) + { state->rom_code.bytes[rom_byte_number] |= rom_byte_mask; + } else + { state->rom_code.bytes[rom_byte_number] &= ~rom_byte_mask; + } // serial number search direction write bit bus->driver->write_bits(bus, search_direction, 1); @@ -211,7 +224,7 @@ } } } - while(rom_byte_number < 8); // loop until through all ROM bytes 0-7 + while (rom_byte_number < 8); // loop until through all ROM bytes 0-7 // if the search was successful then if (!((id_bit_number < 65) || (crc8 != 0))) @@ -221,7 +234,9 @@ // check for last device if (state->last_discrepancy == 0) + { state->last_device_flag = true; + } search_result = true; } @@ -247,12 +262,13 @@ owb_status owb_uninitialize(OneWireBus * bus) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!_is_init(bus)) + if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { bus->driver->uninitialize(bus); status = OWB_STATUS_OK; @@ -263,15 +279,17 @@ owb_status owb_use_crc(OneWireBus * bus, bool use_crc) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!bus) + if (!bus) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { bus->use_crc = use_crc; ESP_LOGD(TAG, "use_crc %d", bus->use_crc); @@ -282,19 +300,81 @@ return status; } +owb_status owb_use_parasitic_power(OneWireBus * bus, bool use_parasitic_power) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if (!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + bus->use_parasitic_power = use_parasitic_power; + ESP_LOGD(TAG, "use_parasitic_power %d", bus->use_parasitic_power); + + status = OWB_STATUS_OK; + } + + return status; +} + +owb_status owb_use_strong_pullup_gpio(OneWireBus * bus, gpio_num_t gpio) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if (!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + if (gpio != GPIO_NUM_NC) { + // The strong GPIO pull-up is only activated if parasitic-power mode is enabled + if (!bus->use_parasitic_power) { + ESP_LOGW(TAG, "Strong pull-up GPIO set with parasitic-power disabled"); + } + + gpio_pad_select_gpio(gpio); + gpio_set_direction(gpio, GPIO_MODE_OUTPUT); + } + else + { + gpio_reset_pin(bus->strong_pullup_gpio); + } + + bus->strong_pullup_gpio = gpio; + ESP_LOGD(TAG, "use_strong_pullup_gpio %d", bus->strong_pullup_gpio); + + status = OWB_STATUS_OK; + } + + return status; +} + owb_status owb_read_rom(const OneWireBus * bus, OneWireBus_ROMCode *rom_code) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; memset(rom_code, 0, sizeof(OneWireBus_ROMCode)); - if(!bus || !rom_code) + if (!bus || !rom_code) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { bool is_present; bus->driver->reset(bus, &is_present); @@ -311,11 +391,13 @@ ESP_LOGE(TAG, "CRC failed"); memset(rom_code->bytes, 0, sizeof(OneWireBus_ROMCode)); status = OWB_STATUS_CRC_FAILED; - } else + } + else { status = OWB_STATUS_OK; } - } else + } + else { status = OWB_STATUS_OK; } @@ -333,9 +415,9 @@ return status; } -owb_status owb_verify_rom(const OneWireBus * bus, OneWireBus_ROMCode rom_code, bool* is_present) +owb_status owb_verify_rom(const OneWireBus * bus, OneWireBus_ROMCode rom_code, bool * is_present) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; bool result = false; if (!bus || !is_present) @@ -349,25 +431,25 @@ else { OneWireBus_SearchState state = { + .rom_code = rom_code, .last_discrepancy = 64, .last_device_flag = false, }; bool is_found = false; - while (!state.last_device_flag && !is_found) + _search(bus, &state, &is_found); + if (is_found) { - _search(bus, &state, &is_found); - if (is_found) + result = true; + for (int i = 0; i < sizeof(state.rom_code.bytes) && result; ++i) { - result = true; - for (int i = 0; i < sizeof(state.rom_code.bytes) && result; ++i) - { - result = rom_code.bytes[i] == state.rom_code.bytes[i]; - ESP_LOGD(TAG, "%02x %02x", rom_code.bytes[i], state.rom_code.bytes[i]); - } - is_found = result; + result = rom_code.bytes[i] == state.rom_code.bytes[i]; + ESP_LOGD(TAG, "%02x %02x", rom_code.bytes[i], state.rom_code.bytes[i]); } + is_found = result; } + ESP_LOGD(TAG, "state.last_discrepancy %d, state.last_device_flag %d, is_found %d", + state.last_discrepancy, state.last_device_flag, is_found); ESP_LOGD(TAG, "rom code %sfound", result ? "" : "not "); *is_present = result; @@ -377,19 +459,116 @@ return status; } -owb_status owb_reset(const OneWireBus * bus, bool* a_device_present) +owb_status owb_reset(const OneWireBus * bus, bool * a_device_present) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus || !a_device_present) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if(!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + status = bus->driver->reset(bus, a_device_present); + } + + return status; +} + +owb_status owb_read_bit(const OneWireBus * bus, uint8_t * out) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!bus || !a_device_present) + if (!bus || !out) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if (!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + bus->driver->read_bits(bus, out, 1); + ESP_LOGD(TAG, "owb_read_bit: %02x", *out); + status = OWB_STATUS_OK; + } + + return status; +} + +owb_status owb_read_byte(const OneWireBus * bus, uint8_t * out) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus || !out) { status = OWB_STATUS_PARAMETER_NULL; - } else if(!_is_init(bus)) + } + else if (!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + bus->driver->read_bits(bus, out, 8); + ESP_LOGD(TAG, "owb_read_byte: %02x", *out); + status = OWB_STATUS_OK; + } + + return status; +} + +owb_status owb_read_bytes(const OneWireBus * bus, uint8_t * buffer, unsigned int len) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus || !buffer) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { - bus->driver->reset(bus, a_device_present); + for (int i = 0; i < len; ++i) + { + uint8_t out; + bus->driver->read_bits(bus, &out, 8); + buffer[i] = out; + } + + ESP_LOGD(TAG, "owb_read_bytes, len %d:", len); + ESP_LOG_BUFFER_HEX_LEVEL(TAG, buffer, len, ESP_LOG_DEBUG); + + status = OWB_STATUS_OK; + } + + return status; +} + +owb_status owb_write_bit(const OneWireBus * bus, const uint8_t bit) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if (!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + ESP_LOGD(TAG, "owb_write_bit: %02x", bit); + bus->driver->write_bits(bus, bit & 0x01u, 1); status = OWB_STATUS_OK; } @@ -398,16 +577,19 @@ owb_status owb_write_byte(const OneWireBus * bus, uint8_t data) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!bus) + if (!bus) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { + ESP_LOGD(TAG, "owb_write_byte: %02x", data); bus->driver->write_bits(bus, data, 8); status = OWB_STATUS_OK; } @@ -415,62 +597,23 @@ return status; } -owb_status owb_read_byte(const OneWireBus * bus, uint8_t *out) +owb_status owb_write_bytes(const OneWireBus * bus, const uint8_t * buffer, size_t len) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!bus || !out) - { - status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) - { - status = OWB_STATUS_NOT_INITIALIZED; - } else - { - bus->driver->read_bits(bus, out, 8); - status = OWB_STATUS_OK; - } - - return status; -} - -owb_status owb_read_bytes(const OneWireBus * bus, uint8_t * buffer, unsigned int len) -{ - owb_status status; - - if(!bus || !buffer) + if (!bus || !buffer) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { - for (int i = 0; i < len; ++i) - { - uint8_t out; - bus->driver->read_bits(bus, &out, 8); - buffer[i] = out; - } - - status = OWB_STATUS_OK; - } + ESP_LOGD(TAG, "owb_write_bytes, len %d:", len); + ESP_LOG_BUFFER_HEX_LEVEL(TAG, buffer, len, ESP_LOG_DEBUG); - return status; -} - -owb_status owb_write_bytes(const OneWireBus * bus, const uint8_t * buffer, unsigned int len) -{ - owb_status status; - - if(!bus || !buffer) - { - status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) - { - status = OWB_STATUS_NOT_INITIALIZED; - } else - { for (int i = 0; i < len; i++) { bus->driver->write_bits(bus, buffer[i], 8); @@ -484,15 +627,17 @@ owb_status owb_write_rom_code(const OneWireBus * bus, OneWireBus_ROMCode rom_code) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!bus) + if (!bus) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { owb_write_bytes(bus, (uint8_t*)&rom_code, sizeof(rom_code)); status = OWB_STATUS_OK; @@ -511,18 +656,20 @@ return _calc_crc_block(crc, data, len); } -owb_status owb_search_first(const OneWireBus * bus, OneWireBus_SearchState * state, bool* found_device) +owb_status owb_search_first(const OneWireBus * bus, OneWireBus_SearchState * state, bool * found_device) { bool result; - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; - if(!bus || !state || !found_device) + if (!bus || !state || !found_device) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { memset(&state->rom_code, 0, sizeof(state->rom_code)); state->last_discrepancy = 0; @@ -537,18 +684,20 @@ return status; } -owb_status owb_search_next(const OneWireBus * bus, OneWireBus_SearchState * state, bool* found_device) +owb_status owb_search_next(const OneWireBus * bus, OneWireBus_SearchState * state, bool * found_device) { - owb_status status; + owb_status status = OWB_STATUS_NOT_SET; bool result = false; - if(!bus || !state || !found_device) + if (!bus || !state || !found_device) { status = OWB_STATUS_PARAMETER_NULL; - } else if (!_is_init(bus)) + } + else if (!_is_init(bus)) { status = OWB_STATUS_NOT_INITIALIZED; - } else + } + else { _search(bus, state, &result); status = OWB_STATUS_OK; @@ -568,3 +717,29 @@ } return buffer; } + +owb_status owb_set_strong_pullup(const OneWireBus * bus, bool enable) +{ + owb_status status = OWB_STATUS_NOT_SET; + + if (!bus) + { + status = OWB_STATUS_PARAMETER_NULL; + } + else if (!_is_init(bus)) + { + status = OWB_STATUS_NOT_INITIALIZED; + } + else + { + if (bus->use_parasitic_power && bus->strong_pullup_gpio != GPIO_NUM_NC) + { + gpio_set_level(bus->strong_pullup_gpio, enable ? 1 : 0); + ESP_LOGD(TAG, "strong pullup GPIO %d", enable); + } // else ignore + + status = OWB_STATUS_OK; + } + + return status; +} diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/owb_gpio.c --- a/components/esp32-owb/owb_gpio.c Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/owb_gpio.c Tue Sep 26 15:15:09 2023 +0200 @@ -38,6 +38,8 @@ #include "esp_log.h" #include "sdkconfig.h" #include "driver/gpio.h" +#include "rom/ets_sys.h" // for ets_delay_us() +#include "rom/gpio.h" // for gpio_pad_select_gpio() #include "owb.h" #include "owb_gpio.h" @@ -63,7 +65,7 @@ { uint32_t A, B, C, D, E, F, G, H, I, J; }; -//// @endcond +/// @endcond // 1-Wire timing delays (standard) in microseconds. // Labels and values are from https://www.maximintegrated.com/en/app-notes/index.mvp/id/126 @@ -85,7 +87,9 @@ ets_delay_us(time_us); } +/// @cond ignore #define info_from_bus(owb) container_of(owb, owb_gpio_driver_info, bus) +/// @endcond /** * @brief Generate a 1-Wire reset (initialization). @@ -259,13 +263,14 @@ .read_bits = _read_bits }; -OneWireBus* owb_gpio_initialize(owb_gpio_driver_info *driver_info, int gpio) +OneWireBus* owb_gpio_initialize(owb_gpio_driver_info * driver_info, int gpio) { - ESP_LOGI(TAG, "%s(): gpio %d\n", __func__, gpio); + ESP_LOGD(TAG, "%s(): gpio %d\n", __func__, gpio); driver_info->gpio = gpio; driver_info->bus.driver = &gpio_function_table; driver_info->bus.timing = &_StandardTiming; + driver_info->bus.strong_pullup_gpio = GPIO_NUM_NC; // platform specific: gpio_pad_select_gpio(driver_info->gpio); diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-owb/owb_rmt.c --- a/components/esp32-owb/owb_rmt.c Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-owb/owb_rmt.c Tue Sep 26 15:15:09 2023 +0200 @@ -1,463 +1,665 @@ -/* -Created by Chris Morgan based on the nodemcu project driver. -Copyright 2017 Chris Morgan - -Ported to ESP32 RMT peripheral for low-level signal generation by Arnim Laeuger. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Much of the code was inspired by Derek Yerger's code, though I don't -think much of that remains. In any event that was.. - (copyleft) 2006 by Derek Yerger - Free to distribute freely. +/** + * Copyright (c) 2023 mjcross + * + * SPDX-License-Identifier: MIT +**/ -The CRC code was excerpted and inspired by the Dallas Semiconductor -sample code bearing this copyright. -//--------------------------------------------------------------------------- -// Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES -// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// Except as contained in this notice, the name of Dallas Semiconductor -// shall not be used except as stated in the Dallas Semiconductor -// Branding Policy. -//-------------------------------------------------------------------------- -*/ +#include "esp_log.h" +#include "driver/rmt_tx.h" +#include "driver/rmt_rx.h" #include "owb.h" +#include "owb_rmt_bus_timings.h" +#include "owb_rmt_bus_symbols.h" -#include "driver/rmt.h" -#include "driver/gpio.h" -#include "esp_log.h" +#define OWB_RMT_CLK_HZ 1000000 // run the RMT at 1MHz to get 1us ticks +#define OWB_RMT_TX_MEM_BLOCK_SYMBOLS 64 // size of TX memory block in units of rmt_symbol_word_t (must be even) +#define OWB_RMT_TX_QUEUE_DEPTH 4 // max pending TX transfers +#define OWB_RMT_MAX_READ_BITS 64 // maximum number of bits that will be read at once (used to calculate buffer size) +#define OWB_RMT_RX_MEM_BLOCK_SYMBOLS (OWB_RMT_MAX_READ_BITS + 2) // size of RX memory block in units of rmt_symbol_word_t (must be even) +#define OWB_RMT_RX_MIN_NS 1000 // RMT receive channel glitch rejection threshold (ns) +#define OWB_RMT_TIMEOUT_MS 1000 // timeout threshold for an RMT task (ms) +#define OWB_TIMING_MARGIN 3 // timing variation permitted by our event parsing functions (in microsec) + +// debug parsing of RMT raw symbols +//#define OWB_RMT_DEBUG + +// tag for log messages +static const char * TAG = "owb_rmt"; + + +//------ +// private API functions and constants +//------ -#undef OW_DEBUG +// onewire bus symbols as rmt_symbol_word_t +static const rmt_symbol_word_t owb_rmt_symbol_0bit = OWB_RMT_SYMBOL_0BIT; +static const rmt_symbol_word_t owb_rmt_symbol_1bit = OWB_RMT_SYMBOL_1BIT; +static const rmt_symbol_word_t owb_rmt_symbol_reset = OWB_RMT_SYMBOL_RESET; + +// RMT transmit configuration for the OWB: transmit symbols once then release the bus +static const rmt_transmit_config_t owb_rmt_transmit_config = { + .loop_count = 0, // don't send any repeats + .flags = { + .eot_level = OWB_RMT_BUS_RELEASED // release the bus after the transmission + } +}; + +// RMT receiver configuration for a onewire reset pulse +static const rmt_receive_config_t rx_config_owb_reset = { + .signal_range_min_ns = OWB_RMT_RX_MIN_NS, // glitch rejection threshold (ns) + .signal_range_max_ns = (OWB_TIMING_PARAM_H + OWB_TIMING_PARAM_I) * 1000 // stop condition (ns) +}; + +// RMT receiver configuration for a sequence of onewire data bits +static const rmt_receive_config_t rx_config_owb_bits = { + .signal_range_min_ns = OWB_RMT_RX_MIN_NS, // glitch rejection threshold (ns) + .signal_range_max_ns = (OWB_TIMING_PARAM_A + OWB_TIMING_PARAM_B) * 1000 // stop condition (ns) +}; -// bus reset: duration of low phase [us] -#define OW_DURATION_RESET 480 -// overall slot duration -#define OW_DURATION_SLOT 75 -// write 1 slot and read slot durations [us] -#define OW_DURATION_1_LOW 2 -#define OW_DURATION_1_HIGH (OW_DURATION_SLOT - OW_DURATION_1_LOW) -// write 0 slot durations [us] -#define OW_DURATION_0_LOW 65 -#define OW_DURATION_0_HIGH (OW_DURATION_SLOT - OW_DURATION_0_LOW) -// sample time for read slot -#define OW_DURATION_SAMPLE (15-2) -// RX idle threshold -// needs to be larger than any duration occurring during write slots -#define OW_DURATION_RX_IDLE (OW_DURATION_SLOT + 2) +/** + * @brief Uninstalls a onewire bus driver and releases the associated resources. + * @param bus A previously-initialised OneWireBus. + * @return owb_status OWB_STATUS_OK on success, otherwise an error code (see owb.h) + */ +static owb_status _uninitialize(const OneWireBus *bus) { + + // fetch the parent `owb_rmt_driver_info` structure for `bus` + owb_rmt_driver_info *info = __containerof(bus, owb_rmt_driver_info, bus); // (pointer, type, member) + if (info == NULL) { + ESP_LOGE(TAG, "err uninitialize: no bus container"); + return OWB_STATUS_PARAMETER_NULL; + } + + // release RMT device symbol buffer and queue + free (info->rx_buffer); + vQueueDelete (info->rx_queue); + + // disable and release RMT resources + if (rmt_disable (info->rx_channel_handle) == ESP_OK && + rmt_del_channel (info->rx_channel_handle) == ESP_OK && + rmt_disable (info->tx_channel_handle) == ESP_OK && + rmt_del_channel (info->tx_channel_handle) == ESP_OK && + rmt_del_encoder (info->copy_encoder_handle) == ESP_OK && + rmt_del_encoder (info->bytes_encoder_handle) == ESP_OK ) { + // all resources successfully released + return OWB_STATUS_OK; + } + + // an error occurred + ESP_LOGE(TAG, "err uninitializing"); + return OWB_STATUS_HW_ERROR; +} -static const char * TAG = "owb_rmt"; +/** + * @brief Parses the RMT symbols received during a onewire bus reset. + * @param[in] num_symbols The number of symbols passed. + * @param[in] symbols An array of RMT symbols. + * @param[out] slave_is_present Whether a slave presence signal was detected. + * @return OWB_STATUS_OK if the symbols pass basic valdation; otherwise an error code (see owb.h). + */ +static owb_status _parse_reset_symbols (size_t num_symbols, rmt_symbol_word_t *symbols, bool *slave_is_present) { + *slave_is_present = false; -#define info_of_driver(owb) container_of(owb, owb_rmt_driver_info, bus) + if (num_symbols == 0 || symbols == NULL) { + return OWB_STATUS_PARAMETER_NULL; + } + + #ifdef OWB_RMT_DEBUG + // display raw RMT symbols + ESP_LOGI(TAG, "parse reset: %d symbols", (int)num_symbols); + for (int i = 0; i < num_symbols; i += 1) { + ESP_LOGI (TAG, "\t%u (%uus), %u (%uus)", symbols->level0, symbols->duration0, + symbols->level1, symbols->duration1); + } + #endif -// flush any pending/spurious traces from the RX channel -static void onewire_flush_rmt_rx_buf(const OneWireBus * bus) -{ - void *p; - size_t s; + // check the duration of the reset pulse + if (abs (symbols[0].duration0 - OWB_TIMING_PARAM_H) > OWB_TIMING_MARGIN) { + return OWB_STATUS_HW_ERROR; + } + + // check for a valid 'no slave' event + if (num_symbols == 1 && symbols[0].duration1 == 0) { + *slave_is_present = false; + return OWB_STATUS_OK; + } - owb_rmt_driver_info *i = info_of_driver(bus); + // check for a valid 'slave present' event + if (num_symbols == 2 && // no 'extra' symbols after the presence pulse + symbols[0].duration1 < OWB_TIMING_PARAM_I && // presence pulse must arrive before the sample point + (symbols[1].duration0 + symbols[0].duration1) >= OWB_TIMING_PARAM_I // presence pulse must not finish before the sample point + ) { + *slave_is_present = true; + return OWB_STATUS_OK; + } - while ((p = xRingbufferReceive(i->rb, &s, 0))) - { - ESP_LOGD(TAG, "flushing entry"); - vRingbufferReturnItem(i->rb, p); - } + // anything else is invalid + return OWB_STATUS_HW_ERROR; } -static owb_status _reset(const OneWireBus *bus, bool *is_present) -{ - rmt_item32_t tx_items[1]; - bool _is_present = false; - int res = OWB_STATUS_OK; - owb_rmt_driver_info *i = info_of_driver(bus); - - tx_items[0].duration0 = OW_DURATION_RESET; - tx_items[0].level0 = 0; - tx_items[0].duration1 = 0; - tx_items[0].level1 = 1; +/** + * @brief Parses the RMT symbols received during the transmission of up to 64 onewire bits. + * @param[in] num_symbols The number of symbols passed. + * @param[in] symbols An array of RMT symbols. + * @param[out] result The decoded bits (max 64, lsb first) + * @return int The number of bits decoded + */ +static int _parse_bit_symbols (size_t num_symbols, rmt_symbol_word_t *p_symbol, uint64_t *result) { + *result = 0; + int bit_count = 0; + rmt_symbol_word_t *p_last_symbol = p_symbol + num_symbols; - uint16_t old_rx_thresh; - rmt_get_rx_idle_thresh(i->rx_channel, &old_rx_thresh); - rmt_set_rx_idle_thresh(i->rx_channel, OW_DURATION_RESET+60); + #ifdef OWB_RMT_DEBUG + // display raw RMT symbols + ESP_LOGI(TAG, "parse bits: %d symbols", (int)num_symbols); + #endif - onewire_flush_rmt_rx_buf(bus); - rmt_rx_start(i->rx_channel, true); - if (rmt_write_items(i->tx_channel, tx_items, 1, true) == ESP_OK) - { - size_t rx_size; - rmt_item32_t* rx_items = (rmt_item32_t *)xRingbufferReceive(i->rb, &rx_size, 100 / portTICK_PERIOD_MS); + while (p_symbol < p_last_symbol && bit_count < 64) { + #ifdef OWB_RMT_DEBUG + ESP_LOGI (TAG, "\t%u (%uus), %u (%uus)", p_symbol->level0, p_symbol->duration0, + p_symbol->level1, p_symbol->duration1); + #endif + if (abs (p_symbol->duration0 - OWB_TIMING_PARAM_A) <= OWB_TIMING_MARGIN && + (p_symbol->duration1 == 0 || p_symbol->duration1 >= OWB_TIMING_PARAM_E)) { + // bus was released at the sample point: detect a '1' + *result |= (1ull << bit_count); + bit_count += 1; - if (rx_items) - { - if (rx_size >= (1 * sizeof(rmt_item32_t))) - { -#ifdef OW_DEBUG - ESP_LOGI(TAG, "rx_size: %d", rx_size); + #ifdef OWB_RMT_DEBUG + ESP_LOGI (TAG, "\t\tdetect '1' -> 0x%llx", *result); + #endif - for (int i = 0; i < (rx_size / sizeof(rmt_item32_t)); i++) - { - ESP_LOGI(TAG, "i: %d, level0: %d, duration %d", i, rx_items[i].level0, rx_items[i].duration0); - ESP_LOGI(TAG, "i: %d, level1: %d, duration %d", i, rx_items[i].level1, rx_items[i].duration1); - } -#endif + } else if (p_symbol->duration0 >= (OWB_TIMING_PARAM_A + OWB_TIMING_PARAM_E)) { + // bus was asserted at the sample point: detect a '0' + bit_count += 1; + + #ifdef OWB_RMT_DEBUG + ESP_LOGI (TAG, "\t\tdetect '0' -> 0x%llx", *result); + #endif + } + p_symbol += 1; // next symbol + } + + return bit_count; +} + - // parse signal and search for presence pulse - if ((rx_items[0].level0 == 0) && (rx_items[0].duration0 >= OW_DURATION_RESET - 2)) - { - if ((rx_items[0].level1 == 1) && (rx_items[0].duration1 > 0)) - { - if (rx_items[1].level0 == 0) - { - _is_present = true; - } - } - } - } +/** + * @brief Sends a onewire bus reset pulse and listens for slave presence responses. + * @param[in] bus Points to the OneWireBus structure (see owb.h). + * @param[out] is_present Points to a bool that will receive the detection result. + * @return OWB_STATUS_OK if the call succeeded; otherwise an owb_status error code (see owb.h). + */ +static owb_status _reset (const OneWireBus *bus, bool *is_present) { + + esp_err_t esp_status; - vRingbufferReturnItem(i->rb, (void *)rx_items); - } - else - { - // time out occurred, this indicates an unconnected / misconfigured bus - ESP_LOGE(TAG, "rx_items == 0"); - res = OWB_STATUS_HW_ERROR; - } - } - else - { - // error in tx channel - ESP_LOGE(TAG, "Error tx"); - res = OWB_STATUS_HW_ERROR; + // identify the rmt_driver_info structure that contains `bus` + owb_rmt_driver_info *info = __containerof(bus, owb_rmt_driver_info, bus); + + // start the receiver before the transmitter so that it sees the leading edge of the pulse + esp_status = rmt_receive ( + info->rx_channel_handle, + info->rx_buffer, + info->rx_buffer_size_in_bytes, + &rx_config_owb_reset); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_reset: rx err"); + return OWB_STATUS_HW_ERROR; } - rmt_rx_stop(i->rx_channel); - rmt_set_rx_idle_thresh(i->rx_channel, old_rx_thresh); + // encode and transmit the reset pulse using the RMT 'copy' encoder + esp_status = rmt_transmit ( + info->tx_channel_handle, + info->copy_encoder_handle, + &owb_rmt_symbol_reset, + sizeof (owb_rmt_symbol_reset), + &owb_rmt_transmit_config); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_reset: tx err"); + return OWB_STATUS_HW_ERROR; + } - *is_present = _is_present; + // wait for the transmission to finish (or timeout with an error) + if (rmt_tx_wait_all_done (info->tx_channel_handle, OWB_RMT_TIMEOUT_MS) != ESP_OK) { + ESP_LOGE(TAG, "owb_reset: tx timeout"); + return OWB_STATUS_DEVICE_NOT_RESPONDING; // tx timeout + } - ESP_LOGD(TAG, "_is_present %d", _is_present); - - return res; + // wait for the recv_done event data from our callback + rmt_rx_done_event_data_t rx_done_event_data; + if (xQueueReceive (info->rx_queue, &rx_done_event_data, pdMS_TO_TICKS(OWB_RMT_TIMEOUT_MS)) != pdTRUE) { + ESP_LOGE(TAG, "owb_reset: no rx symbol"); // rx timeout + return OWB_STATUS_DEVICE_NOT_RESPONDING; + } + + // parse the event data and return the result + return _parse_reset_symbols (rx_done_event_data.num_symbols, rx_done_event_data.received_symbols, is_present); } -static rmt_item32_t _encode_write_slot(uint8_t val) -{ - rmt_item32_t item; +/** + * @brief Writes a number of bytes to the onewire bus (slightly more efficient than sending them individually). + * @param bus A previously-initialised OneWireBus. + * @param bytes The bytes to be sent. + * @param number_of_bytes_to_write How many bytes to send. + * @return owb_status OWB_STATUS_OK on success, otherwise an error code (see owb.h). + */ +static owb_status _write_bytes(const OneWireBus *bus, uint8_t *bytes, int number_of_bytes_to_write) { + esp_err_t esp_status; - item.level0 = 0; - item.level1 = 1; - if (val) - { - // write "1" slot - item.duration0 = OW_DURATION_1_LOW; - item.duration1 = OW_DURATION_1_HIGH; - } - else - { - // write "0" slot - item.duration0 = OW_DURATION_0_LOW; - item.duration1 = OW_DURATION_0_HIGH; + // identify the rmt_driver_info structure that contains `bus` + owb_rmt_driver_info *info = __containerof(bus, owb_rmt_driver_info, bus); + + // encode and transmit the bits using the RMT 'bytes' encoder + esp_status = rmt_transmit ( + info->tx_channel_handle, + info->bytes_encoder_handle, + bytes, + (size_t)number_of_bytes_to_write, + &owb_rmt_transmit_config); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_write: tx err"); + return OWB_STATUS_HW_ERROR; } - return item; + // wait for the transmission to finish (or timeout with an error) + if (rmt_tx_wait_all_done (info->tx_channel_handle, OWB_RMT_TIMEOUT_MS) != ESP_OK) { + return OWB_STATUS_DEVICE_NOT_RESPONDING; // tx timeout + } + return OWB_STATUS_OK; } -/** NOTE: The data is shifted out of the low bits, eg. it is written in the order of lsb to msb */ -static owb_status _write_bits(const OneWireBus * bus, uint8_t out, int number_of_bits_to_write) -{ - rmt_item32_t tx_items[number_of_bits_to_write + 1]; - owb_rmt_driver_info *info = info_of_driver(bus); - if (number_of_bits_to_write > 8) - { +/** + * @brief Writes 1-8 bits to the onewire bus. + * @param bus A previously-initialised OneWireBus. + * @param bytes A byte with the bits to be sent (lsb first). + * @param number_of_bits_to_write How many bits to send (maximum 8). + * @return owb_status OWB_STATUS_OK on success, otherwise an error code (see owb.h). + */ +static owb_status _write_bits(const OneWireBus *bus, uint8_t out, int number_of_bits_to_write) { + + // send 8 bits as a byte instead + if (number_of_bits_to_write == 8) { + return _write_bytes (bus, &out, 1); + } + + if (number_of_bits_to_write < 1 || number_of_bits_to_write > 8) { + ESP_LOGE(TAG, "owb_write_bits: bad num of bits (%d)", number_of_bits_to_write); return OWB_STATUS_TOO_MANY_BITS; } - // write requested bits as pattern to TX buffer - for (int i = 0; i < number_of_bits_to_write; i++) - { - tx_items[i] = _encode_write_slot(out & 0x01); - out >>= 1; - } - - // end marker - tx_items[number_of_bits_to_write].level0 = 1; - tx_items[number_of_bits_to_write].duration0 = 0; - - owb_status status; - - if (rmt_write_items(info->tx_channel, tx_items, number_of_bits_to_write+1, true) == ESP_OK) - { - status = OWB_STATUS_OK; - } - else - { - status = OWB_STATUS_HW_ERROR; - ESP_LOGE(TAG, "rmt_write_items() failed"); - } - - return status; -} + // identify the rmt_driver_info structure that contains `bus` + owb_rmt_driver_info *info = __containerof(bus, owb_rmt_driver_info, bus); -static rmt_item32_t _encode_read_slot(void) -{ - rmt_item32_t item; - - // construct pattern for a single read time slot - item.level0 = 0; - item.duration0 = OW_DURATION_1_LOW; // shortly force 0 - item.level1 = 1; - item.duration1 = OW_DURATION_1_HIGH; // release high and finish slot - return item; -} + // send data as individual bits using the `copy` encoder + const rmt_symbol_word_t *symbol_ptr; + esp_err_t esp_status; + for (int b = 0; b < number_of_bits_to_write; b += 1) { + if ((out & (1 << b)) == 0) { + symbol_ptr = &owb_rmt_symbol_0bit; + } else { + symbol_ptr = &owb_rmt_symbol_1bit; + } -/** NOTE: Data is read into the high bits, eg. each bit read is shifted down before the next bit is read */ -static owb_status _read_bits(const OneWireBus * bus, uint8_t *in, int number_of_bits_to_read) -{ - rmt_item32_t tx_items[number_of_bits_to_read + 1]; - uint8_t read_data = 0; - int res = OWB_STATUS_OK; - - owb_rmt_driver_info *info = info_of_driver(bus); - - if (number_of_bits_to_read > 8) - { - ESP_LOGE(TAG, "_read_bits() OWB_STATUS_TOO_MANY_BITS"); - return OWB_STATUS_TOO_MANY_BITS; - } - - // generate requested read slots - for (int i = 0; i < number_of_bits_to_read; i++) - { - tx_items[i] = _encode_read_slot(); + // send bit symbol + esp_status = rmt_transmit ( + info->tx_channel_handle, + info->copy_encoder_handle, + symbol_ptr, + sizeof (rmt_symbol_word_t), + &owb_rmt_transmit_config); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_write_bit: tx err"); + return OWB_STATUS_HW_ERROR; + } } - // end marker - tx_items[number_of_bits_to_read].level0 = 1; - tx_items[number_of_bits_to_read].duration0 = 0; - - onewire_flush_rmt_rx_buf(bus); - rmt_rx_start(info->rx_channel, true); - if (rmt_write_items(info->tx_channel, tx_items, number_of_bits_to_read+1, true) == ESP_OK) - { - size_t rx_size; - rmt_item32_t* rx_items = (rmt_item32_t *)xRingbufferReceive(info->rb, &rx_size, portMAX_DELAY); - - if (rx_items) - { -#ifdef OW_DEBUG - for (int i = 0; i < rx_size / 4; i++) - { - ESP_LOGI(TAG, "level: %d, duration %d", rx_items[i].level0, rx_items[i].duration0); - ESP_LOGI(TAG, "level: %d, duration %d", rx_items[i].level1, rx_items[i].duration1); - } -#endif - - if (rx_size >= number_of_bits_to_read * sizeof(rmt_item32_t)) - { - for (int i = 0; i < number_of_bits_to_read; i++) - { - read_data >>= 1; - // parse signal and identify logical bit - if (rx_items[i].level1 == 1) - { - if ((rx_items[i].level0 == 0) && (rx_items[i].duration0 < OW_DURATION_SAMPLE)) - { - // rising edge occured before 15us -> bit 1 - read_data |= 0x80; - } - } - } - read_data >>= 8 - number_of_bits_to_read; - } - - vRingbufferReturnItem(info->rb, (void *)rx_items); - } - else - { - // time out occurred, this indicates an unconnected / misconfigured bus - ESP_LOGE(TAG, "rx_items == 0"); - res = OWB_STATUS_HW_ERROR; - } + // wait for the transmission to finish (or timeout with an error) + if (rmt_tx_wait_all_done (info->tx_channel_handle, OWB_RMT_TIMEOUT_MS) != ESP_OK) { + return OWB_STATUS_DEVICE_NOT_RESPONDING; // tx timeout } - else - { - // error in tx channel - ESP_LOGE(TAG, "Error tx"); - res = OWB_STATUS_HW_ERROR; - } - - rmt_rx_stop(info->rx_channel); - - *in = read_data; - return res; -} - -static owb_status _uninitialize(const OneWireBus *bus) -{ - owb_rmt_driver_info * info = info_of_driver(bus); - - rmt_driver_uninstall(info->tx_channel); - rmt_driver_uninstall(info->rx_channel); return OWB_STATUS_OK; } -static struct owb_driver rmt_function_table = -{ + +/** + * @brief Reads up to 8 bytes from the onewire bus (this is faster than reading individual bits). + * @param bus A previously-initialised OneWireBus. + * @param result The resulting data, stored lsb first in a uint64_t. + * @param number_of_bytes_to_read The number of bytes to read. + * @return owb_status OWB_STATUS_OK on success, otherwise and error code (see owb.h) + */ +static owb_status _read_bytes(const OneWireBus *bus, uint64_t *result_ptr, int number_of_bytes_to_read) { + static uint8_t ff_bytes[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + esp_err_t esp_status; + + if (number_of_bytes_to_read > 8) { + ESP_LOGE(TAG, "owb_read_bytes: max 8"); + return OWB_STATUS_TOO_MANY_BITS; + } + + // identify the rmt_driver_info structure that contains `bus` + owb_rmt_driver_info *info = __containerof(bus, owb_rmt_driver_info, bus); + + // start the receiver before the transmitter so that it sees the first edge + esp_status = rmt_receive ( + info->rx_channel_handle, + info->rx_buffer, + info->rx_buffer_size_in_bytes, + &rx_config_owb_bits); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_read_bytes: rx err"); + return OWB_STATUS_HW_ERROR; + } + + // generate read slots + esp_status = rmt_transmit ( + info->tx_channel_handle, + info->bytes_encoder_handle, + ff_bytes, + (size_t)number_of_bytes_to_read, + &owb_rmt_transmit_config); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_read_bytes: tx err"); + return OWB_STATUS_HW_ERROR; + } + + // wait for the transmission to finish (or timeout with an error) + if (rmt_tx_wait_all_done (info->tx_channel_handle, OWB_RMT_TIMEOUT_MS) != ESP_OK) { + return OWB_STATUS_DEVICE_NOT_RESPONDING; // tx timeout + } + + // wait for the recv_done event data from our callback + rmt_rx_done_event_data_t rx_done_event_data; + if (xQueueReceive (info->rx_queue, &rx_done_event_data, pdMS_TO_TICKS(OWB_RMT_TIMEOUT_MS)) != pdTRUE) { + ESP_LOGE(TAG, "owb_read_bytes: no rx symbols"); // rx timeout + return OWB_STATUS_DEVICE_NOT_RESPONDING; + } + + // decode upto 64 data bits from the received RMT symbols + if (_parse_bit_symbols(rx_done_event_data.num_symbols, rx_done_event_data.received_symbols, result_ptr) == 0) { + ESP_LOGE(TAG, "owb_read_bytes: no bits"); + } + + return OWB_STATUS_OK; +} + + +/** + * @brief Reads up to 8 bits from the onewire bus. + * @param bus A previously-initialised OneWireBus. + * @param result A byte containing the bits read (lsb first). + * @param number_of_bits_to_read The number of bits to read. + * @return owb_status OWB_STATUS_OK on success, otherwise an error code (see owb.h) + */ +static owb_status _read_bits(const OneWireBus *bus, uint8_t *result, int number_of_bits_to_read) { + esp_err_t esp_status; + + if (number_of_bits_to_read > 8) { + ESP_LOGE(TAG, "owb_read_bits: max 8"); + return OWB_STATUS_TOO_MANY_BITS; + } + + // it's quicker to read 8 bits as a whole byte + if (number_of_bits_to_read == 8) { + uint64_t result_64; + owb_status status; + status = _read_bytes (bus, &result_64, 1); + *result = (uint8_t)result_64; + return status; + } + + // identify the rmt_driver_info structure that contains `bus` + owb_rmt_driver_info *info = __containerof(bus, owb_rmt_driver_info, bus); + + // with the copy encoder then it's most efficient to receive each bit individually + // because we don't accurately know the interval between bits. + // It would be nice to use `rmt_transmit_config.loop_count` here, but it's not supported + // on all chips. In any case the user almost certainly only wants a single bit. + *result = 0; + for (int bit_index = 0; bit_index < number_of_bits_to_read; bit_index += 1) { + + // start the receiver before the transmitter so that it sees the first edge + esp_status = rmt_receive ( + info->rx_channel_handle, + info->rx_buffer, + info->rx_buffer_size_in_bytes, + &rx_config_owb_bits); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_read_bits: rx err"); + return OWB_STATUS_HW_ERROR; + } + + // send a '1' symbol to generate a read slot + esp_status = rmt_transmit ( + info->tx_channel_handle, + info->copy_encoder_handle, + &owb_rmt_symbol_1bit, + sizeof (rmt_symbol_word_t), + &owb_rmt_transmit_config); + if (esp_status != ESP_OK) { + ESP_LOGE(TAG, "owb_read_bits: tx err"); + return OWB_STATUS_HW_ERROR; + } + + // wait for the transmission to finish (or timeout with an error) + if (rmt_tx_wait_all_done (info->tx_channel_handle, OWB_RMT_TIMEOUT_MS) != ESP_OK) { + return OWB_STATUS_DEVICE_NOT_RESPONDING; // tx timeout + } + + // wait for the recv_done event data from our callback + rmt_rx_done_event_data_t rx_done_event_data; + if (xQueueReceive (info->rx_queue, &rx_done_event_data, pdMS_TO_TICKS(OWB_RMT_TIMEOUT_MS)) != pdTRUE) { + ESP_LOGE(TAG, "owb_read_bits: no rx symbol"); // rx timeout + return OWB_STATUS_DEVICE_NOT_RESPONDING; + } + + // parse the event data + uint64_t bits = 0; + if (_parse_bit_symbols (rx_done_event_data.num_symbols, rx_done_event_data.received_symbols, &bits) == 0) { + ESP_LOGE(TAG, "owb_read_bits: no bits"); + return OWB_STATUS_HW_ERROR; + } + + // add the bit to `result` (lsb is received first) + if ((bits & 1) != 0) { + *result |= (1 << bit_index); + } + } + + return OWB_STATUS_OK; +} + + +/** + * @brief Handle the RMT `recv_done` event by copying the event data structure to the specified queue. + * @param[in] channel The handle of the RMT channel that generated the event. + * @param[in] edata A pointer to the RMT event data structure (the pointer is valid only within this function). + * @param[in] context A pointer to the user-provided context, in this case the queue handle. + * @return True if sending to the queue caused a higher priority task to unblock; otherwise False. + */ +static bool IRAM_ATTR _recv_done_callback (rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *event_data, void *user_data) { + // Copy a pointer to the event data structure to the queue identified in the user_data. + //* NOTE: this is an interrupt handler so it needs IRAM_ATTR, may only use `ISR` calls and must return promptly. + // + BaseType_t pxHigherPriorityTaskWoken = pdFALSE; + + xQueueSendFromISR ((QueueHandle_t)user_data, event_data, &pxHigherPriorityTaskWoken); + if (pxHigherPriorityTaskWoken == pdTRUE) { + return true; + } + return false; +} + + +//----- +// Public API functions +//----- + +// RMT version of the OWB driver api (will be stored as info->bus->driver) +// +static struct owb_driver rmt_driver_functions = { .name = "owb_rmt", .uninitialize = _uninitialize, .reset = _reset, .write_bits = _write_bits, - .read_bits = _read_bits + .write_bytes = _write_bytes, // new addition to the API + .read_bits = _read_bits, + .read_bytes = _read_bytes // new addition to the API }; -static owb_status _init(owb_rmt_driver_info *info, uint8_t gpio_num, - rmt_channel_t tx_channel, rmt_channel_t rx_channel) -{ - owb_status status = OWB_STATUS_HW_ERROR; - // Ensure the RMT peripheral is not already running - // Note: if using RMT elsewhere, don't call this here, call it at the start of your prgoram instead. - //periph_module_disable(PERIPH_RMT_MODULE); - //periph_module_enable(PERIPH_RMT_MODULE); +// configure and allocate resources +// +OneWireBus* owb_rmt_initialize (owb_rmt_driver_info *info, gpio_num_t gpio_num, int tx_channel, int rx_channel) +{ + //* The function now ignores tx_channel and rx_channel as the new RMT driver allocates channels on demand. + //* The parameters are kept in the call to preserve compatibility with previous versions. + + // the steps to enable the RMT resources are documented in: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/rmt.html - info->bus.driver = &rmt_function_table; - info->tx_channel = tx_channel; - info->rx_channel = rx_channel; - info->gpio = gpio_num; + // Note: keeping the TX and RX initialisations together in one function simplifies the error handling + + (void)tx_channel; // avoid compiler warning about unused parameter + (void)rx_channel; // avoid compiler warning about unused parameter -#ifdef OW_DEBUG - ESP_LOGI(TAG, "RMT TX channel: %d", info->tx_channel); - ESP_LOGI(TAG, "RMT RX channel: %d", info->rx_channel); -#endif + // sanity check + if (info == NULL) { + ESP_LOGE(TAG, "info is NULL"); + goto exit_err; + } + + // ----- receive channel ----- - rmt_config_t rmt_tx; - rmt_tx.channel = info->tx_channel; - rmt_tx.gpio_num = gpio_num; - rmt_tx.mem_block_num = 1; - rmt_tx.clk_div = 80; - rmt_tx.tx_config.loop_en = false; - rmt_tx.tx_config.carrier_en = false; - rmt_tx.tx_config.idle_level = 1; - rmt_tx.tx_config.idle_output_en = true; - rmt_tx.rmt_mode = RMT_MODE_TX; - if (rmt_config(&rmt_tx) == ESP_OK) - { - if (rmt_driver_install(rmt_tx.channel, 0, ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_SHARED) == ESP_OK) - { - rmt_config_t rmt_rx; - rmt_rx.channel = info->rx_channel; - rmt_rx.gpio_num = gpio_num; - rmt_rx.clk_div = 80; - rmt_rx.mem_block_num = 1; - rmt_rx.rmt_mode = RMT_MODE_RX; - rmt_rx.rx_config.filter_en = true; - rmt_rx.rx_config.filter_ticks_thresh = 30; - rmt_rx.rx_config.idle_threshold = OW_DURATION_RX_IDLE; - if (rmt_config(&rmt_rx) == ESP_OK) - { - if (rmt_driver_install(rmt_rx.channel, 512, ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_SHARED) == ESP_OK) - { - rmt_get_ringbuf_handle(info->rx_channel, &info->rb); - status = OWB_STATUS_OK; - } - else - { - ESP_LOGE(TAG, "failed to install rx driver"); - } - } - else - { - status = OWB_STATUS_HW_ERROR; - ESP_LOGE(TAG, "failed to configure rx, uninstalling rmt driver on tx channel"); - rmt_driver_uninstall(rmt_tx.channel); - } + // channel config + const rmt_rx_channel_config_t rx_channel_config = { + .gpio_num = (int)gpio_num, + .clk_src = RMT_CLK_SRC_APB, // use the APB clock (might reduce during light sleep) + .resolution_hz = OWB_RMT_CLK_HZ, + .mem_block_symbols = (size_t)OWB_RMT_RX_MEM_BLOCK_SYMBOLS, + .flags = { + .invert_in = 0, // don't hardware invert the input + .with_dma = 0, // don't enable DMA + .io_loop_back = 0 // we define the loopback in the tx config } - else - { - ESP_LOGE(TAG, "failed to install tx driver"); - } + }; + + // request channel + //* note: to get a wired-OR bus you must apply the rx_config first, _then_ the rx_config + if (rmt_new_rx_channel (&rx_channel_config, &(info->rx_channel_handle)) != ESP_OK) { + ESP_LOGE(TAG, "err requesting rx_channel"); + goto exit_err; + } + + // create queue for RMT `rx_done` event data struct (from callback) + info->rx_queue = xQueueCreate (1, sizeof (rmt_rx_done_event_data_t)); + if (info->rx_queue == NULL) { + ESP_LOGE(TAG, "err creating rx_queue"); + goto exit_delete_rx_channel; } - else - { - ESP_LOGE(TAG, "failed to configure tx"); + + // allocate rx symbol buffer for RMT driver + info->rx_buffer_size_in_bytes = OWB_RMT_MAX_READ_BITS * sizeof (rmt_symbol_word_t); + info->rx_buffer = (rmt_symbol_word_t *)malloc (info->rx_buffer_size_in_bytes); + if (info->rx_buffer == NULL) { + ESP_LOGE(TAG, "err allocating rx_buffer"); + goto exit_delete_rx_queue; + } + + // register rx channel callback (rx_queue is passed as user context) + const rmt_rx_event_callbacks_t rmt_rx_event_callbacks = { + .on_recv_done = _recv_done_callback + }; + if (rmt_rx_register_event_callbacks (info->rx_channel_handle, &rmt_rx_event_callbacks, info->rx_queue) != ESP_OK) { + ESP_LOGE(TAG, "err registering rx_callbacks"); + goto exit_release_rx_buffer; + } + + // enable channel + if (rmt_enable (info->rx_channel_handle) != ESP_OK) { + ESP_LOGE(TAG, "err enabling rx_channel"); + goto exit_release_rx_buffer; } - // attach GPIO to previous pin - if (gpio_num < 32) - { - GPIO.enable_w1ts = (0x1 << gpio_num); + // ----- transmit channel ----- + + // channel config + const rmt_tx_channel_config_t tx_channel_config = { + .gpio_num = (int)gpio_num, + .clk_src = RMT_CLK_SRC_APB, // use the APB clock (might reduce during light sleep) + .resolution_hz = OWB_RMT_CLK_HZ, + .mem_block_symbols = (size_t)OWB_RMT_TX_MEM_BLOCK_SYMBOLS, + .trans_queue_depth = OWB_RMT_TX_QUEUE_DEPTH, + .flags = { + .invert_out = 1, // invert the output (so that the bus is initially released) + .with_dma = 0, // don't enable DMA + .io_loop_back = 1, // enable reading of actual voltage of output pin + .io_od_mode = 1 // enable open-drain output, so as to achieve a 'wired-OR' bus + } + }; + + // request channel + if (rmt_new_tx_channel (&tx_channel_config, &(info->tx_channel_handle)) != ESP_OK) { + ESP_LOGE(TAG, "err requesting tx_channel"); + goto exit_disable_rx_channel; } - else - { - GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); + + // enable channel + if (rmt_enable (info->tx_channel_handle) != ESP_OK) { + ESP_LOGE(TAG, "err enabling tx_channel"); + goto exit_delete_tx_channel; + } + + // obtain a 'copy' encoder (an RMT built-in used for sending fixed bit patterns) + const rmt_copy_encoder_config_t rmt_copy_encoder_config = {}; // config is "reserved for future expansion" + if (rmt_new_copy_encoder (&rmt_copy_encoder_config, &(info->copy_encoder_handle)) != ESP_OK) { + ESP_LOGE(TAG, "err requesting copy encoder"); + goto exit_disable_tx_channel; } - // attach RMT channels to new gpio pin - // ATTENTION: set pin for rx first since gpio_output_disable() will - // remove rmt output signal in matrix! - rmt_set_pin(info->rx_channel, RMT_MODE_RX, gpio_num); - rmt_set_pin(info->tx_channel, RMT_MODE_TX, gpio_num); - - // force pin direction to input to enable path to RX channel - PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); - - // enable open drain - GPIO.pin[gpio_num].pad_driver = 1; - - return status; -} - -OneWireBus * owb_rmt_initialize(owb_rmt_driver_info *info, uint8_t gpio_num, - rmt_channel_t tx_channel, rmt_channel_t rx_channel) -{ - ESP_LOGD(TAG, "%s: gpio_num: %d, tx_channel: %d, rx_channel: %d", - __func__, gpio_num, tx_channel, rx_channel); - - owb_status status = _init(info, gpio_num, tx_channel, rx_channel); - if(status != OWB_STATUS_OK) - { - ESP_LOGE(TAG, "_init() failed with status %d", status); + // otain a 'bytes' encoder (an RMT built-in used for sending variable bit patterns) + const rmt_bytes_encoder_config_t rmt_bytes_encoder_config = { + .bit0 = OWB_RMT_SYMBOL_0BIT, + .bit1 = OWB_RMT_SYMBOL_1BIT, + .flags = { + .msb_first = 0 // onewire bus on-the-wire bit order is lsb first + } + }; + if (rmt_new_bytes_encoder(&rmt_bytes_encoder_config, &info->bytes_encoder_handle) != ESP_OK) { + ESP_LOGE(TAG, "err requesting bytes encoder"); + goto exit_delete_copy_encoder; } + + // ----- success ------ + info->gpio = gpio_num; + info->bus.driver = &rmt_driver_functions; // route driver API calls to the functions in this file + ESP_LOGI(TAG, "%s: OK", __func__); return &(info->bus); + + // ----- error: unwind allocated resources ----- +exit_delete_copy_encoder: + ESP_ERROR_CHECK(rmt_del_encoder(info->copy_encoder_handle)); +exit_disable_tx_channel: + ESP_ERROR_CHECK(rmt_disable (info->tx_channel_handle)); +exit_delete_tx_channel: + ESP_ERROR_CHECK(rmt_del_channel (info->tx_channel_handle)); +exit_disable_rx_channel: + ESP_ERROR_CHECK(rmt_disable (info->rx_channel_handle)); +exit_release_rx_buffer: + free (info->rx_buffer); +exit_delete_rx_queue: + vQueueDelete (info->rx_queue); +exit_delete_rx_channel: + ESP_ERROR_CHECK(rmt_del_channel (info->rx_channel_handle)); +exit_err: + ESP_LOGE(TAG, "%s: failed", __func__); + return NULL; } diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-rotary-encoder/CMakeLists.txt --- a/components/esp32-rotary-encoder/CMakeLists.txt Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-rotary-encoder/CMakeLists.txt Tue Sep 26 15:15:09 2023 +0200 @@ -1,5 +1,5 @@ -#idf_component_register(SRCS "rotary_encoder.c" INCLUDE_DIRS include) set(COMPONENT_ADD_INCLUDEDIRS include) set(COMPONENT_SRCS "rotary_encoder.c") +set(COMPONENT_REQUIRES "driver") register_component() diff -r 3ac60b34794c -r 7425fa11f23e components/esp32-rotary-encoder/rotary_encoder.c --- a/components/esp32-rotary-encoder/rotary_encoder.c Tue Sep 26 10:39:56 2023 +0200 +++ b/components/esp32-rotary-encoder/rotary_encoder.c Tue Sep 26 15:15:09 2023 +0200 @@ -220,12 +220,12 @@ info->state.direction = ROTARY_ENCODER_DIRECTION_NOT_SET; // configure GPIOs - gpio_pad_select_gpio(info->pin_a); + gpio_reset_pin(info->pin_a); gpio_set_pull_mode(info->pin_a, GPIO_PULLUP_ONLY); gpio_set_direction(info->pin_a, GPIO_MODE_INPUT); gpio_set_intr_type(info->pin_a, GPIO_INTR_ANYEDGE); - gpio_pad_select_gpio(info->pin_b); + gpio_reset_pin(info->pin_b); gpio_set_pull_mode(info->pin_b, GPIO_PULLUP_ONLY); gpio_set_direction(info->pin_b, GPIO_MODE_INPUT); gpio_set_intr_type(info->pin_b, GPIO_INTR_ANYEDGE); diff -r 3ac60b34794c -r 7425fa11f23e main/CMakeLists.txt --- a/main/CMakeLists.txt Tue Sep 26 10:39:56 2023 +0200 +++ b/main/CMakeLists.txt Tue Sep 26 15:15:09 2023 +0200 @@ -1,3 +1,5 @@ -idf_component_register(SRCS config.c task_user.c task_mqtt.c task_ds18b20.c updates.c task_adc.c xutil.c co2meter.c u8g2_esp32_hal.c task_wifi.c +set(srcs config.c task_user.c task_mqtt.c task_ds18b20.c updates.c task_adc.c xutil.c co2meter.c u8g2_esp32_hal.c task_wifi.c) + +idf_component_register(SRCS "${srcs}" INCLUDE_DIRS ".") diff -r 3ac60b34794c -r 7425fa11f23e main/co2meter.c --- a/main/co2meter.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/co2meter.c Tue Sep 26 15:15:09 2023 +0200 @@ -230,10 +230,10 @@ if (P < 0) P = 0; units[i].pressure = P; - ESP_LOGI(TAG, "%d vb:%.3f vp:%.3f zero:%d scale:%3d mbar:%4d alm: %d t:%6.3f %s", - i, adc_state->Batt_voltage / 1000.0, units[i].pressure_voltage / 1000.0, units[i].pressure_zero, - units[i].pressure_voltage / (adc_state->Batt_voltage / 1000) - units[i].pressure_zero, P, units[i].alarm, - units[i].temperature / 1000.0, units[i].temperature_rom_code); + ESP_LOGI(TAG, "%d vb:%.3f vp:%.3f zero:%lu scale:%3lu mbar:%4d alm: %lu t:%6.3f %s", + i, (adc_state->Batt_voltage / 1000.0), (units[i].pressure_voltage / 1000.0), units[i].pressure_zero, + (units[i].pressure_voltage / (adc_state->Batt_voltage / 1000) - units[i].pressure_zero), P, units[i].alarm, + (double)(units[i].temperature / 1000.0), units[i].temperature_rom_code); xSemaphoreGive(xSemaphoreADC); } else { ESP_LOGE(TAG, "ML1_MQTT_CONNECT ADC[%d] lock error", i); diff -r 3ac60b34794c -r 7425fa11f23e main/config.c --- a/main/config.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/config.c Tue Sep 26 15:15:09 2023 +0200 @@ -10,24 +10,25 @@ unit_t units[3]; ///< Pressure test units SemaphoreHandle_t xSemaphoreUnits = NULL; ///< Semaphore Units records - +wifiStation_t wifiStation; +strConfig_t config; void write_config() { uint8_t *dst = (uint8_t *)&config; - FILE *f = fopen("/spiffs/etc/config.conf", "w+"); + FILE *f = fopen("/spiffs/config.conf", "w+"); if (f == NULL) { - ESP_LOGE(TAG, "write /spiffs/etc/config.conf failed"); + ESP_LOGE(TAG, "write /spiffs/config.conf failed"); return; } size_t bytes = fwrite(dst, 1, sizeof(config), f); fclose(f); if (bytes != sizeof(config)) { - ESP_LOGE(TAG, "/spiffs/etc/config.conf written %d/%d bytes", bytes, sizeof(config)); + ESP_LOGE(TAG, "/spiffs/config.conf written %d/%d bytes", bytes, sizeof(config)); } else { - ESP_LOGD(TAG, "/spiffs/etc/config.conf written %d bytes", bytes); + ESP_LOGD(TAG, "/spiffs/config.conf written %d bytes", bytes); } } @@ -36,7 +37,7 @@ void read_config() { uint8_t *dst; uint8_t mac_addr[8] = {0}; - FILE *f = fopen("/spiffs/etc/config.conf", "r"); + FILE *f = fopen("/spiffs/config.conf", "r"); if (f == NULL) { // No configuration yet, create it. @@ -47,14 +48,14 @@ config.mqtt_port = 1883; config.mqtt_user[0] = '\0'; config.mqtt_pwd[0] = '\0'; - sprintf(config.uuid, "c0ffeeee-dead-beef-cafe-%02x%02x%02x%02x%02x%02x", + sprintf(config.uuid, "c0ffeeee-dead-beef-cafe-%02x%02x%02x%02x%02x%02x", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); write_config(); } else { dst = (uint8_t*)&config; size_t bytes = fread(dst, 1, sizeof(config), f); fclose(f); - ESP_LOGD(TAG, "/spiffs/etc/config.conf read %d bytes", bytes); + ESP_LOGD(TAG, "/spiffs/config.conf read %d bytes", bytes); } } @@ -62,18 +63,18 @@ void write_units() { uint8_t *dst = (uint8_t *)&units; - FILE *f = fopen("/spiffs/etc/units.conf", "r+"); + FILE *f = fopen("/spiffs/units.conf", "r+"); if (f == NULL) { - ESP_LOGE(TAG, "write /spiffs/etc/units.conf failed"); + ESP_LOGE(TAG, "write /spiffs/units.conf failed"); return; } size_t bytes = fwrite(dst, 1, sizeof(units), f); fclose(f); if (bytes != sizeof(units)) { - ESP_LOGE(TAG, "/spiffs/etc/units.conf written %d/%d bytes", bytes, sizeof(units)); + ESP_LOGE(TAG, "/spiffs/units.conf written %d/%d bytes", bytes, sizeof(units)); } else { - ESP_LOGD(TAG, "/spiffs/etc/units.conf written %d bytes", bytes); + ESP_LOGD(TAG, "/spiffs/units.conf written %d bytes", bytes); } } @@ -83,22 +84,22 @@ uint8_t *dst = (uint8_t *)&units; uint8_t mac_addr[8] = {0}; size_t bytes; - FILE *f = fopen("/spiffs/etc/units.conf", "r"); + FILE *f = fopen("/spiffs/units.conf", "r"); if (f == NULL) { // No units yet, create them. - ESP_LOGE(TAG, "/spiffs/etc/units.conf not found, create new"); + ESP_LOGE(TAG, "/spiffs/units.conf not found, create new"); goto u_error; } else { bytes = fread(dst, 1, sizeof(units), f); fclose(f); if (bytes != sizeof(units)) { - ESP_LOGE(TAG, "/spiffs/etc/units.conf read %d of %d bytes", bytes, sizeof(units)); + ESP_LOGE(TAG, "/spiffs/units.conf read %d of %d bytes", bytes, sizeof(units)); goto u_error; } - ESP_LOGI(TAG, "/spiffs/etc/units.conf read %d bytes", bytes); + ESP_LOGI(TAG, "/spiffs/units.conf read %d bytes", bytes); for (int i = 0; i < 3; i++) - ESP_LOGI(TAG, "%d %s %d %4d %3d", i, units[i].alias, units[i].pressure_channel, units[i].pressure_voltage, units[i].pressure_zero); + ESP_LOGI(TAG, "%d %s %d %4lu %3lu", i, units[i].alias, units[i].pressure_channel, units[i].pressure_voltage, units[i].pressure_zero); } return; @@ -111,13 +112,13 @@ sprintf(units[i].alias, "unit%d", (i + 1) & 3); units[i].pressure_zero = 110; } - f = fopen("/spiffs/etc/units.conf", "w+"); + f = fopen("/spiffs/units.conf", "w+"); bytes = fwrite(dst, 1, sizeof(units), f); fclose(f); if (bytes != sizeof(units)) { - ESP_LOGE(TAG, "/spiffs/etc/units.conf written %d/%d bytes", bytes, sizeof(units)); + ESP_LOGE(TAG, "/spiffs/units.conf written %d/%d bytes", bytes, sizeof(units)); } else { - ESP_LOGI(TAG, "/spiffs/etc/units.conf written %d bytes", bytes); + ESP_LOGI(TAG, "/spiffs/units.conf written %d bytes", bytes); } } @@ -129,13 +130,13 @@ uint8_t *dst = (uint8_t *)&wifiStation; if (read_station(SSID) >= 0) { - ESP_LOGE(TAG, "add_station %s already excists", SSID); + ESP_LOGE(TAG, "add_station %s already exists", SSID); return -1; } - f = fopen("/spiffs/etc/stations.conf", "a+"); + f = fopen("/spiffs/stations.conf", "a+"); if (f == NULL) { - ESP_LOGE(TAG, "write /spiffs/etc/stations.conf failed"); + ESP_LOGE(TAG, "write /spiffs/stations.conf failed"); return -1; } memset(dst, 0, sizeof(wifiStation)); @@ -164,11 +165,11 @@ } memset(dst, 0, sizeof(wifiStation)); - f = fopen("/spiffs/etc/stations.conf", "r+"); + f = fopen("/spiffs/stations.conf", "r+"); if (f == NULL) { - f = fopen("/spiffs/etc/stations.conf", "w+"); + f = fopen("/spiffs/stations.conf", "w+"); fclose(f); - ESP_LOGI(TAG, "/spiffs/etc/stations.conf created, return -1"); + ESP_LOGI(TAG, "/spiffs/stations.conf created, return -1"); return -1; } @@ -177,6 +178,7 @@ while (1) { bytes = fread(dst, 1, sizeof(wifiStation), f); + ESP_LOGI(TAG, " read_station bytes %d size %d", bytes, sizeof(wifiStation)); if (bytes < sizeof(wifiStation)) { fclose(f); memset(dst, 0, sizeof(wifiStation)); @@ -200,14 +202,14 @@ uint8_t *dst; size_t bytes; - n = fopen("/spiffs/etc/stations.new", "a"); + n = fopen("/spiffs/stations.new", "a"); if (n == NULL) { - ESP_LOGE(TAG, "cannot create /spiffs/etc/stations.new"); + ESP_LOGE(TAG, "cannot create /spiffs/stations.new"); return; } - o = fopen("/spiffs/etc/stations.conf", "r"); + o = fopen("/spiffs/stations.conf", "r"); if (o == NULL) { - ESP_LOGE(TAG, "cannot open spiffs/etc/stations.conf for reading"); + ESP_LOGE(TAG, "cannot open spiffs/stations.conf for reading"); fclose(n); return; } @@ -227,8 +229,8 @@ fclose(o); fclose(n); - rename("/spiffs/etc/stations.conf", "/spiffs/etc/stations.old"); - rename("/spiffs/etc/stations.new", "/spiffs/etc/stations.conf"); - unlink("/spiffs/etc/stations.old"); + rename("/spiffs/stations.conf", "/spiffs/stations.old"); + rename("/spiffs/stations.new", "/spiffs/stations.conf"); + unlink("/spiffs/stations.old"); } diff -r 3ac60b34794c -r 7425fa11f23e main/config.h --- a/main/config.h Tue Sep 26 10:39:56 2023 +0200 +++ b/main/config.h Tue Sep 26 15:15:09 2023 +0200 @@ -4,8 +4,8 @@ * spiffs filesystem in a flash partition. */ -#ifndef _CONFIG_H -#define _CONFIG_H +#ifndef _G_CONFIG_H +#define _G_CONFIG_H // Global includes for the project @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -25,21 +26,25 @@ #include "freertos/event_groups.h" #include "freertos/queue.h" #include "driver/gpio.h" -#include "driver/adc.h" #include "driver/rtc_io.h" #include "soc/sens_periph.h" #include "soc/rtc.h" -#include "esp_adc_cal.h" +#include "esp_adc/adc_oneshot.h" +#include "esp_adc/adc_cali.h" +#include "esp_adc/adc_cali_scheme.h" #include "esp_log.h" #include "esp_spiffs.h" #include "esp_vfs.h" #include "esp_system.h" +#include "esp_chip_info.h" +#include "esp_mac.h" #include "esp_wifi.h" #include "esp_wpa2.h" #include "esp_event.h" -#include "esp_spi_flash.h" +#include "esp_timer.h" #include "esp_ota_ops.h" #include "esp_http_client.h" +#include "esp_app_format.h" #include "nvs_flash.h" #include "lwip/sockets.h" #include "lwip/dns.h" @@ -115,7 +120,7 @@ /** * @brief Global configuration. File /spiffs/config.conf */ -struct strConfig { +typedef struct { uint8_t Version; ///< Record version number for updates. char ntp_server[32]; ///< Preffered NTP server. char hostname[32]; ///< Our hostname. @@ -125,7 +130,7 @@ uint16_t mqtt_port; ///< MQTT TCP port. char mqtt_user[32]; ///< MQTT user name if needed. char mqtt_pwd[62]; ///< MQTT password. -} config; ///< Config record. +} strConfig_t; ///< Config record. /** @@ -144,11 +149,12 @@ /** * @brief Records with WiFi stations we have succesfully connected. */ -struct strStations { +typedef struct { char SSID[32]; ///< Station SSID char Password[64]; ///< Station password bool xhide; ///< Hide from AP scan. -} wifiStation; ///< Station record. +} wifiStation_t; ///< Station record. + /** * @brief Add a new station record. @@ -176,7 +182,7 @@ /** * @brief Records that describes the carbonation units, */ -typedef struct strUnit { +typedef struct { char uuid[37]; ///< Unit uuid char alias[33]; ///< Alias name 'unit1' int temperature_state; ///< Reading status diff -r 3ac60b34794c -r 7425fa11f23e main/task_adc.c --- a/main/task_adc.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/task_adc.c Tue Sep 26 15:15:09 2023 +0200 @@ -11,7 +11,6 @@ #define DEFAULT_VREF 1093 ///< Use adc2_vref_to_gpio() to obtain a better estimate #define NO_OF_SAMPLES 128 ///< Multisampling - #define PRESSURE_1 (CONFIG_PRESSURE_1) ///< ADC channel pressure sensor 1 #define PRESSURE_2 (CONFIG_PRESSURE_2) ///< ADC channel pressure sensor 2 #define PRESSURE_3 (CONFIG_PRESSURE_3) ///< ADC channel pressure sensor 3 @@ -23,11 +22,16 @@ SemaphoreHandle_t xSemaphoreADC = NULL; ///< Semaphire ADC task EventGroupHandle_t xEventGroupADC; ///< Events ADC task ADC_State *adc_state; ///< Public state for other tasks +bool do_calibration = false; + const int TASK_ADC_REQUEST_PRESSURE = BIT0; ///< Request temperature measurements const int TASK_ADC_REQUEST_DONE = BIT1; ///< Request is completed +static bool adc_calibration_init(adc_unit_t unit, adc_atten_t atten, adc_cali_handle_t *out_handle); +static void adc_calibration_deinit(adc_cali_handle_t handle); + void request_adc(void) { @@ -51,16 +55,22 @@ */ void task_adc(void *pvParameter) { - int i, adc_reading; - adc_atten_t atten = ADC_ATTEN_DB_0; + adc_cali_handle_t adc1_cali_handle = NULL; + adc_unit_t channel; + + adc_oneshot_chan_cfg_t config_adc = { + .bitwidth = ADC_BITWIDTH_DEFAULT, + .atten = ADC_ATTEN_DB_0, + }; ESP_LOGI(TAG, "Starting task ADC sensors"); + adc_state = malloc(sizeof(ADC_State)); - for (i = 0; i < 3; i++) { - adc_state->Pressure[i].valid = false; - adc_state->Pressure[i].atten = ADC_ATTEN_DB_0; - adc_state->Pressure[i].voltage = 0; - adc_state->Pressure[i].error = ADC_ERR_NONE; + for (int i = 0; i < 3; i++) { + adc_state->Pressure[i].valid = false; + adc_state->Pressure[i].atten = ADC_ATTEN_DB_0; + adc_state->Pressure[i].voltage = 0; + adc_state->Pressure[i].error = ADC_ERR_NONE; } adc_state->Pressure[0].channel = PRESSURE_1; adc_state->Pressure[1].channel = PRESSURE_2; @@ -68,9 +78,6 @@ adc_state->Batt_voltage = 0; adc_state->Batt_error = ADC_ERR_NONE; - //Characterize ADC - esp_adc_cal_characteristics_t *adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t)); - /* event handler and event group for this task */ xEventGroupADC = xEventGroupCreate(); EventBits_t uxBits; @@ -85,19 +92,36 @@ if (uxBits & TASK_ADC_REQUEST_PRESSURE) { ESP_LOGD(TAG, "Requested ADC readings"); - adc1_config_width(ADC_WIDTH_BIT_12); + + int adc_reading, raw, tmp, voltage; + adc_atten_t atten = ADC_ATTEN_DB_0; + + adc_oneshot_unit_handle_t adc1_handle; + adc_oneshot_unit_init_cfg_t init_config1 = { + .unit_id = ADC_UNIT_1, + }; - for (i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { + + ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle)); + atten = config_adc.atten = ADC_ATTEN_DB_0, + + channel = adc_state->Pressure[i].channel; + ESP_ERROR_CHECK(adc_oneshot_config_channel(adc1_handle, channel, &config_adc)); adc_reading = 0; - atten = ADC_ATTEN_DB_0; - + /* * Autoranging the ADC conversion */ while (1) { - esp_adc_cal_characterize(ADC_UNIT_1, atten, ADC_WIDTH_BIT_12, DEFAULT_VREF, adc_chars); - adc1_config_channel_atten((adc1_channel_t)adc_state->Pressure[i].channel, atten); - int raw = adc1_get_raw((adc1_channel_t)adc_state->Pressure[i].channel); + + config_adc.bitwidth = ADC_BITWIDTH_DEFAULT; + config_adc.atten = atten; + adc_oneshot_config_channel(adc1_handle, channel, &config_adc); + + ESP_ERROR_CHECK(adc_oneshot_read(adc1_handle, channel, &raw)); + +// ESP_LOGI(TAG, "bottle %d channel %d raw %d atten %d", i, channel, raw, atten); if (atten == ADC_ATTEN_DB_0 && raw > 3700) atten = ADC_ATTEN_DB_2_5; else if (atten == ADC_ATTEN_DB_2_5 && raw > 3700) @@ -112,20 +136,27 @@ * Now that he have the best attenuation, multisample the real value. */ for (int j = 0; j < NO_OF_SAMPLES; j++) { - int tmp = adc1_get_raw((adc1_channel_t)adc_state->Pressure[i].channel); - if (tmp < 0) { - adc_reading = -1; - break; - } + if (adc_oneshot_read(adc1_handle, channel, &tmp) == ESP_OK) { adc_reading += tmp; + } else { + adc_reading = -1; + break; + } } + + adc1_cali_handle = NULL; + do_calibration = adc_calibration_init(ADC_UNIT_1, atten, &adc1_cali_handle); + if (xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE) { if (adc_reading < 0) { adc_state->Pressure[i].error = ADC_ERR_READ; adc_state->Pressure[i].voltage = 0; } else { adc_reading /= NO_OF_SAMPLES; - adc_state->Pressure[i].voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars); // voltage in mV + adc_cali_raw_to_voltage(adc1_cali_handle, adc_reading, &voltage); + adc_state->Pressure[i].voltage = voltage; + //adc_state->Pressure[i].voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars); // voltage in mV +// ESP_LOGI(TAG, "Voltage %d %d", i, voltage); adc_state->Pressure[i].error = ADC_ERR_NONE; } xSemaphoreGive(xSemaphoreADC); @@ -133,7 +164,14 @@ ESP_LOGE(TAG, "Missed lock 1"); } ESP_LOGI(TAG, "Pressure %d raw: %4d, atten: %d, %.3f volt, error: %d", - i, adc_reading, atten, adc_state->Pressure[i].voltage / 1000.0, adc_state->Pressure[i].error); + i, adc_reading, atten, (adc_state->Pressure[i].voltage / 1000.0), adc_state->Pressure[i].error); + + //Tear Down + ESP_ERROR_CHECK(adc_oneshot_del_unit(adc1_handle)); + if (do_calibration) { + adc_calibration_deinit(adc1_cali_handle); + } + do_calibration = false; } /* @@ -141,15 +179,24 @@ */ adc_reading = 0; atten = ADC_ATTEN_DB_6; // Don't use DB_11, it has a bad linearity. - esp_adc_cal_characterize(ADC_UNIT_1, atten, ADC_WIDTH_BIT_12, DEFAULT_VREF, adc_chars); - adc1_config_channel_atten((adc1_channel_t)BATT_CHANNEL, atten); + adc1_cali_handle = NULL; + channel = (adc_unit_t)BATT_CHANNEL; + ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle)); + do_calibration = adc_calibration_init(ADC_UNIT_1, atten, &adc1_cali_handle); + + config_adc.bitwidth = ADC_BITWIDTH_DEFAULT; + config_adc.atten = atten; + adc_oneshot_config_channel(adc1_handle, (adc_unit_t)BATT_CHANNEL, &config_adc); + + ESP_ERROR_CHECK(adc_oneshot_read(adc1_handle, (adc_unit_t)BATT_CHANNEL, &raw)); + for (int j = 0; j < NO_OF_SAMPLES; j++) { - int tmp = adc1_get_raw((adc1_channel_t)BATT_CHANNEL); - if (tmp < 0) { - adc_reading = -1; - break; - } - adc_reading += tmp; + if (adc_oneshot_read(adc1_handle, channel, &tmp) == ESP_OK) { + adc_reading += tmp; + } else { + adc_reading = -1; + break; + } } if (xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE) { if (adc_reading < 0) { @@ -157,7 +204,9 @@ adc_state->Batt_error = ADC_ERR_READ; } else { adc_reading /= NO_OF_SAMPLES; - adc_state->Batt_voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars) * 2; // Chip supply voltage in mV + adc_cali_raw_to_voltage(adc1_cali_handle, adc_reading, &voltage); + /* Multiply by 2, measured on a ladder. */ + adc_state->Batt_voltage = voltage * 2; // Chip supply voltage in mV adc_state->Batt_error = ADC_ERR_NONE; } xSemaphoreGive(xSemaphoreADC); @@ -165,6 +214,12 @@ ESP_LOGE(TAG, "Missed lock 2"); } + ESP_ERROR_CHECK(adc_oneshot_del_unit(adc1_handle)); + if (do_calibration) { + adc_calibration_deinit(adc1_cali_handle); + } + do_calibration = false; + xEventGroupClearBits(xEventGroupADC, TASK_ADC_REQUEST_PRESSURE); xEventGroupSetBits(xEventGroupADC, TASK_ADC_REQUEST_DONE); #if 1 @@ -174,3 +229,41 @@ } } + +/*--------------------------------------------------------------- + ADC Calibration +---------------------------------------------------------------*/ +static bool adc_calibration_init(adc_unit_t unit, adc_atten_t atten, adc_cali_handle_t *out_handle) +{ + adc_cali_handle_t handle = NULL; + esp_err_t ret = ESP_FAIL; + bool calibrated = false; + + if (!calibrated) { + adc_cali_line_fitting_config_t cali_config = { + .unit_id = unit, + .atten = atten, + .bitwidth = ADC_BITWIDTH_DEFAULT, + }; + ret = adc_cali_create_scheme_line_fitting(&cali_config, &handle); + if (ret == ESP_OK) { + calibrated = true; + } + } + + *out_handle = handle; + if (ret == ESP_ERR_NOT_SUPPORTED || !calibrated) { + ESP_LOGW(TAG, "eFuse not burnt, skip software calibration"); + } else if (ret != ESP_OK) { + ESP_LOGE(TAG, "Invalid arg or no memory"); + } + + return calibrated; +} + + +static void adc_calibration_deinit(adc_cali_handle_t handle) +{ + ESP_ERROR_CHECK(adc_cali_delete_scheme_line_fitting(handle)); +} + diff -r 3ac60b34794c -r 7425fa11f23e main/task_mqtt.c --- a/main/task_mqtt.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/task_mqtt.c Tue Sep 26 15:15:09 2023 +0200 @@ -30,7 +30,7 @@ extern unit_t units[3]; extern SemaphoreHandle_t xSemaphoreUnits; extern const esp_app_desc_t *app_desc; - +extern strConfig_t config; void connect_mqtt(bool state) @@ -127,7 +127,7 @@ payload = xstrcat(payload, (char *)"\",\"mode\":\""); payload = xstrcat(payload, (char *)unitMode[units[i].mode]); payload = xstrcat(payload, (char *)"\",\"alarm\":"); - sprintf(buf, "%d", units[i].alarm); + sprintf(buf, "%lu", units[i].alarm); payload = xstrcat(payload, buf); // temperature_state temperature_address temperature @@ -363,7 +363,9 @@ xEventGroupMQTT = xEventGroupCreate(); EventBits_t uxBits; esp_mqtt_client_config_t mqtt_cfg = { - .uri = "mqtt://localhost", + .broker = { + .address.uri = "mqtt://localhost", + }, }; client = esp_mqtt_client_init(&mqtt_cfg); esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, client); diff -r 3ac60b34794c -r 7425fa11f23e main/task_user.c --- a/main/task_user.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/task_user.c Tue Sep 26 15:15:09 2023 +0200 @@ -21,12 +21,12 @@ rotary_encoder_info_t rinfo = { 0 }; ///< Rotary encoder record rotary_encoder_event_t event = { 0 }; ///< Rotary encoder events QueueHandle_t event_queue; ///< Events queue -static xQueueHandle gpio_evt_queue = NULL; ///< Rotary pushbutton queue +QueueHandle_t gpio_evt_queue = NULL; ///< Rotary pushbutton queue static int PushDuration = 0; ///< Duration of the pushed button -struct strStations APs[10]; ///< List of APs we know +wifiStation_t APs[10]; ///< List of APs we know int edit_ssid = 0; ///< SSID being edited int num_ssids = 0; ///< Number of SSIDs we know -struct strStations editAP; ///< Data of station to edit +wifiStation_t editAP; ///< Data of station to edit char sensors[DS18B20_MAX][17]; ///< Sensors to select uint32_t err_connect = 0; ///< Connect error count uint32_t err_alarm = 0; ///< Alarm watchdog error count @@ -45,6 +45,8 @@ extern int Main_Loop1; ///< Main measure loop extern int update_running; ///< If update is running extern int num_sensors; ///< Detected DS18B20 sensors +extern strConfig_t config; +extern wifiStation_t wifiStation; const int TASK_USER_COLD = BIT0; ///< System cold start const int TASK_USER_WAKEUP = BIT1; ///< System wakeup from deepsleep @@ -550,14 +552,14 @@ void screen_list_aps(int sub, int offset) { int i; - struct strStations ap; + wifiStation_t ap; uint8_t *dst = (uint8_t *)≈ FILE *f; size_t bytes; num_ssids = 0; memset(dst, 0, sizeof(ap)); - f = fopen("/spiffs/etc/stations.conf", "r+"); + f = fopen("/spiffs/stations.conf", "r"); if (f) { while (1) { bytes = fread(dst, 1, sizeof(ap), f); @@ -717,11 +719,11 @@ char buf[65]; screen_top("Software fouten"); - snprintf(buf, 64, "Network %4d", err_connect); + snprintf(buf, 64, "Network %4lu", err_connect); u8g2_DrawStr(&u8g2, 1, 28, buf); - snprintf(buf, 64, "Watchdog %4d", err_alarm); + snprintf(buf, 64, "Watchdog %4lu", err_alarm); u8g2_DrawStr(&u8g2, 1, 43, buf); - snprintf(buf, 64, "DS18B20 %4d", err_temp); + snprintf(buf, 64, "DS18B20 %4lu", err_temp); u8g2_DrawStr(&u8g2, 1, 59, buf); u8g2_SendBuffer(&u8g2); } @@ -761,7 +763,7 @@ } } } else { - ESP_LOGE(TAG, "GPIO[%d] unknown intr, val: %d", io_num, gpio_get_level(io_num)); + ESP_LOGE(TAG, "GPIO[%lu] unknown intr, val: %d", io_num, gpio_get_level(io_num)); } UserTimer = INACTIVITY; } @@ -1010,7 +1012,7 @@ screen_network_setup(SubMenu); break; default: - ESP_LOGI(TAG, "Event: position %d, direction %s", event.state.position, + ESP_LOGI(TAG, "Event: position %ld, direction %s", event.state.position, event.state.direction ? (event.state.direction == ROTARY_ENCODER_DIRECTION_CLOCKWISE ? "CW":"CCW"):"NOT_SET"); } } @@ -1079,7 +1081,7 @@ if (adc_state->Pressure[idx].voltage > 165 && adc_state->Pressure[idx].voltage < 660) { units[idx].pressure_zero = adc_state->Pressure[idx].voltage / (adc_state->Batt_voltage / 1000); write_units(); - ESP_LOGI(TAG, "Zero set unit %d, %d mV set %d", idx, adc_state->Pressure[idx].voltage, units[idx].pressure_zero); + ESP_LOGI(TAG, "Zero set unit %d, %lu mV set %lu", idx, adc_state->Pressure[idx].voltage, units[idx].pressure_zero); } xSemaphoreGive(xSemaphoreADC); xSemaphoreGive(xSemaphoreUnits); @@ -1150,6 +1152,7 @@ break; case ML2_EDIT_AP: + ESP_LOGI(TAG, " ML2_EDIT_AP: SubMenu %d edit_ssid %d", SubMenu, edit_ssid); if (SubMenu == 0) { rotary_editer("SSID", editAP.SSID, "", 16, EDIT_TYPE_TEXT); screen_edit_ap(SubMenu); @@ -1158,23 +1161,11 @@ screen_edit_ap(SubMenu); } else if (SubMenu == 2 || SubMenu == 3) { update_running = 1; // Block measurements - int timeout = 600; if (edit_ssid < 0) New_Loop2 = ML2_SETUP_WIFI; else New_Loop2 = ML2_LIST_APS; - for (;;) { - vTaskDelay(100 / portTICK_PERIOD_MS); - if (Main_Loop1 == ML1_DONE) - break; - if (timeout) - timeout--; - else { - ESP_LOGE(TAG, "Timout request stop"); - goto saveerr; - } - } if (edit_ssid >= 0) { ESP_LOGI(TAG, "Remove %s", APs[edit_ssid].SSID); remove_station((uint8_t *)APs[edit_ssid].SSID); @@ -1184,7 +1175,6 @@ add_station((uint8_t *)editAP.SSID, (uint8_t *)editAP.Password); } } -saveerr: update_running = 0; break; @@ -1272,7 +1262,7 @@ ESP_ERROR_CHECK(rotary_encoder_enable_half_steps(&rinfo, false)); gpio_config_t io_conf; - io_conf.intr_type = GPIO_PIN_INTR_ANYEDGE; + io_conf.intr_type = GPIO_INTR_ANYEDGE; io_conf.pin_bit_mask = (1ULL << ROT_ENC_SW_GPIO); io_conf.mode = GPIO_MODE_INPUT; gpio_config(&io_conf); diff -r 3ac60b34794c -r 7425fa11f23e main/task_wifi.c --- a/main/task_wifi.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/task_wifi.c Tue Sep 26 15:15:09 2023 +0200 @@ -18,6 +18,9 @@ WIFI_State *wifi_state = NULL; ///< Public state for other tasks. esp_netif_t *sta_netif = NULL; ///< Station interface +extern wifiStation_t wifiStation; +extern strConfig_t config; + wifi_scan_config_t scan_config = { .ssid = 0, @@ -135,7 +138,7 @@ } default: - ESP_LOGW(TAG, "Unknown WiFi event %d", event_id); + ESP_LOGW(TAG, "Unknown WiFi event %ld", event_id); break; } } @@ -181,7 +184,7 @@ break; default: - ESP_LOGW(TAG, "Unknown IP event %d", event_id); + ESP_LOGW(TAG, "Unknown IP event %ld", event_id); break; } } diff -r 3ac60b34794c -r 7425fa11f23e main/u8g2_esp32_hal.c --- a/main/u8g2_esp32_hal.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/u8g2_esp32_hal.c Tue Sep 26 15:15:09 2023 +0200 @@ -23,8 +23,6 @@ static u8g2_esp32_hal_t u8g2_esp32_hal; ///< HAL state data. static bool initialized = false; -#undef ESP_ERROR_CHECK -#define ESP_ERROR_CHECK(x) do { esp_err_t rc = (x); if (rc != ESP_OK) { ESP_LOGE("err", "esp_err_t = %d", rc); assert(0 && #x);} } while(0); /* * Initialze the ESP32 HAL. @@ -124,13 +122,14 @@ break; } - i2c_config_t conf; - conf.mode = I2C_MODE_MASTER; - conf.sda_io_num = u8g2_esp32_hal.sda; - conf.sda_pullup_en = GPIO_PULLUP_ENABLE; - conf.scl_io_num = u8g2_esp32_hal.scl; - conf.scl_pullup_en = GPIO_PULLUP_ENABLE; - conf.master.clk_speed = I2C_MASTER_FREQ_HZ; + i2c_config_t conf = { + .mode = I2C_MODE_MASTER, + .sda_io_num = u8g2_esp32_hal.sda, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_io_num = u8g2_esp32_hal.scl, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = I2C_MASTER_FREQ_HZ, + }; ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf)); ESP_LOGI(TAG, "I2C gpio_sda: %d gpio_scl: %d clk_speed: %d master_num: %d", u8g2_esp32_hal.sda, u8g2_esp32_hal.scl, I2C_MASTER_FREQ_HZ, I2C_MASTER_NUM); @@ -163,7 +162,7 @@ case U8X8_MSG_BYTE_END_TRANSFER: { ESP_LOGD(TAG, "End I2C transfer."); ESP_ERROR_CHECK(i2c_master_stop(handle_i2c)); - ESP_ERROR_CHECK(i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, I2C_TIMEOUT_MS / portTICK_RATE_MS)); + i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, I2C_TIMEOUT_MS / portTICK_PERIOD_MS); i2c_cmd_link_delete(handle_i2c); break; } diff -r 3ac60b34794c -r 7425fa11f23e main/updates.c --- a/main/updates.c Tue Sep 26 10:39:56 2023 +0200 +++ b/main/updates.c Tue Sep 26 15:15:09 2023 +0200 @@ -103,7 +103,7 @@ esp_http_client_cleanup(client); goto updateerr; } - ESP_LOGI(TAG, "Update to partition subtype %d at offset 0x%x", update_partition->subtype, update_partition->address); + ESP_LOGI(TAG, "Update to partition subtype %d at offset 0x%lu", update_partition->subtype, update_partition->address); err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle); if (err != ESP_OK) { @@ -126,7 +126,7 @@ } else if (data_read > 0) { if (image_header_was_checked == false) { esp_app_desc_t new_app_info; - if (data_read > sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t)) { + if (data_read > (sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t))) { // check current version with downloading memcpy(&new_app_info, &ota_write_data[sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t)], sizeof(esp_app_desc_t)); diff -r 3ac60b34794c -r 7425fa11f23e sdkconfig --- a/sdkconfig Tue Sep 26 10:39:56 2023 +0200 +++ b/sdkconfig Tue Sep 26 15:15:09 2023 +0200 @@ -2,41 +2,236 @@ # Automatically generated file. DO NOT EDIT. # Espressif IoT Development Framework (ESP-IDF) Project Configuration # +CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" +CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" +CONFIG_SOC_DPORT_WORKAROUND="Not determined" +CONFIG_SOC_CAPS_ECO_VER_MAX=301 +CONFIG_SOC_ADC_SUPPORTED=y +CONFIG_SOC_DAC_SUPPORTED=y +CONFIG_SOC_UART_SUPPORTED=y +CONFIG_SOC_MCPWM_SUPPORTED=y +CONFIG_SOC_GPTIMER_SUPPORTED=y +CONFIG_SOC_SDMMC_HOST_SUPPORTED=y +CONFIG_SOC_BT_SUPPORTED=y +CONFIG_SOC_PCNT_SUPPORTED=y +CONFIG_SOC_WIFI_SUPPORTED=y +CONFIG_SOC_SDIO_SLAVE_SUPPORTED=y +CONFIG_SOC_TWAI_SUPPORTED=y +CONFIG_SOC_EMAC_SUPPORTED=y +CONFIG_SOC_ULP_SUPPORTED=y +CONFIG_SOC_CCOMP_TIMER_SUPPORTED=y +CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_MEM_SUPPORTED=y +CONFIG_SOC_RTC_MEM_SUPPORTED=y +CONFIG_SOC_I2S_SUPPORTED=y +CONFIG_SOC_RMT_SUPPORTED=y +CONFIG_SOC_SDM_SUPPORTED=y +CONFIG_SOC_GPSPI_SUPPORTED=y +CONFIG_SOC_LEDC_SUPPORTED=y +CONFIG_SOC_I2C_SUPPORTED=y +CONFIG_SOC_SUPPORT_COEXISTENCE=y +CONFIG_SOC_AES_SUPPORTED=y +CONFIG_SOC_MPI_SUPPORTED=y +CONFIG_SOC_SHA_SUPPORTED=y +CONFIG_SOC_FLASH_ENC_SUPPORTED=y +CONFIG_SOC_SECURE_BOOT_SUPPORTED=y +CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y +CONFIG_SOC_BOD_SUPPORTED=y +CONFIG_SOC_ULP_FSM_SUPPORTED=y +CONFIG_SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL=5 +CONFIG_SOC_XTAL_SUPPORT_26M=y +CONFIG_SOC_XTAL_SUPPORT_40M=y +CONFIG_SOC_XTAL_SUPPORT_AUTO_DETECT=y +CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DMA_SUPPORTED=y +CONFIG_SOC_ADC_PERIPH_NUM=2 +CONFIG_SOC_ADC_MAX_CHANNEL_NUM=10 +CONFIG_SOC_ADC_ATTEN_NUM=4 +CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 +CONFIG_SOC_ADC_PATT_LEN_MAX=16 +CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 +CONFIG_SOC_ADC_DIGI_RESULT_BYTES=2 +CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=2 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=20 +CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 +CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y +CONFIG_SOC_CPU_CORES_NUM=2 +CONFIG_SOC_CPU_INTR_NUM=32 +CONFIG_SOC_CPU_HAS_FPU=y +CONFIG_SOC_CPU_BREAKPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINT_SIZE=64 +CONFIG_SOC_DAC_CHAN_NUM=2 +CONFIG_SOC_DAC_RESOLUTION=8 +CONFIG_SOC_DAC_DMA_16BIT_ALIGN=y +CONFIG_SOC_GPIO_PORT=1 +CONFIG_SOC_GPIO_PIN_COUNT=40 +CONFIG_SOC_GPIO_VALID_GPIO_MASK=0xFFFFFFFFFF +CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0xEF0FEA +CONFIG_SOC_I2C_NUM=2 +CONFIG_SOC_I2C_FIFO_LEN=32 +CONFIG_SOC_I2C_SUPPORT_SLAVE=y +CONFIG_SOC_I2C_SUPPORT_APB=y +CONFIG_SOC_I2S_NUM=2 +CONFIG_SOC_I2S_HW_VERSION_1=y +CONFIG_SOC_I2S_SUPPORTS_APLL=y +CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y +CONFIG_SOC_I2S_SUPPORTS_PDM=y +CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y +CONFIG_SOC_I2S_PDM_MAX_TX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y +CONFIG_SOC_I2S_PDM_MAX_RX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_ADC_DAC=y +CONFIG_SOC_I2S_SUPPORTS_ADC=y +CONFIG_SOC_I2S_SUPPORTS_DAC=y +CONFIG_SOC_I2S_SUPPORTS_LCD_CAMERA=y +CONFIG_SOC_I2S_TRANS_SIZE_ALIGN_WORD=y +CONFIG_SOC_I2S_LCD_I80_VARIANT=y +CONFIG_SOC_LCD_I80_SUPPORTED=y +CONFIG_SOC_LCD_I80_BUSES=2 +CONFIG_SOC_LCD_I80_BUS_WIDTH=24 +CONFIG_SOC_LEDC_HAS_TIMER_SPECIFIC_MUX=y +CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y +CONFIG_SOC_LEDC_SUPPORT_REF_TICK=y +CONFIG_SOC_LEDC_SUPPORT_HS_MODE=y +CONFIG_SOC_LEDC_CHANNEL_NUM=8 +CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 +CONFIG_SOC_MCPWM_GROUPS=2 +CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 +CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 +CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 +CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y +CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 +CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 +CONFIG_SOC_MMU_PERIPH_NUM=2 +CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=3 +CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 +CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 +CONFIG_SOC_PCNT_GROUPS=1 +CONFIG_SOC_PCNT_UNITS_PER_GROUP=8 +CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 +CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 +CONFIG_SOC_RMT_GROUPS=1 +CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 +CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=64 +CONFIG_SOC_RMT_SUPPORT_REF_TICK=y +CONFIG_SOC_RMT_SUPPORT_APB=y +CONFIG_SOC_RMT_CHANNEL_CLK_INDEPENDENT=y +CONFIG_SOC_RTCIO_PIN_COUNT=18 +CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y +CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y +CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y +CONFIG_SOC_SDM_GROUPS=1 +CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 +CONFIG_SOC_SDM_CLK_SUPPORT_APB=y +CONFIG_SOC_SPI_HD_BOTH_INOUT_SUPPORTED=y +CONFIG_SOC_SPI_AS_CS_SUPPORTED=y +CONFIG_SOC_SPI_PERIPH_NUM=3 +CONFIG_SOC_SPI_DMA_CHAN_NUM=2 +CONFIG_SOC_SPI_MAX_CS_NUM=3 +CONFIG_SOC_SPI_SUPPORT_CLK_APB=y +CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 +CONFIG_SOC_SPI_MAX_PRE_DIVIDER=8192 +CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_26M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y +CONFIG_SOC_TIMER_GROUPS=2 +CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 +CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=64 +CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 +CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y +CONFIG_SOC_TOUCH_VERSION_1=y +CONFIG_SOC_TOUCH_SENSOR_NUM=10 +CONFIG_SOC_TOUCH_PAD_MEASURE_WAIT_MAX=0xFF +CONFIG_SOC_TWAI_CONTROLLER_NUM=1 +CONFIG_SOC_TWAI_BRP_MIN=2 +CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y +CONFIG_SOC_TWAI_SUPPORT_MULTI_ADDRESS_LAYOUT=y +CONFIG_SOC_UART_NUM=3 +CONFIG_SOC_UART_SUPPORT_APB_CLK=y +CONFIG_SOC_UART_SUPPORT_REF_TICK=y +CONFIG_SOC_UART_FIFO_LEN=128 +CONFIG_SOC_UART_BITRATE_MAX=5000000 +CONFIG_SOC_SPIRAM_SUPPORTED=y +CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y +CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG=y +CONFIG_SOC_SHA_SUPPORT_SHA1=y +CONFIG_SOC_SHA_SUPPORT_SHA256=y +CONFIG_SOC_SHA_SUPPORT_SHA384=y +CONFIG_SOC_SHA_SUPPORT_SHA512=y +CONFIG_SOC_RSA_MAX_BIT_LEN=4096 +CONFIG_SOC_AES_SUPPORT_AES_128=y +CONFIG_SOC_AES_SUPPORT_AES_192=y +CONFIG_SOC_AES_SUPPORT_AES_256=y +CONFIG_SOC_SECURE_BOOT_V1=y +CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=y +CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=32 +CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 +CONFIG_SOC_PM_SUPPORT_EXT0_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_FAST_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_SLOW_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y +CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y +CONFIG_SOC_PM_SUPPORT_MODEM_PD=y +CONFIG_SOC_CONFIGURABLE_VDDSDIO_SUPPORTED=y +CONFIG_SOC_CLK_APLL_SUPPORTED=y +CONFIG_SOC_APLL_MULTIPLIER_OUT_MIN_HZ=350000000 +CONFIG_SOC_APLL_MULTIPLIER_OUT_MAX_HZ=500000000 +CONFIG_SOC_APLL_MIN_HZ=5303031 +CONFIG_SOC_APLL_MAX_HZ=125000000 +CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y +CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y +CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y +CONFIG_SOC_SDMMC_USE_IOMUX=y +CONFIG_SOC_SDMMC_NUM_SLOTS=2 +CONFIG_SOC_WIFI_WAPI_SUPPORT=y +CONFIG_SOC_WIFI_CSI_SUPPORT=y +CONFIG_SOC_WIFI_MESH_SUPPORT=y +CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y +CONFIG_SOC_WIFI_NAN_SUPPORT=y +CONFIG_SOC_BLE_SUPPORTED=y +CONFIG_SOC_BLE_MESH_SUPPORTED=y +CONFIG_SOC_BT_CLASSIC_SUPPORTED=y CONFIG_IDF_CMAKE=y +CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET_ARCH="xtensa" CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET_ESP32=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 # -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set -# end of SDK tool configuration - -# # Build type # CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_APP_BUILD_TYPE_RAM is not set CONFIG_APP_BUILD_GENERATE_BINARIES=y CONFIG_APP_BUILD_BOOTLOADER=y CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# CONFIG_APP_REPRODUCIBLE_BUILD is not set +# CONFIG_APP_NO_BLOBS is not set +# CONFIG_APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # end of Build type # -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 -# end of Application manager - -# # Bootloader config # +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set @@ -52,30 +247,55 @@ CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set # CONFIG_BOOTLOADER_APP_TEST is not set -# CONFIG_BOOTLOADER_WDT_ENABLE is not set +CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y +CONFIG_BOOTLOADER_WDT_ENABLE=y +# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set +CONFIG_BOOTLOADER_WDT_TIME_MS=9000 # CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set # CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 # CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set +CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # end of Bootloader config # # Security features # +CONFIG_SECURE_BOOT_V1_SUPPORTED=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features # +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +CONFIG_ESP_ROM_HAS_CRC_LE=y +CONFIG_ESP_ROM_HAS_CRC_BE=y +CONFIG_ESP_ROM_HAS_MZ_CRC32=y +CONFIG_ESP_ROM_HAS_JPEG_DECODE=y +CONFIG_ESP_ROM_HAS_UART_BUF_SWITCH=y +CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y +CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y + +# # Serial flasher config # -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 -CONFIG_ESPTOOLPY_WITH_STUB=y +# CONFIG_ESPTOOLPY_NO_STUB is not set # CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set CONFIG_ESPTOOLPY_FLASHMODE_DIO=y # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set CONFIG_ESPTOOLPY_FLASHFREQ_40M=y @@ -87,22 +307,17 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set CONFIG_ESPTOOLPY_BEFORE="default_reset" CONFIG_ESPTOOLPY_AFTER_RESET=y # CONFIG_ESPTOOLPY_AFTER_NORESET is not set CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # end of Serial flasher config @@ -110,6 +325,7 @@ # Partition Table # # CONFIG_PARTITION_TABLE_SINGLE_APP is not set +# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" @@ -129,7 +345,7 @@ CONFIG_I2C_MASTER_SCL=22 CONFIG_I2C_MASTER_SDA=21 CONFIG_I2C_MASTER_PORT_NUM=0 -CONFIG_I2C_MASTER_FREQUENCY=200000 +CONFIG_I2C_MASTER_FREQUENCY=100000 # end of I2C bus # @@ -160,6 +376,10 @@ CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y # CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_CXX_RTTI is not set CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y @@ -167,7 +387,8 @@ # CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options # @@ -177,8 +398,12 @@ # # Application Level Tracing # -# CONFIG_APPTRACE_DEST_TRAX is not set +# CONFIG_APPTRACE_DEST_JTAG is not set CONFIG_APPTRACE_DEST_NONE=y +# CONFIG_APPTRACE_DEST_UART1 is not set +# CONFIG_APPTRACE_DEST_UART2 is not set +CONFIG_APPTRACE_DEST_UART_NONE=y +CONFIG_APPTRACE_UART_TASK_PRIO=1 CONFIG_APPTRACE_LOCK_ENABLE=y # end of Application Level Tracing @@ -186,64 +411,122 @@ # Bluetooth # # CONFIG_BT_ENABLED is not set -CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 -CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 -CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 -CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0 -CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 -CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 -CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 -CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 -CONFIG_BT_RESERVE_DRAM=0 # end of Bluetooth # -# CoAP Configuration -# -CONFIG_COAP_MBEDTLS_PSK=y -# CONFIG_COAP_MBEDTLS_PKI is not set -# CONFIG_COAP_MBEDTLS_DEBUG is not set -CONFIG_COAP_LOG_DEFAULT_LEVEL=0 -# end of CoAP Configuration - -# -# Driver configurations +# Driver Configurations # # -# ADC configuration +# Legacy ADC Configuration # -# CONFIG_ADC_FORCE_XPD_FSM is not set CONFIG_ADC_DISABLE_DAC=y -# end of ADC configuration +# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set # -# SPI configuration +# Legacy ADC Calibration Configuration +# +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set +# end of Legacy ADC Calibration Configuration +# end of Legacy ADC Configuration + +# +# SPI Configuration # # CONFIG_SPI_MASTER_IN_IRAM is not set CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_SPI_SLAVE_IN_IRAM is not set CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of SPI configuration +# end of SPI Configuration + +# +# TWAI Configuration +# +# CONFIG_TWAI_ISR_IN_IRAM is not set +CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC=y +CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y +CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y +CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y +CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM=y +# end of TWAI Configuration + +# +# UART Configuration +# +# CONFIG_UART_ISR_IN_IRAM is not set +# end of UART Configuration # -# TWAI configuration +# GPIO Configuration +# +# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set +# end of GPIO Configuration + +# +# Sigma Delta Modulator Configuration # -# CONFIG_TWAI_ISR_IN_IRAM is not set -# end of TWAI configuration +# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_SDM_ENABLE_DEBUG_LOG is not set +# end of Sigma Delta Modulator Configuration + +# +# GPTimer Configuration +# +# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set +# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set +# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set +# end of GPTimer Configuration # -# UART configuration +# PCNT Configuration # -# CONFIG_UART_ISR_IN_IRAM is not set -# end of UART configuration +# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_PCNT_ISR_IRAM_SAFE is not set +# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set +# end of PCNT Configuration + +# +# RMT Configuration +# +# CONFIG_RMT_ISR_IRAM_SAFE is not set +# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_RMT_ENABLE_DEBUG_LOG is not set +# end of RMT Configuration # -# RTCIO configuration +# MCPWM Configuration +# +# CONFIG_MCPWM_ISR_IRAM_SAFE is not set +# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set +# end of MCPWM Configuration + +# +# I2S Configuration # -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration -# end of Driver configurations +# CONFIG_I2S_ISR_IRAM_SAFE is not set +# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_I2S_ENABLE_DEBUG_LOG is not set +# end of I2S Configuration + +# +# DAC Configuration +# +# CONFIG_DAC_CTRL_FUNC_IN_IRAM is not set +# CONFIG_DAC_ISR_IRAM_SAFE is not set +# CONFIG_DAC_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_DAC_ENABLE_DEBUG_LOG is not set +CONFIG_DAC_DMA_AUTO_16BIT_ALIGN=y +# end of DAC Configuration +# end of Driver Configurations # # eFuse Bit Manager @@ -261,109 +544,38 @@ # CONFIG_ESP_TLS_USING_MBEDTLS=y # CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set # CONFIG_ESP_TLS_SERVER is not set # CONFIG_ESP_TLS_PSK_VERIFICATION is not set +# CONFIG_ESP_TLS_INSECURE is not set # end of ESP-TLS # -# ESP32-specific +# ADC and ADC Calibration # -# CONFIG_ESP32_REV_MIN_0 is not set -CONFIG_ESP32_REV_MIN_1=y -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -CONFIG_ESP32_REV_MIN=1 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 -# CONFIG_ESP32_SPIRAM_SUPPORT is not set -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 -# CONFIG_ESP32_DEBUG_OCDAWARE is not set -CONFIG_ESP32_BROWNOUT_DET=y -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_REDUCE_PHY_TX_POWER=y -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific +# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set # -# Power Management +# ADC Calibration Configurations # -# CONFIG_PM_ENABLE is not set -# end of Power Management +# CONFIG_ADC_CALI_EFUSE_TP_ENABLE is not set +CONFIG_ADC_CALI_EFUSE_VREF_ENABLE=y +# CONFIG_ADC_CALI_LUT_ENABLE is not set +# end of ADC Calibration Configurations + +CONFIG_ADC_DISABLE_DAC_OUTPUT=y +# end of ADC and ADC Calibration # -# ADC-Calibration +# Wireless Coexistence # -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y -# end of ADC-Calibration +# end of Wireless Coexistence # # Common ESP-related # CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_UART_NONE is not set -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=1 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=3 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT_OFFSET=2 -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y # end of Common ESP-related # @@ -372,16 +584,15 @@ CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ETH_PHY_INTERFACE_RMII=y -# CONFIG_ETH_PHY_INTERFACE_MII is not set CONFIG_ETH_RMII_CLK_INPUT=y # CONFIG_ETH_RMII_CLK_OUTPUT is not set CONFIG_ETH_RMII_CLK_IN_GPIO=0 CONFIG_ETH_DMA_BUFFER_SIZE=512 CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 -CONFIG_ETH_USE_SPI_ETHERNET=y -CONFIG_ETH_SPI_ETHERNET_DM9051=y +# CONFIG_ETH_USE_SPI_ETHERNET is not set # CONFIG_ETH_USE_OPENETH is not set +# CONFIG_ETH_TRANSMIT_MUTEX is not set # end of Ethernet # @@ -400,8 +611,9 @@ # # ESP HTTP client # -# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set # end of ESP HTTP client # @@ -413,12 +625,14 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set # CONFIG_HTTPD_WS_SUPPORT is not set +# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set # end of HTTP Server # # ESP HTTPS OTA # -# CONFIG_OTA_ALLOW_HTTP is not set +# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set +# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set # end of ESP HTTPS OTA # @@ -428,77 +642,321 @@ # end of ESP HTTPS server # +# Hardware Settings +# + +# +# Chip revision +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_1_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +# CONFIG_ESP32_REV_MIN_3_1 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP_REV_MIN_FULL=0 + +# +# Maximum Supported ESP32 Revision (Rev v3.99) +# +CONFIG_ESP32_REV_MAX_FULL=399 +CONFIG_ESP_REV_MAX_FULL=399 +# end of Chip revision + +# +# MAC Config +# +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# end of MAC Config + +# +# Sleep Config +# +# CONFIG_ESP_SLEEP_POWER_DOWN_FLASH is not set +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y +# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set +CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +# end of Sleep Config + +# +# RTC Clock Config +# +CONFIG_RTC_CLK_SRC_INT_RC=y +# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_RTC_CLK_CAL_CYCLES=1024 +# end of RTC Clock Config + +# +# Peripheral Control +# +CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y +# end of Peripheral Control + +# +# Main XTAL Config +# +# CONFIG_XTAL_FREQ_26 is not set +CONFIG_XTAL_FREQ_40=y +# CONFIG_XTAL_FREQ_AUTO is not set +CONFIG_XTAL_FREQ=40 +# end of Main XTAL Config +# end of Hardware Settings + +# +# LCD and Touch Panel +# + +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + +# +# LCD Peripheral Configuration +# +CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_ENABLE_DEBUG_LOG is not set +# end of LCD Peripheral Configuration +# end of LCD and Touch Panel + +# +# ESP Memory Management +# + +# +# MMAP Configuration +# +# end of ESP Memory Management + +# # ESP NETIF Adapter # CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 CONFIG_ESP_NETIF_TCPIP_LWIP=y # CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y +CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y +# CONFIG_ESP_NETIF_L2_TAP is not set +# CONFIG_ESP_NETIF_BRIDGE_EN is not set # end of ESP NETIF Adapter # +# Partition API Configuration +# +# end of Partition API Configuration + +# +# PHY +# +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP_PHY_MAX_TX_POWER=20 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +# end of PHY + +# +# Power Management +# +# CONFIG_PM_ENABLE is not set +# end of Power Management + +# +# ESP PSRAM +# +# CONFIG_SPIRAM is not set +# end of ESP PSRAM + +# +# ESP Ringbuf +# +# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set +# CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH is not set +# end of ESP Ringbuf + +# # ESP System Settings # +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=y +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240 is not set +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=160 + +# +# Memory +# +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set +# end of Memory + +# +# Trace memory +# +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# end of Trace memory + # CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 + +# +# Memory protection +# +# end of Memory protection + +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 +CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set +# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +CONFIG_ESP_TASK_WDT_EN=y +CONFIG_ESP_TASK_WDT_INIT=y +# CONFIG_ESP_TASK_WDT_PANIC is not set +CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP_DEBUG_OCDAWARE=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y + +# +# Brownout Detector +# +CONFIG_ESP_BROWNOUT_DET=y +CONFIG_ESP_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP_BROWNOUT_DET_LVL=0 +# end of Brownout Detector + +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y # end of ESP System Settings # +# IPC (Inter-Processor Call) +# +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_IPC_ISR_ENABLE=y +# end of IPC (Inter-Processor Call) + +# # High resolution timer (esp_timer) # # CONFIG_ESP_TIMER_PROFILING is not set +CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y +CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set +CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 +# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set +CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 +CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y +CONFIG_ESP_TIMER_ISR_AFFINITY=0x1 +CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y +# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # end of High resolution timer (esp_timer) # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 -# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=6 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=6 -CONFIG_ESP32_WIFI_NVS_ENABLED=y -CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -# CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE is not set -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLED=y +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +# CONFIG_ESP_WIFI_STATIC_TX_BUFFER is not set +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1 +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +# CONFIG_ESP_WIFI_CSI_ENABLED is not set +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=6 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=6 +CONFIG_ESP_WIFI_NVS_ENABLED=y +CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 +CONFIG_ESP_WIFI_IRAM_OPT=y +CONFIG_ESP_WIFI_RX_IRAM_OPT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y +# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y +# CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +# CONFIG_ESP_WIFI_NAN_ENABLE is not set +CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y +CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_WAPI_PSK is not set +# CONFIG_ESP_WIFI_SUITE_B_192 is not set +# CONFIG_ESP_WIFI_WPS_STRICT is not set +# CONFIG_ESP_WIFI_11KV_SUPPORT is not set +# CONFIG_ESP_WIFI_MBO_SUPPORT is not set +# CONFIG_ESP_WIFI_DPP_SUPPORT is not set +# CONFIG_ESP_WIFI_11R_SUPPORT is not set +# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set +# CONFIG_ESP_WIFI_DEBUG_PRINT is not set +# CONFIG_ESP_WIFI_TESTING_OPTIONS is not set # end of Wi-Fi # -# PHY -# -# CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE is not set -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# end of PHY - -# # Core dump # -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y # end of Core dump # # FAT Filesystem support # +CONFIG_FATFS_VOLUME_COUNT=2 +CONFIG_FATFS_LFN_NONE=y +# CONFIG_FATFS_LFN_HEAP is not set +# CONFIG_FATFS_LFN_STACK is not set +# CONFIG_FATFS_SECTOR_512 is not set +CONFIG_FATFS_SECTOR_4096=y # CONFIG_FATFS_CODEPAGE_DYNAMIC is not set CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_720 is not set @@ -522,100 +980,90 @@ # CONFIG_FATFS_CODEPAGE_949 is not set # CONFIG_FATFS_CODEPAGE_950 is not set CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_TIMEOUT_MS=10000 CONFIG_FATFS_PER_FILE_CACHE=y +# CONFIG_FATFS_USE_FASTSEEK is not set +CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 # end of FAT Filesystem support # -# Modbus configuration -# -CONFIG_FMB_COMM_MODE_RTU_EN=y -CONFIG_FMB_COMM_MODE_ASCII_EN=y -CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_FMB_QUEUE_LENGTH=20 -CONFIG_FMB_SERIAL_TASK_STACK_SIZE=2048 -CONFIG_FMB_SERIAL_BUF_SIZE=256 -CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8 -CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000 -CONFIG_FMB_SERIAL_TASK_PRIO=10 -# CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set -CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_FMB_CONTROLLER_STACK_SIZE=4096 -CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_FMB_TIMER_PORT_ENABLED=y -CONFIG_FMB_TIMER_GROUP=0 -CONFIG_FMB_TIMER_INDEX=0 -# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set -# end of Modbus configuration - -# # FreeRTOS # + +# +# Kernel +# +# CONFIG_FREERTOS_SMP is not set # CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set -CONFIG_FREERTOS_HZ=500 -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y +CONFIG_FREERTOS_HZ=100 # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -# CONFIG_FREERTOS_ASSERT_DISABLE is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -# CONFIG_FREERTOS_LEGACY_HOOKS is not set +# CONFIG_FREERTOS_USE_IDLE_HOOK is not set +# CONFIG_FREERTOS_USE_TICK_HOOK is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -# CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION is not set +# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 # CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +# end of Kernel + +# +# Port +# CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set +# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set # CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y +# end of Port + +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y +CONFIG_FREERTOS_DEBUG_OCDAWARE=y # end of FreeRTOS # +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y +# CONFIG_HAL_ASSERTION_DISABLE is not set +# CONFIG_HAL_ASSERTION_SILENT is not set +# CONFIG_HAL_ASSERTION_ENABLE is not set +CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + +# # Heap memory debugging # -# CONFIG_HEAP_POISONING_DISABLED is not set -CONFIG_HEAP_POISONING_LIGHT=y +CONFIG_HEAP_POISONING_DISABLED=y +# CONFIG_HEAP_POISONING_LIGHT is not set # CONFIG_HEAP_POISONING_COMPREHENSIVE is not set CONFIG_HEAP_TRACING_OFF=y # CONFIG_HEAP_TRACING_STANDALONE is not set # CONFIG_HEAP_TRACING_TOHOST is not set -CONFIG_HEAP_TASK_TRACKING=y # CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set # end of Heap memory debugging # -# jsmn -# -# CONFIG_JSMN_PARENT_LINKS is not set -# CONFIG_JSMN_STRICT is not set -# end of jsmn - -# -# libsodium -# -CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y -# end of libsodium - -# # Log output # # CONFIG_LOG_DEFAULT_LEVEL_NONE is not set @@ -625,6 +1073,10 @@ # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=3 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -634,6 +1086,9 @@ # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# CONFIG_LWIP_NETIF_API is not set +# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set +# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set @@ -649,45 +1104,57 @@ CONFIG_LWIP_IP6_FRAG=y # CONFIG_LWIP_IP4_REASSEMBLY is not set # CONFIG_LWIP_IP6_REASSEMBLY is not set +CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 # CONFIG_LWIP_IP_FORWARD is not set # CONFIG_LWIP_STATS is not set -# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_ESP_MLDV6_REPORT=y +CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y +# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 +CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 +CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 # # DHCP server # +CONFIG_LWIP_DHCPS=y CONFIG_LWIP_DHCPS_LEASE_UNIT=60 CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 # end of DHCP server # CONFIG_LWIP_AUTOIP is not set +CONFIG_LWIP_IPV4=y +CONFIG_LWIP_IPV6=y # CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 +# CONFIG_LWIP_IPV6_FORWARD is not set +# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set CONFIG_LWIP_NETIF_LOOPBACK=y CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_TCP_ISN_HOOK=y CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=16 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=6 +CONFIG_LWIP_TCP_SYNMAXRTX=12 CONFIG_LWIP_TCP_MSS=1440 CONFIG_LWIP_TCP_TMR_INTERVAL=250 CONFIG_LWIP_TCP_MSL=60000 +CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 CONFIG_LWIP_TCP_WND_DEFAULT=5744 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y # CONFIG_LWIP_TCP_SACK_OUT is not set -# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_LWIP_TCP_OVERSIZE_MSS=y # CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set @@ -701,6 +1168,14 @@ CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP +# +# Checksums +# +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set +# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set +CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y +# end of Checksums + CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y # CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set @@ -709,10 +1184,12 @@ # CONFIG_LWIP_PPP_SUPPORT is not set CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 +# CONFIG_LWIP_SLIP_SUPPORT is not set # # ICMP # +CONFIG_LWIP_ICMP=y # CONFIG_LWIP_MULTICAST_PING is not set # CONFIG_LWIP_BROADCAST_PING is not set # end of ICMP @@ -726,11 +1203,35 @@ # # SNTP # -CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=3 +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP +CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 CONFIG_LWIP_ESP_LWIP_ASSERT=y + +# +# Hooks +# +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set +CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y +# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y +# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y +# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set +# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set +CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y +# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set +# end of Hooks + +# CONFIG_LWIP_DEBUG is not set # end of LWIP # @@ -746,6 +1247,16 @@ # CONFIG_MBEDTLS_DEBUG is not set # +# mbedTLS v3.x related +# +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set +# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set +# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set +CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y +# end of mbedTLS v3.x related + +# # Certificate Bundle # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y @@ -753,16 +1264,19 @@ # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set # CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set # CONFIG_MBEDTLS_CMAC_C is not set CONFIG_MBEDTLS_HARDWARE_AES=y -# CONFIG_MBEDTLS_HARDWARE_MPI is not set -# CONFIG_MBEDTLS_HARDWARE_SHA is not set +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +CONFIG_MBEDTLS_ROM_MD5=y # CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set # CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y CONFIG_MBEDTLS_SHA512_C=y @@ -777,13 +1291,8 @@ # # TLS Key Exchange Methods # -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y +# CONFIG_MBEDTLS_PSK_MODES is not set CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y @@ -792,11 +1301,9 @@ # end of TLS Key Exchange Methods CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set -CONFIG_MBEDTLS_SSL_PROTO_TLS1=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -CONFIG_MBEDTLS_SSL_PROTO_DTLS=y +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set CONFIG_MBEDTLS_SSL_ALPN=y CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y @@ -807,13 +1314,11 @@ CONFIG_MBEDTLS_AES_C=y # CONFIG_MBEDTLS_CAMELLIA_C is not set # CONFIG_MBEDTLS_DES_C is not set -CONFIG_MBEDTLS_RC4_DISABLED=y -# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set -# CONFIG_MBEDTLS_RC4_ENABLED is not set # CONFIG_MBEDTLS_BLOWFISH_C is not set # CONFIG_MBEDTLS_XTEA_C is not set CONFIG_MBEDTLS_CCM_C=y CONFIG_MBEDTLS_GCM_C=y +# CONFIG_MBEDTLS_NIST_KW_C is not set # end of Symmetric Ciphers # CONFIG_MBEDTLS_RIPEMD160_C is not set @@ -821,13 +1326,14 @@ # # Certificates # -# CONFIG_MBEDTLS_PEM_PARSE_C is not set -# CONFIG_MBEDTLS_PEM_WRITE_C is not set -# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set -# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set +CONFIG_MBEDTLS_PEM_PARSE_C=y +CONFIG_MBEDTLS_PEM_WRITE_C=y +CONFIG_MBEDTLS_X509_CRL_PARSE_C=y +CONFIG_MBEDTLS_X509_CSR_PARSE_C=y # end of Certificates CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_DHM_C is not set CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y # CONFIG_MBEDTLS_ECJPAKE_C is not set @@ -848,30 +1354,19 @@ # CONFIG_MBEDTLS_CHACHA20_C is not set # CONFIG_MBEDTLS_HKDF_C is not set # CONFIG_MBEDTLS_THREADING_C is not set +# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set # CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS # -# mDNS -# -CONFIG_MDNS_MAX_SERVICES=10 -CONFIG_MDNS_TASK_PRIORITY=1 -CONFIG_MDNS_TASK_STACK_SIZE=4096 -# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_MDNS_TASK_AFFINITY_CPU0=y -# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set -CONFIG_MDNS_TASK_AFFINITY=0x0 -CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 -# CONFIG_MDNS_STRICT_MODE is not set -CONFIG_MDNS_TIMER_PERIOD_MS=100 -# end of mDNS - -# # ESP-MQTT Configurations # CONFIG_MQTT_PROTOCOL_311=y -# CONFIG_MQTT_TRANSPORT_SSL is not set -# CONFIG_MQTT_TRANSPORT_WEBSOCKET is not set +# CONFIG_MQTT_PROTOCOL_5 is not set +CONFIG_MQTT_TRANSPORT_SSL=y +# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set +# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set +# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set # CONFIG_MQTT_USE_CUSTOM_CONFIG is not set # CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set # CONFIG_MQTT_CUSTOM_OUTBOX is not set @@ -887,20 +1382,31 @@ # CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y # CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y +# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set # end of Newlib # # NVS # +# CONFIG_NVS_ASSERT_ERROR_CHECK is not set # end of NVS # -# OpenSSL +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set +# end of OpenThread + # -# CONFIG_OPENSSL_DEBUG is not set -CONFIG_OPENSSL_ASSERT_DO_NOTHING=y -# CONFIG_OPENSSL_ASSERT_EXIT is not set -# end of OpenSSL +# Protocomm +# +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y +# end of Protocomm # # PThreads @@ -916,6 +1422,14 @@ # end of PThreads # +# MMU Config +# +CONFIG_MMU_PAGE_SIZE_64KB=y +CONFIG_MMU_PAGE_MODE="64KB" +CONFIG_MMU_PAGE_SIZE=0x10000 +# end of MMU Config + +# # SPI Flash driver # # CONFIG_SPI_FLASH_VERIFY_WRITE is not set @@ -924,20 +1438,37 @@ CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set # CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set # CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set +# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set +# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set + +# +# SPI Flash behavior when brownout +# +CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y +CONFIG_SPI_FLASH_BROWNOUT_RESET=y +# end of SPI Flash behavior when brownout # # Auto-detect flash chips # +CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_GD_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_ISSI_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_MXIC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_WINBOND_SUPPORTED=y CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y +# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set +# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -980,22 +1511,28 @@ # end of SPIFFS Configuration # -# TinyUSB +# TCP Transport # # -# Descriptor configuration +# Websocket # -CONFIG_USB_DESC_CUSTOM_VID=0x1234 -CONFIG_USB_DESC_CUSTOM_PID=0x5678 -# end of Descriptor configuration -# end of TinyUSB +# CONFIG_WS_TRANSPORT is not set +# end of Websocket +# end of TCP Transport + +# +# Ultra Low Power (ULP) Co-processor +# +# CONFIG_ULP_COPROC_ENABLED is not set +# end of Ultra Low Power (ULP) Co-processor # # Unity unit testing library # CONFIG_UNITY_ENABLE_FLOAT=y CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_64BIT is not set # CONFIG_UNITY_ENABLE_COLOR is not set CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_UNITY_ENABLE_FIXTURE is not set @@ -1003,19 +1540,23 @@ # end of Unity unit testing library # +# Root Hub configuration +# +# end of Root Hub configuration + +# # Virtual file system # CONFIG_VFS_SUPPORT_IO=y CONFIG_VFS_SUPPORT_DIR=y CONFIG_VFS_SUPPORT_SELECT=y CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -# CONFIG_VFS_SUPPORT_TERMIOS is not set +CONFIG_VFS_SUPPORT_TERMIOS=y # # Host File System I/O (Semihosting) # CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # end of Host File System I/O (Semihosting) # end of Virtual file system @@ -1032,26 +1573,18 @@ # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y +# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set # end of Wi-Fi Provisioning Manager - -# -# Supplicant -# -CONFIG_WPA_MBEDTLS_CRYPTO=y -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_WPA_TESTING_OPTIONS is not set -# CONFIG_WPA_WPS_WARS is not set -# end of Supplicant # end of Component config -# -# Compatibility options -# -# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set -# end of Compatibility options - # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set @@ -1065,119 +1598,164 @@ # CONFIG_FLASHMODE_QOUT is not set CONFIG_FLASHMODE_DIO=y # CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_MONITOR_BAUD=115200 +CONFIG_OPTIMIZATION_LEVEL_DEBUG=y CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y +# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y # CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 # CONFIG_CXX_EXCEPTIONS is not set CONFIG_STACK_CHECK_NONE=y # CONFIG_STACK_CHECK_NORM is not set # CONFIG_STACK_CHECK_STRONG is not set # CONFIG_STACK_CHECK_ALL is not set # CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 CONFIG_ADC2_DISABLE_DAC=y -# CONFIG_SPIRAM_SUPPORT is not set -CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_MCPWM_ISR_IN_IRAM is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +# CONFIG_OTA_ALLOW_HTTP is not set # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ULP_COPROC_ENABLED is not set -CONFIG_ULP_COPROC_RESERVE_MEM=0 -CONFIG_BROWNOUT_DET=y -CONFIG_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_BROWNOUT_DET_LVL=0 +# CONFIG_ESP_SYSTEM_PD_FLASH is not set +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y +CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +# CONFIG_ESP32_XTAL_FREQ_26 is not set +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 CONFIG_REDUCE_PHY_TX_POWER=y -CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y -# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set -# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set -# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set -# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +# CONFIG_SPIRAM_SUPPORT is not set +# CONFIG_ESP32_SPIRAM_SUPPORT is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y +# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160 +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_PANIC_PRINT_HALT is not set +CONFIG_ESP32_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_MAIN_TASK_STACK_SIZE=3584 -CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set # CONFIG_CONSOLE_UART_NONE is not set +# CONFIG_ESP_CONSOLE_UART_NONE is not set +CONFIG_CONSOLE_UART=y CONFIG_CONSOLE_UART_NUM=0 -CONFIG_CONSOLE_UART_TX_GPIO=1 -CONFIG_CONSOLE_UART_RX_GPIO=3 CONFIG_CONSOLE_UART_BAUDRATE=115200 CONFIG_INT_WDT=y CONFIG_INT_WDT_TIMEOUT_MS=300 CONFIG_INT_WDT_CHECK_CPU1=y CONFIG_TASK_WDT=y +CONFIG_ESP_TASK_WDT=y # CONFIG_TASK_WDT_PANIC is not set CONFIG_TASK_WDT_TIMEOUT_S=5 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET=y +CONFIG_BROWNOUT_DET_LVL_SEL_0=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=0 +CONFIG_ESP32_BROWNOUT_DET_LVL=0 +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_TIMER_TASK_STACK_SIZE=3584 -CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_MB_QUEUE_LENGTH=20 -CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048 -CONFIG_MB_SERIAL_BUF_SIZE=256 -CONFIG_MB_SERIAL_TASK_PRIO=10 -# CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT is not set -CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_MB_CONTROLLER_STACK_SIZE=4096 -CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_MB_TIMER_PORT_ENABLED=y -CONFIG_MB_TIMER_GROUP=0 -CONFIG_MB_TIMER_INDEX=0 -# CONFIG_SUPPORT_STATIC_ALLOCATION is not set +CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=6 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=6 +CONFIG_ESP32_WIFI_RX_BA_WIN=6 +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +CONFIG_ESP32_WIFI_IRAM_OPT=y +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y +CONFIG_WPA_MBEDTLS_CRYPTO=y +CONFIG_WPA_MBEDTLS_TLS_CLIENT=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_SUITE_B_192 is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# CONFIG_WPA_MBO_SUPPORT is not set +# CONFIG_WPA_DPP_SUPPORT is not set +# CONFIG_WPA_11R_SUPPORT is not set +# CONFIG_WPA_WPS_SOFTAP_REGISTRAR is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=2048 CONFIG_TIMER_QUEUE_LENGTH=10 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +# CONFIG_HAL_ASSERTION_SILIENT is not set # CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 CONFIG_TCPIP_RECVMBOX_SIZE=32 CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=6 +CONFIG_TCP_SYNMAXRTX=12 CONFIG_TCP_MSS=1440 CONFIG_TCP_MSL=60000 CONFIG_TCP_SND_BUF_DEFAULT=5744 CONFIG_TCP_WND_DEFAULT=5744 CONFIG_TCP_RECVMBOX_SIZE=6 CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_TCP_OVERSIZE_MSS=y # CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_TCP_OVERSIZE_DISABLE is not set @@ -1188,6 +1766,12 @@ # CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF # CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_HRT is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 CONFIG_ESP32_PTHREAD_STACK_MIN=768 @@ -1199,8 +1783,8 @@ CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -# CONFIG_SUPPORT_TERMIOS is not set +CONFIG_SUPPORT_TERMIOS=y CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # End of deprecated options