GithubHelp home page GithubHelp logo

smartthingscommunity / st-device-sdk-c-ref Goto Github PK

View Code? Open in Web Editor NEW
115.0 35.0 175.0 26.85 MB

SmartThings SDK Reference for Direct Connected Devices for C

License: Apache License 2.0

Shell 2.20% Makefile 0.58% C 94.58% Python 2.18% CMake 0.46%
smartthings-sdk opensource iot-device wifi mqtt

st-device-sdk-c-ref's Introduction

SmartThings SDK Reference for Direct Connected Devices for C

License

Easily integrate your Direct Connected Device using the Direct Connected Devices SDK. The SDK manages all MQTT topics and onboarding requirements, freeing you to focus on the Capabilities of your device.

To facilitate development of device applications in an original chipset SDK, the IoT core device library and supporting examples are separated into two git repositories: the IoT core device library and the Direct Connected Devices SDK repository. If you want to use the IoT core device library in your original chipset SDK that you previously installed, link the core device library to develop a device application in your existing development environment.

The Direct Connected Devices SDK is distributed in source form and written in C99 for the purpose of portability to most platforms. For a complete overview of the development process and workflow, please refer to the Direct Connected Devices documentation.

Directory Structure and Overview

  • apps: Contains sample device applications for various chipsets.
  • bsp: Contains the original chipset vendors' SDKs. If you use a chipset that has already been ported, this vendor's SDK can easily be downloaded as a submodule in this directory through the predefined script setup.py.
  • doc: Documentation.
  • iot-core: Contains the IoT core device library. It can also be downloaded as a submodule in this directory through the predefined script setup.py.
  • output: Where build outputs will be placed.
  • patches : Patches to be applied to the original chipset vendors' SDKs for resolving various problems.
  • tools: Various scripts to be applied for each chipset.

Build a Sample Device Application

The Direct Connected Devices SDK builds on the environments of each chipset vendor's SDK, providing an all-in-one development package.

Prerequisites

Install the toolchain defined in the chipset SDK you use according to the directions below. If no development environment is described for your chipset, it is assumed to only be applicable for 64-bit Ubuntu-based environments.

For ESP8266 (Ubuntu/Debian Quickstart):

  1. Set up the ESP8266 Toolchain for Linux according to the Espressif documentation.
  2. In order to use the pre-supplied SDK build script build.py, extract the toolchain into the ~/esp/xtensa-lx106-elf/ directory as directed in the Expressif documentation linked above.

The Espressif documentation linked above directs you to add the toochain path to your PATH environment variable in your ~/.profile. This step not necessary if you use the pre-supplied build script build.py - the path is automatically exported when using the build script.

For ESP32:

  1. Install Prerequisites for your build system OS.
  2. Set up the ESP32 toolchain with setup.py

For ESP32_v3.3 (Legacy - Ubuntu/Debian Quickstart):

  1. Set up the ESP32 Toolchain for Linux according to the Espressif documentation.
  2. In order to use the pre-supplied build script build.py, extract the toolchain to ~/esp/xtensa-esp32-elf/ as directed in the original Expressif documentation.

The Espressif documentation linked above directs you to add the toochain path to your PATH environment variable in your ~/.profile. This step not necessary if you use the pre-supplied build script build.py - the path is automatically exported when using the build script.

For RTL8195:

For Windows systems:

  1. Install the mbed Microcontroller to use the USB serial port on Windows.
  2. Upgrade DAP firmware. The recommended DAP firmware is DAP_FW_Ameba_V12_1_3-2M.bin.

The above steps are applicable for a Windows PC for downloading a binary. You must build the source code on Cygwin or linux for this chipset.

For EMW3166:

  1. Set up the MiCoder Toolchain for Linux according to the MXCHIP documentation.
  2. Install MiCO Cube. In order to use the pre-supplied build script build.py, set mico config --global MICODER /path_of_the_toolchain

Build

  1. Download the Direct Connected Device SDK source code as shown in the example below and run setup.py.

setup.py will automatically download the ported original chipset vendor's SDKs as submodules in the bsp directory through the setup.py script. If a chipset vendor's SDK does not exist in git format, you can manually copy it to the bsp directory. At this time, the IoT Core Device Library will also be downloaded to the iot-core directory.

$ cd ~
$ git clone https://github.com/SmartThingsCommunity/st-device-sdk-c-ref.git
$ cd st-device-sdk-c-ref
$ python setup.py
Usage: python setup.py [BSP_NAME]
--------------------------------------------------
ex) python setup.py rtl8721c
ex) python setup.py rtl8720c
ex) python setup.py rtl8195
ex) python setup.py esp32_v3.3
ex) python setup.py emw3080
ex) python setup.py emw3166
ex) python setup.py esp8266
ex) python setup.py esp32
ex) python setup.py esp32s2
ex) python setup.py esp32c3
  1. Check the build configuration of a sample device application (apps folder). If you want to use specific build options, you can directly modify the build configuration file (e.g. sdkconfig, sdkconfig.h) at the root directory of a sample device application. On the Espressif chipset, you can additionally use the menuconfig option for configuration.

If you want to use the default build configuration, you can skip this step.

  • ESP32 Example:

    Note that the menuconfig option is only supported on the Espressif chipset.

    # python build.py {app_path} {option}
    $ cd ~/st-device-sdk-c-ref
    $ python build.py apps/esp32/switch_example menuconfig
  1. Run build.py in the SDK's root directory. This builds the sample executables and places them in output/{chip_name}/.

    $ python build.py apps/esp32/switch_example          # python build.py {app_path}
    

Flash and Monitor

The serial port of your device must to be matched to the computer environment for serial port flashing and monitoring. This data is described in the build configuration file (sdkconfig)

Chipset Buad Rate for Flashing Baud Rate for Monitoring Data Bit Parity Stop Bits
ESP8266/ESP32 115200 74880 8 None 1
RTL8195 115200 115200 8 None 1
EMW3166 9600 (user UART) 115200 (USB UART) 8 None 1

Flashing

Flashing can be done according to the method outlined by the applicable chipset SDK.

ESP8266/ESP32 Example:

You can flash the executables into a target device via build.py with additional options.

You do not need to run python build.py esp32 st_switch before running python build.py esp32 st_switch flash; this will automatically rebuild anything which needs it.

Available Options:

  • clean: clean previous build outputs
    # python build.py {app_path} {options}
    $ python build.py apps/esp32/switch_example clean
  • flash: download executable binaries to the device
  • monitor: monitor the serial output of device. this option can be used with flash option.
    # python build.py {app_path} {options}
    $ python build.py apps/esp32/switch_example flash monitor
RTL8195 Example:

In order to flash the RTL chipset binary, the steps below must be performed on a Windows PC, even if you build the source code on a Linux environment.

  1. Connect Ameba RTL8195 to a Windows PC; a removable disk MBED will appear.
  2. Copy ram_all.bin from output/rtl8195/iotcore_xxx/ram_all.bin to MBED.
  3. After successfully copying, reset Ameba RTL8195 target and monitor.
EMW3166 Example

In order to flash the MXCHIP emw3166 chipset binary, the steps below must be performed on a Windows PC with a terminal that supports Ymodem transmission.

  1. Connect user UART (PB7-tx, PB6-rx) of emw3166 to a Windows PC with a USB-TTL converter. Then connect USB UART power.
  2. Create a serial session with flashing config (Baud rate 9600) to connect the user UART port, then hold 'BOOT' and press 'RESET' to enable flashing.
  3. Transfer the binary file located in output/emw3166/iotcore_xxx/[email protected] using Ymodem on your terminal.
  4. After transfer is successful, press 'RESET' on MiCOKit-3166 target and monitor with USB UART.

License

This library is licensed under the Apache License Ver2.0.

st-device-sdk-c-ref's People

Contributors

baojunluo avatar bbaraban avatar casuist311 avatar doczillar avatar donghoon-ryu avatar grobebar avatar hdlee27 avatar hisongfeng avatar hongye-samsung avatar jaehoon-you avatar jaeyongshin avatar jonggab-park avatar junyoun-kim avatar jy0209-kim avatar kolos avatar kwang-hui avatar sanbeam avatar sangheedotkim avatar seokhee06 avatar srcn-liqin avatar stdk-scm avatar xiarihf avatar xixidodo avatar yongsuloh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

st-device-sdk-c-ref's Issues

esp32 build error (switch example)

hello,
i’m trying to get setup for SDK for esp32 board
After all setting( setup esd-if, etc…)
when i execute build.py (ST SDK),
Toolchain path: /home/yhpark/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-97-gc752ad5 Expected to see version: crosstool-ng-1.22.0-96-g2852398 Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk. Compiler version: 5.2.0 WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-97-gc752ad5 Expected to see version: crosstool-ng-1.22.0-96-g2852398 Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk. Python requirements from /home/yhpark/st-device-sdk-c-ref/bsp/esp32_v3.3/requirements.txt are satisfied.

App "switch_example" version: v1.8.7-2-ga8226c6-dirty CC /home/yhpark/st-device-sdk-c-ref/apps/esp32/switch_example/build/main/device_control.o /home/yhpark/st-device-sdk-c-ref/apps/esp32/switch_example/main/device_control.c: In function 'get_button_event': /home/yhpark/st-device-sdk-c-ref/apps/esp32/switch_example/main/device_control.c:52:20: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'uint32_t {aka unsigned int}' [-Werror=format=] printf("Button event, val: %ld, tick: %lu\n", gpio_level, (uint32_t)xTaskGetTickCount()); ^ /home/yhpark/st-device-sdk-c-ref/apps/esp32/switch_example/main/device_control.c:52:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Werror=format=] /home/yhpark/st-device-sdk-c-ref/apps/esp32/switch_example/main/device_control.c:52:20: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'uint32_t {aka unsigned int}' [-Werror=format=] /home/yhpark/st-device-sdk-c-ref/apps/esp32/switch_example/main/device_control.c:52:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Werror=format=] cc1: some warnings being treated as errors make[1]: *** [/home/yhpark/st-device-sdk-c-ref/bsp/esp32_v3.3/make/component_wrapper.mk:290: device_control.o] Error 1 make: *** [/home/yhpark/st-device-sdk-c-ref/bsp/esp32_v3.3/make/project.mk:552: component-main-build] Error 2

Error that related with data format has occured…
how can i fix it?

Request for source code error correction

CAP_ENUM_MOTIONSENSOR_MOTION_VALUE_MAX

CAP_ENUM_TVOCHEALTHCONCERN_VALUE_MAX

https://github.com/SmartThingsCommunity/st-device-sdk-c-ref/blob/develop/apps/capability_sample/caps_tvocHealthConcern.c

line-30
static int caps_tvocHealthConcern_attr_tvocHealthConcern_str2idx(const char *value)
{
int index;

for (index = 0; index < CAP_ENUM_MOTIONSENSOR_MOTION_VALUE_MAX; index++) {
    if (!strcmp(value, caps_helper_tvocHealthConcern.attr_tvocHealthConcern.values[index])) {
        return index;
    }
}
return -1;

}

C++ Compilation

Hey, how would i go about including a c++ file in one of the /apps/esp8266/ examples? i tried messing with the makefile and the projects.mk file in the bsp folder but im struggling, help please

error: 'x509_crt_verify_strings' defined but not used.

I'm following the getting started guide, when I reach the step for building i get this error,

python build.py apps/esp8266/switch_example    
Python requirements from /home/ant/st-device-sdk-c-ref/bsp/esp8266/requirements.txt are satisfied.
GENCONFIG
WARNING: esp-idf git submodule components/mbedtls/mbedtls may be out of date. Run 'git submodule update' in IDF_PATH dir to update.
WARNING: Toolchain version is not supported: esp-2020r3-49-gd5524c1
Expected to see version: crosstool-ng-1.22.0-100-ge567ec7
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 8.4.0
Expected to see version(s): 5.2.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
CC build/bootloader/main/bootloader_start.o
AR build/bootloader/main/libmain.a
.
.
.
CC build/mbedtls/mbedtls/library/x509_create.o
CC build/mbedtls/mbedtls/library/md2.o
CC build/mbedtls/mbedtls/library/chacha20.o
CC build/mbedtls/mbedtls/library/ssl_srv.o
CC build/mbedtls/mbedtls/library/x509_crt.o
/home/ant/st-device-sdk-c-ref/bsp/esp8266/components/mbedtls/mbedtls/library/x509_crt.c:1676:44: error: 'x509_crt_verify_strings' defined but not used [-Werror=unused-const-variable=]
 static const struct x509_crt_verify_string x509_crt_verify_strings[] = {
                                            ^~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [/home/ant/st-device-sdk-c-ref/bsp/esp8266/make/component_wrapper.mk:292: mbedtls/library/x509_crt.o] Error 1
make: *** [/home/ant/st-device-sdk-c-ref/bsp/esp8266/make/project.mk:571: component-mbedtls-build] Error 2

ESP32 booting issue

Hello,
I have pulled the st-device-sdk-c-ref at master branch and build apps/esp32/code_lab_example , flash it in ESP32-WROOM-32.
However, it fails to boot.
The error message is below.
Can i get some help?

< ESP32-WROOM-32 boot message >

ELF file SHA256: 54f4da97e7e6080f

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6044
ho 0 tail 12 room 4
load:0x40078000,len:14464
load:0x40080400,len:4032
entry 0x40080650
E (31) qio_mode: Failed to set QIE bit, not enabling QIO mode
I (377) cpu_start: Pro cpu up.
I (378) cpu_start: Single core mode
I (386) cpu_start: Pro cpu start user code
I (386) cpu_start: cpu freq: 160000000
I (386) cpu_start: Application information:
I (390) cpu_start: Project name:     switch_example
I (396) cpu_start: App version:      v1.7.0-50-g6ec0fe5-dirty
I (402) cpu_start: Compile time:     Jan  1 2023 20:28:44
I (408) cpu_start: ELF file SHA256:  54f4da97e7e6080f...
I (414) cpu_start: ESP-IDF:          v4.3.1-3-g2c551b44e5
I (421) heap_init: Initializing. RAM available for dynamic allocation:
I (428) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (434) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (440) heap_init: At 3FFB7438 len 00028BC8 (162 KiB): DRAM
I (446) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (453) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (459) heap_init: At 40093F48 len 0000C0B8 (48 KiB): IRAM
I (466) spi_flash: detected chip: gd
I (469) spi_flash: flash io: qio
assertion "flash_ret == ESP_OK" failed: file "/home/myubuntu/st-device-sdk-c-ref/bsp/esp32/components/esp_system/startup.c", line 329, function: do_core_init

abort() was called at PC 0x40158033 on core 0

Backtrace:0x4008788f:0x3ffe3b10 0x40088009:0x3ffe3b30 0x4008e786:0x3ffe3b50 0x40158033:0x3ffe3bc0 0x400d344d:0x3ffe3bf0 0x400d34fe:0x3ffe3c10 0x40081201:0x3ffe3c50 0x4007913a:0x3ffe3c90 0x0


ELF file SHA256: 54f4da97e7e6080f

Rebooting...

ESP8266 device onboarding error

Hello,
I'm trying to build a device with eap8266 using smarttings SDK.
It always fails during onboarding process with error code 07-999.

I got information from st device SDK team that this unknown internal error(07-999) indicates that the WiFi connection between the esp8266 device and mobile phone is forcely closed. (I had sent them the log taken from my phone)

Here I open an issue on their request with the following serial terminal log.
I hope someone help with this.

--------------------- Terminal log -------------------------------------------------------------------------------------
Toolchain path: /home/jspark/esp/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7
Compiler version: 5.2.0
Python requirements from /home/jspark/st-device-sdk-c-ref/bsp/esp8266/requirements.txt are satisfied.
MONITOR

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 6508, room 16
tail 12
chksum 0xe4
ho 0 tail 12 room 4
load 0x3ffe8408, len 24, room 12
tail 12
chksum 0x6d
ho 0 tail 12 room 4
load 0x3ffe8420, len 2832, room 12
tail 4
chksum 0x52
csum 0x52
D (279) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
�[0;32mI (300) system_api: Base MAC address is not set, read default base MAC address from EFUSE�[0m
D (304) nvs: nvs_open_from_partition backup_mac 0
D (306) nvs: nvs_get_str_or_blob backup_mac_data
D (311) nvs: nvs_close 1
�[0;32mI (313) system_api: Base MAC address is not set, read default base MAC address from EFUSE�[0m
D (321) nvs: nvs_open_from_partition backup_mac 0
D (326) nvs: nvs_get_str_or_blob backup_mac_data
D (330) nvs: nvs_close 2
D (332) phy_init: loading PHY init data from application binary
D (338) nvs: nvs_open_from_partition phy 0
D (342) nvs: nvs_get_str_or_blob cal_data
D (346) nvs: nvs_get_str_or_blob dc_table
D (351) nvs: nvs_close 3
phy_version: 1163.0, 665d56c, Jun 24 2020, 10:00:08, RTOS new
�[0;32mI (413) phy_init: phy ver: 1163_0�[0m
�[0;32mI (416) reset_reason: RTC reset 2 wakeup 0 store 0, reason is 2�[0m
D (420) wdt: Enable task watch dog panic, panic time parameter is 11
D (430) wdt: task watch dog trigger time parameter is 15
D (438) [IoT]: iot_nv_init(197) > �[0;36m>>>HIT<<<�[0;m
D (445) nvs: nvs_open_from_partition stdk 1
D (451) nvs: nvs_get_str_or_blob stnv
�[0;32mI (457) [IoT]: _iot_bsp_fs_encryption(98) > 'nvs' is encrypted�[0m
D (466) nvs: nvs_close 4
�[0;32mI (479) [IoT]: _dump_device_info(706) > firmware_version: firmwareVersion_here�[0m
�[0;32mI (483) [IoT]: iot_bsp_wifi_init(170) > [esp8266] iot_bsp_wifi_init�[0m
D (497) nvs: nvs_open_from_partition misc 1
D (499) nvs: nvs_open_from_partition nvs.net80211 1
D (506) nvs: nvs_get opmode 1
D (510) nvs: nvs_get_str_or_blob sta.ssid
D (516) nvs: nvs_get_str_or_blob sta.mac
D (521) nvs: nvs_get sta.authmode 1
D (526) nvs: nvs_get_str_or_blob sta.pswd
D (532) nvs: nvs_get_str_or_blob sta.pmk
D (538) nvs: nvs_get sta.chan 1
D (542) nvs: nvs_get auto.conn 1
D (547) nvs: nvs_get bssid.set 1
D (551) nvs: nvs_get_str_or_blob sta.bssid
D (557) nvs: nvs_get sta.lis_intval 2
D (562) nvs: nvs_get sta.phym 1
D (567) nvs: nvs_get sta.phybw 1
D (571) nvs: nvs_get_str_or_blob sta.apsw
D (577) nvs: nvs_get_str_or_blob sta.apinfo
D (584) nvs: nvs_get sta.scan_method 1
D (588) nvs: nvs_get sta.sort_method 1
D (594) nvs: nvs_get sta.minrssi 1
D (598) nvs: nvs_get sta.minauth 1
D (603) nvs: nvs_get_str_or_blob ap.ssid
D (609) nvs: nvs_get_str_or_blob ap.mac
D (614) nvs: nvs_get_str_or_blob ap.passwd
D (620) nvs: nvs_get_str_or_blob ap.pmk
D (626) nvs: nvs_get ap.chan 1
D (630) nvs: nvs_get ap.authmode 1
D (635) nvs: nvs_get ap.hidden 1
D (639) nvs: nvs_get ap.max.conn 1
D (644) nvs: nvs_get bcn.interval 2
D (649) nvs: nvs_get ap.phym 1
D (653) nvs: nvs_get ap.phybw 1
D (658) nvs: nvs_get ap.sndchan 1
D (662) nvs: nvs_get lorate 1
�[0;32mI (668) [IoT]: iot_bsp_wifi_init(208) > [esp8266] iot_bsp_wifi_init done�[0m
D (678) [IoT]: iot_dump_log(346) > LOG : 40000701 00000000 00000000 00000000
�[0;32mI (689) [IoT]: st_conn_init(1369) > stdk_version : 1.6.2�[0m
D (698) [IoT]: iot_dump_log(346) > LOG : 30000000 00000000 0000055c 00010602
�[0;32mI (708) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (722) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0 �[0m
�[0;32mI (736) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (751) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (765) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (779) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3 �[0m
�[0;32mI (794) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (808) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (822) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (836) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 �[0m
�[0;32mI (850) pwm: --- PWM v3.2
�[0m
�[0;32mI (857) [IoT]: st_conn_start(1839) > st_conn_start start (no-pin)�[0m
D (867) [IoT]: iot_dump_log(346) > LOG : 30000000 00000000 00000730 00000000
D (877) [IoT]: iot_security_be_init(1904) > security backend is 'software'
D (888) [IoT]: _iot_main_task(1118) > cmd: 10

�[0;32mI (894) [IoT]: _do_iot_main_command(499) > curr_main_cmd:10, curr_main_state:-1/-1�[0m
D (906) [IoT]: iot_dump_log(346) > LOG : 30000002 00000000 00000000 00000000
�[0;32mI (917) [IoT]: _do_update_timeout(200) > Current timeout : 100000 for -1/0�[0m
�[0;32mI (928) [IoT]: _do_status_report(304) > Call usr status_cb with 1/0�[0m
status: 1, stat: 0
D (942) [IoT]: _iot_main_task(1118) > cmd: 2

�[0;32mI (948) [IoT]: _do_iot_main_command(499) > curr_main_cmd:2, curr_main_state:-1/0�[0m
D (960) [IoT]: iot_nv_get_prov_data(261) > �[0;36m>>>HIT<<<�[0;m
D (969) [IoT]: iot_nv_get_wifi_prov_data(322) > �[0;36m>>>HIT<<<�[0;m
D (979) [IoT]: _iot_nv_io_storage(103) > id = 1, mode = 1
D (986) [IoT]: iot_security_be_init(1904) > security backend is 'software'
D (996) [IoT]: iot_security_storage_read(114) > id:1
D (1004) [IoT]: _iot_security_be_bsp_fs_load(187) > id = 1
D (1012) [IoT]: _iot_security_be_bsp_fs_load_from_nv(100) > id = 1
D (1021) [IoT]: iot_bsp_nv_get_data_path(25) > �[0;36m>>>HIT<<<�[0;m
D (1030) [IoT]: _iot_security_be_bsp_fs_storage_id2filename(85) > storage file = 'WifiProvStatus'
D (1043) nvs: nvs_open_from_partition stdk 0
D (1049) nvs: nvs_get_str_or_blob WifiProvStatus
D (1056) [IoT]: iot_bsp_fs_read(297) > not found 'WifiProvStatus'
D (1065) nvs: nvs_close 7
D (1069) [IoT]: iot_security_storage_read(141) > id:1 not found
D (1077) [IoT]: _iot_nv_io_storage(123) > nv '1' does not exist
D (1086) [IoT]: iot_nv_get_wifi_prov_data(343) > Wifi Prov Status : read failed
D (1097) [IoT]: iot_dump_log(346) > LOG : 40000601 00000000 00000001 00000158
D (1107) [IoT]: iot_nv_get_prov_data(267) > get wifi prov fail
D (1116) [IoT]: _do_iot_main_command(626) > There are no prov data in NV

D (1126) [IoT]: iot_nv_erase(1006) > �[0;36m>>>HIT<<<�[0;m
D (1134) [IoT]: _iot_nv_io_storage(103) > id = 10, mode = 3
D (1142) [IoT]: iot_security_be_init(1904) > security backend is 'software'
D (1152) [IoT]: iot_security_storage_remove(191) > id:10
D (1160) [IoT]: _iot_security_be_bsp_fs_remove(309) > id = 10
D (1169) [IoT]: iot_bsp_nv_get_data_path(25) > �[0;36m>>>HIT<<<�[0;m
D (1178) [IoT]: _iot_security_be_bsp_fs_storage_id2filename(85) > storage file = 'DeviceID'
D (1190) nvs: nvs_open_from_partition stdk 1
D (1196) nvs: nvs_erase_key DeviceID

D (1203) [IoT]: iot_bsp_fs_remove(417) > nvs erase failed [Namespace/Key Not Found]
D (1213) nvs: nvs_close 8
D (1217) [IoT]: iot_dump_log(346) > LOG : 10000378 00000000 00000126 00000000
D (1227) [IoT]: iot_security_storage_remove(211) > id:10 not found
D (1236) [IoT]: _iot_nv_io_storage(165) > nv '10' does not exist
D (1245) [IoT]: iot_nv_erase(1014) > file does not exist
D (1253) [IoT]: iot_dump_log(346) > LOG : 40000604 00000000 0000000a 000003f7
�[0;32mI (1264) [IoT]: _do_cmd_tout_check(1041) > New state updated for 0�[0m
D (1274) [IoT]: _iot_main_task(1118) > cmd: 10

�[0;32mI (1281) [IoT]: _do_iot_main_command(499) > curr_main_cmd:10, curr_main_state:0/0�[0m
�[0;32mI (1294) [IoT]: iot_bsp_wifi_set_mode(226) > iot_bsp_wifi_set_mode = 1�[0m
D (1305) [IoT]: iot_dump_log(346) > LOG : 40000703 00000001 00000001 00000000
D (1316) event: SYSTEM_EVENT_STA_START
�[0;32mI (1321) [IoT]: iot_bsp_wifi_set_mode(257) > WiFi Station Started�[0m
D (3754) event: SYSTEM_EVENT_SCAN_DONE, status:0, number:13
�[0;32mI (3757) [IoT]: event_handler(159) > event_handler = 1�[0m
D (3846) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=iptime_jspark, mac=92:9F:33:47:71:F0, rssi=-62, freq=2452, authmode=3 chan=9
D (3854) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=myhome, mac=88:36:6C:4B:EB:3C, rssi=-73, freq=2452, authmode=3 chan=9
D (3872) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=[washer]_E30AJT2103403K, mac=28:6D:97:D4:9F:A4, rssi=-76, freq=2412, authmode=3 chan=1
D (3892) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=SK_WiFiGIGA6458, mac=88:3C:1C:B8:64:5B, rssi=-77, freq=2447, authmode=4 chan=8
D (3912) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=jspark_home, mac=2C:BA:BA:56:09:2A, rssi=-78, freq=2432, authmode=3 chan=5
D (3930) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=ryu_house, mac=70:5D:CC:92:28:CF, rssi=-81, freq=2437, authmode=3 chan=6
D (3949) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=KT_GiGA_2G_Wave2_A2C4, mac=88:3C:1C:D5:A2:C8, rssi=-85, freq=2452, authmode=4 chan=9
D (3969) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=NETGEAR74, mac=9C:C9:EB:0E:7E:3B, rssi=-87, freq=2432, authmode=3 chan=5
D (3988) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=[floor a/c]_E30AJT0003080Z, mac=28:6D:97:98:DB:16, rssi=-88, freq=2412, authmode=3 chan=1
D (4009) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=SK_WiFiGIGA5BC8_2.4G, mac=42:23:AA:E3:5B:CA, rssi=-89, freq=2462, authmode=4 chan=11
D (4029) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=KimFamily, mac=88:36:6C:CF:E4:E4, rssi=-91, freq=2462, authmode=3 chan=11
D (4047) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=SK_WiFiGIGA5BC8, mac=00:23:AA:E3:5B:CA, rssi=-92, freq=2462, authmode=4 chan=11
D (4067) [IoT]: iot_bsp_wifi_get_scan_result(430) > esp8266 ssid=iptime EasyMesh_2G, mac=70:5D:CC:80:1A:64, rssi=-93, freq=2427, authmode=3 chan=4
D (4086) [IoT]: iot_nv_get_serial_number(899) > �[0;36m>>>HIT<<<�[0;m
D (4095) [IoT]: _iot_nv_io_storage(103) > id = 17, mode = 1
D (4103) [IoT]: iot_security_be_init(1904) > security backend is 'software'
D (4113) [IoT]: iot_security_storage_read(114) > id:17
D (4121) [IoT]: _iot_security_be_bsp_fs_load(187) > id = 17
D (4129) [IoT]: iot_nv_get_data_from_device_info(1072) > nv id = 17
D (4141) [IoT]: iot_security_storage_read(146) > id:17 read 16@0x40108a78
D (4149) [IoT]: iot_security_base64_encode_urlsafe(178) > src: 32@0x3fff42b4, dst: 45@0x3fff42d4
D (4162) [IoT]: iot_security_base64_encode_urlsafe(192) > done: 44@0x3fff42d4
�[0;32mI (4172) [IoT]: iot_easysetup_create_ssid(91) > >> LED_Light[LOuQ] <<�[0m
�[0;32mI (4184) [IoT]: _do_update_timeout(200) > Current timeout : 300000 for 0/1�[0m
D (4195) [IoT]: _iot_main_task(1118) > cmd: 1

�[0;32mI (4201) [IoT]: _do_iot_main_command(499) > curr_main_cmd:1, curr_main_state:0/1�[0m
�[0;32mI (4214) [IoT]: iot_bsp_wifi_set_mode(226) > iot_bsp_wifi_set_mode = 3�[0m
D (4225) [IoT]: iot_dump_log(346) > LOG : 40000703 00000003 00000003 00000000
D (4237) event: SYSTEM_EVENT_AP_START
D (4241) tcpip_adapter: dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
�[0;32mI (4254) [IoT]: event_handler(135) > SYSTEM_EVENT_AP_START�[0m
D (6127) event: SYSTEM_EVENT_AP_STOP
D (6129) udp_sync: UDP sync close port 67
�[0;32mI (6132) [IoT]: event_handler(140) > SYSTEM_EVENT_AP_STOP�[0m
D (6134) event: SYSTEM_EVENT_AP_START
D (6138) tcpip_adapter: dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
�[0;32mI (6151) [IoT]: event_handler(135) > SYSTEM_EVENT_AP_START�[0m
D (6161) [IoT]: iot_bsp_wifi_set_mode(368) > wifi_init_softap finished.SSID:LED_Light_E4fPpd00065jNJLOuQ password:1111122222
�[0;32mI (6177) [IoT]: iot_bsp_wifi_set_mode(374) > AP Mode Started�[0m
D (6187) [IoT]: iot_easysetup_init(466) > �[0;36mENTER >>>>�[0;m
�[0;32mI (6196) [IoT]: iot_easysetup_init(467) > IOT_STATE_PROV_ES_START�[0m
D (6207) [IoT]: iot_dump_log(346) > LOG : 3000054a 00000005 000001d4 00000000
�[0;32mI (6218) [IoT]: es_http_init(159) > http tcp init!!�[0m
D (6226) [IoT]: iot_dump_log(346) > LOG : 30000591 00000005 000000a0 00000000
D (6239) [IoT]: iot_dump_log(346) > LOG : 30000591 00000005 000000a2 00000001
�[0;32mI (6248) [IoT]: iot_easysetup_init(497) > IOT_STATE_PROV_ES_INIT_DONE�[0m
D (6259) [IoT]: iot_dump_log(346) > LOG : 3000054a 00000005 000001f2 00000001
�[0;32mI (6269) [IoT]: _do_cmd_tout_check(1041) > New state updated for 1�[0m
�[0;32mI (6280) [IoT]: _do_status_report(304) > Call usr status_cb with 2/1�[0m
status: 2, stat: 1
D (32344) event: SYSTEM_EVENT_AP_STACONNECTED, mac:5e:d0:bc:a7:3d:d4, aid:1
�[0;32mI (32349) [IoT]: event_handler(147) > station:5e:d0:bc:a7:3d:d4 join, AID=1�[0m
D (33040) udp_sync: UDP sync cache udp 0x401083e0
D (33044) udp_sync: UDP sync clear udp 0x401083e0
D (33072) udp_sync: UDP sync cache udp 0x401083e0
D (33075) udp_sync: UDP sync clear udp 0x401083e0
�[0;32mI (33078) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2�[0m
D (33082) event: SYSTEM_EVENT_AP_STAIPASSIGNED
�[0;32mI (33089) [IoT]: event_handler(159) > event_handler = 17�[0m
�[0;32mI (36283) [IoT]: _iot_easysetup_gen_get_payload(151) > waiting.. response for [0]�[0m
D (36287) [IoT]: iot_dump_log(346) > LOG : 30000547 00000024 00000098 00000000
D (36293) [IoT]: _iot_main_task(1118) > cmd: 10

�[0;32mI (36300) [IoT]: _do_iot_main_command(499) > curr_main_cmd:10, curr_main_state:1/1�[0m
�[0;32mI (36313) [IoT]: _do_state_updating(1635) > Notification only with IOT_STATE_PROV_CONN_MOBILE�[0m
�[0;32mI (36329) [IoT]: _do_status_report(304) > Call usr status_cb with 2/4�[0m
status: 2, stat: 4
D (36341) [IoT]: _iot_main_task(1143) > request step: 0

D (36349) [IoT]: iot_security_base64_encode_urlsafe(178) > src: 16@0x40108b98, dst: 25@0x40108bc8
D (36362) [IoT]: iot_security_base64_encode_urlsafe(192) > done: 24@0x40108bc8
D (36374) [IoT]: _iot_easysetup_gen_get_payload(156) > easysetup response for [0]
D (36384) [IoT]: _iot_easysetup_gen_get_payload(170) > payload: {"protocolVersion":"1.2.0","firmwareVersion":"firmwareVersion_here","hashedSn":"5jNJ2RQlX76_1TsNUq36GK_8xPqJTyYWPdOLB4sUJkg=","wifiSupportFrequency":
�[0;32mI (36415) [IoT]: http_msg_handler(394) > get cmd[0] ok�[0m
D (36422) [IoT]: iot_dump_log(346) > LOG : 30000548 00000024 0000018b 00000000
D (36433) [IoT]: http_msg_handler(450) > HTTP/1.1 200 OK

Server: SmartThings SDK Setup

Connection: keep-alive

Content-Type: application/json

Content-Length: 149

{"protocolVersion":"1.2.0","firmwareVersion":"firmwareVersion_here","hashedSn":"5jNJ2RQlX76_1TsNUq36GK_8xPqJTyYWPdOLB4sUJkg=","wifiSupportFrequency":
D (36563) event: SYSTEM_EVENT_AP_STADISCONNECTED, mac:5e:d0:bc:a7:3d:d4, aid:1
�[0;32mI (36568) [IoT]: event_handler(153) > station:5e:d0:bc:a7:3d:d4 leave, AID=1�[0m


I quit the terminal log after onboarding error pops up.

How to enable error logs in esp8266?

I am trying to setup a IOT device using esp8266. I've followed the steps mentioned in repo. I am able to flash but after flashing, the device is not connected to wifi and I can't even see any errors on monitor. Can someone please help me how to enable error logs ?
Thanks

Issues OTA DEMO connecting with local server

I´m usign the example of the SmartThings sdk OTA-DEMO.
The RaspberryPi is being used as an ubuntu machine as a local OTA server.
I have followed all the instructions to generate the necesary certificates and keys accordin to the OTA DEMO server.
At the end i have tested the server access from a computer with the command :
curl --cacert ./root.crt "https://192.168.67.35:4443"
And the result has been 👍

<title>Directory listing for /</title>

Directory listing for /



The i programmed the ESP32 device with de OTA-DEMO program and the device works correctly and i can send ON -OFF commands form the SmarThigns app.
The problem is that de device can´t connect to the server. You can see below the logs register.
i´m stuck and i don´t know where to go next in my produc devolopment:
lusan@DESKTOP-CL4R1HL:~/st-device-sdk-c-ref$ python build.py apps/esp32/ota_demo monitor
/bin/sh: 22: ./export.sh: [[: not found
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.12
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Constraint file: /home/lusan/.espressif/espidf.constraints.v5.0.txt
Requirement files:

  • /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/requirements/requirements.core.txt
    Python being checked: /home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin/python
    /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources
    Python requirements are satisfied.
    Updated PATH variable:
    /home/lusan/st-device-sdk-c-ref/bsp/esp32/components/espcoredump:/home/lusan/st-device-sdk-c-ref/bsp/esp32/components/partition_table:/home/lusan/st-device-sdk-c-ref/bsp/esp32/components/app_update:/home/lusan/.espressif/tools/xtensa-esp-elf-gdb/11.2_20220823/xtensa-esp-elf-gdb/bin:/home/lusan/.espressif/tools/riscv32-esp-elf-gdb/11.2_20220823/riscv32-esp-elf-gdb/bin:/home/lusan/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin:/home/lusan/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin:/home/lusan/.espressif/tools/xtensa-esp32s3-elf/esp-2022r1-11.2.0/xtensa-esp32s3-elf/bin:/home/lusan/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin:/home/lusan/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/home/lusan/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin:/home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin:/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools:/home/lusan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu22.04LTS_2204.3.63.0_x64__79rhkp1fndgsc:/mnt/c/Program Files/Common Files/Oracle/Java/javapath:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/usbipd-win/:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Programs/Python/Python312/Scripts/:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Programs/Python/Python312/:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

Detected installed tools that are not currently used by active ESP-IDF version.
For removing old versions of riscv32-esp-elf, riscv32-esp-elf-gdb, xtensa-esp32-elf, esp32ulp-elf, esp-rom-elfs, xtensa-esp32s2-elf, xtensa-esp32s3-elf, xtensa-esp-elf-gdb, esp32s2ulp-elf, openocd-esp32 use command 'python /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf_tools.py uninstall'
To free up even more space, remove installation packages of those tools. Use option 'python3 /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf_tools.py uninstall --remove-archives'.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

idf.py build

/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Executing action: monitor
Serial port /dev/ttyUSB0
Connecting.........
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting.....
Detecting chip type... ESP32
Running idf_monitor in directory /home/lusan/st-device-sdk-c-ref/apps/esp32/ota_demo
Executing "/home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf_monitor.py -p /dev/ttyUSB0 -b 115200 --toolchain-prefix xtensa-esp32-elf- --target esp32 --revision 0 /home/lusan/st-device-sdk-c-ref/apps/esp32/ota_demo/build/ota_demo.elf -m '/home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin/python' '/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf.py'"...
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6020
load:0x40078000,len:15932
load:0x40080400,len:3624
0x40080400: _init at ??:?

entry 0x400805d4
W (27) boot: Unicore bootloader
I (384) cpu_start: Unicore app
I (384) cpu_start: Pro cpu up.
I (384) cpu_start: Single core mode
I (396) cpu_start: Pro cpu start user code
I (396) cpu_start: cpu freq: 160000000 Hz
I (396) cpu_start: Application information:
I (401) cpu_start: Project name: ota_demo
I (406) cpu_start: App version: v1.8.7-2-ga8226c6-dirty
I (412) cpu_start: Compile time: Feb 20 2024 14:01:26
I (419) cpu_start: ELF file SHA256: 40b9c1caef97de27...
Warning: checksum mismatch between flashed and built applications. Checksum of built application is ed081d4c0160b123720b7111deaa1745971f44018c1e3032f6aac8f953f2affe
I (425) cpu_start: ESP-IDF: v5.0.2-376-g24b9d38a24
I (431) cpu_start: Min chip rev: v0.0
I (435) cpu_start: Max chip rev: v3.99
I (440) cpu_start: Chip rev: v3.0
I (445) heap_init: Initializing. RAM available for dynamic allocation:
I (452) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (458) heap_init: At 3FFB6B00 len 00029500 (165 KiB): DRAM
I (465) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (471) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (477) heap_init: At 40094FE8 len 0000B018 (44 KiB): IRAM
I (483) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (491) spi_flash: detected chip: generic
I (494) spi_flash: flash io: qio
I (499) cpu_start: Starting scheduler on PRO CPU.
I (511) [IoT]: _dump_device_info(746) > firmware_version: switch_example_001
I (511) [IoT]: iot_bsp_wifi_init(251) > [esp32] iot_bsp_wifi_init
I (531) wifi:wifi driver task: 3ffbff64, prio:23, stack:6656, core=0
I (531) system_api: Base MAC address is not set
I (531) system_api: read default base MAC address from EFUSE
I (541) wifi:wifi firmware version: 1cf2806
I (541) wifi:wifi certification version: v7.0
I (551) wifi:config NVS flash: enabled
I (551) wifi:config nano formating: disabled
I (551) wifi:Init data frame dynamic rx buffer num: 32
I (561) wifi:Init management frame dynamic rx buffer num: 32
I (561) wifi:Init management short buffer num: 32
I (571) wifi:Init dynamic tx buffer num: 32
I (571) wifi:Init static rx buffer size: 1600
I (581) wifi:Init static rx buffer num: 10
I (581) wifi:Init dynamic rx buffer num: 32
I (581) wifi_init: rx ba win: 6
I (591) wifi_init: tcpip mbox: 32
I (591) wifi_init: udp mbox: 6
I (591) wifi_init: tcp mbox: 6
I (601) wifi_init: tcp tx win: 2920
I (601) wifi_init: tcp rx win: 5840
I (611) wifi_init: tcp mss: 1436
I (611) wifi_init: WiFi IRAM OP enabled
I (611) wifi_init: WiFi RX IRAM OP enabled
I (621) [IoT]: iot_bsp_wifi_init(292) > [esp32] iot_bsp_wifi_init done
I (631) [IoT]: st_conn_init(1134) > stdk_version : 1.8.14
esta es la version numero 1
I (641) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (641) gpio: GPIO[26]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (651) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (661) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1|I (2681) [IoT]: st_conn_start(1222) > st_conn_start start (no-pin)
I (2681) [IoT]: _check_prov_status(235) > Current deviceID: 6543a7c7-2d1c-4e86-8675-ba35fea2a1e9 (36)

I (2681) [IoT]: st_conn_start(1274) > st_conn_start done (0)
I (2691) [IoT]: _do_iot_main_command(586) > curr_main_cmd:0, curr_main_state:0
I (2701) [IoT]: _do_state_updating(435) > current state 0, new state 5
status: 1, stat: 0
I (2701) [IoT]: _do_state_updating(573) > Call usr status_cb with 0x01
I (2711) [IoT]: _do_iot_main_command(586) > curr_main_cmd:3, curr_main_state:5
I (2721) [IoT]: iot_bsp_wifi_set_mode(310) > iot_bsp_wifi_set_mode = 2
I (2731) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (2821) wifi:mode : sta (40:91:51:fc:f7:a4)
I (2831) wifi:enable tsf
I (2831) [IoT]: esp_wifi_event_post_to_user(106) > Station started
I (2831) [IoT]: iot_bsp_wifi_set_mode(410) > connect to ap SSID:dinfi
I (3681) wifi:new:<8,1>, old:<1,0>, ap:<255,255>, sta:<8,1>, prof:1
I (4251) wifi:state: init -> auth (b0)
I (4261) wifi:state: auth -> init (8a0)
I (4261) wifi:new:<8,0>, old:<8,1>, ap:<255,255>, sta:<8,1>, prof:1
I (4261) [IoT]: esp_wifi_event_post_to_user(119) > Disconnect reason : 202
I (4271) wifi:new:<8,1>, old:<8,0>, ap:<255,255>, sta:<8,1>, prof:1
I (4271) wifi:state: init -> auth (b0)
I (4291) wifi:state: auth -> assoc (0)
I (4291) wifi:state: assoc -> run (10)
I (4331) wifi:connected with dinfi, aid = 2, channel 8, 40U, bssid = d8:0d:17:75:6b:56
I (4331) wifi:security: WPA2-PSK, phy: bgn, rssi: -67
I (4331) wifi:pm start, type: 1

I (4331) [IoT]: esp_wifi_event_post_to_user(141) > Wifi Connected
I (4361) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (5841) [IoT]: esp_ip_event_post_to_user(196) > got ip:192.168.0.122
I (5841) [IoT]: iot_bsp_wifi_set_mode(415) > AP Connected
I (5841) esp_netif_handlers: sta ip: 192.168.0.122, mask: 255.255.255.0, gw: 192.168.0.1
I (5851) [IoT]: iot_bsp_wifi_set_mode(433) > Time is not set yet. Connecting to WiFi and getting time over NTP.
I (5861) [IoT]: _initialize_sntp(58) > Initializing SNTP
I (5861) [IoT]: _obtain_time(87) > Waiting for system time to be set... (1/10)
I (6191) wifi:idx:0 (ifx:0, d8:0d:17:75:6b:56), tid:6, ssn:2, winSize:64
I (6211) wifi:idx:1 (ifx:0, d8:0d:17:75:6b:56), tid:0, ssn:0, winSize:64
I (7871) [IoT]: _obtain_time(97) > [WIFI] system time updated by 1
I (7901) [IoT]: iot_es_connect(1086) > connect_type: log-in
I (7901) [IoT]: _iot_es_mqtt_connect(925) > url: mqtt-regional-euwest1.api.smartthings.com, port: 8883
I (7901) [IoT]: _iot_es_mqtt_connect(931) > mqtt connect,
id : 575b8553-014e-40cf-b24d-d3cf37c7536d
username : 6543a7c7-2d1c-4e86-8675-ba35fea2a1e9
password : eyJhbGciOiJFZERTQSIsImt0eSI6Ik9LUCIsImNydiI6IkVkMjU1MTkiLCJ0eXAiOiJKV1QiLCJ2ZXIiOiIwLjAuMSIsImtpZCI6IlNUREs4Wk5UNHFOcW5Za1oifQ==.eyJpYXQiOiIxNzA4NTM1MDE5IiwianRpIjoiZmQwOGU1NzEtOTU4YS00MmI2LWI0ODQtZjY5MmZlODkzMWY2IiwibW5JZCI6IjBCTEcifQ==.mJLuGEIOB5lebgfO5ipgFbAWGQQJCR3cfdzMME63OMj+uOtTKxF+5LjaMeeSYVZYaioKbd0ItBj+FWkOCOT2CQ==
I (7951) [IoT]: _iot_net_tls_connect(416) > Loading the CA root certificate 1317@0x3ffcd328
I (8681) [IoT]: iot_es_connect(1106) > MQTT connect success sucess/try : 1/1
I (8781) [IoT]: _check_connection_response(79) > Connection response payload {"target":"6543a7c7-2d1c-4e86-8675-ba35fea2a1e9","currentTime":1708535019,"event":"connect.success"}
I (8791) [IoT]: _do_iot_main_command(586) > curr_main_cmd:0, curr_main_state:5
I (8801) [IoT]: _do_state_updating(435) > current state 5, new state 6
I (8801) [IoT]: _get_device_preference(423) > Get device preference
I (8811) [IoT]: iot_cap_call_init_cb(1341) > Call init_cb for switch capability
I (8821) [IoT]: st_cap_send_attr(613) > publish event, topic : /v1/deviceEvents/6543a7c7-2d1c-4e86-8675-ba35fea2a1e9, payload :
{"deviceEvents":[{"component":"main","capability":"switch","attribute":"switch","value":"on","providerData":{"sequenceNumber":1,"timestamp":"1708535020023"}}]}
Sequence number return : 1
I (8851) [IoT]: iot_cap_call_init_cb(1341) > Call init_cb for firmwareUpdate capability
value is NULL
value is NULL
I (8861) [IoT]: st_cap_send_attr(613) > publish event, topic : /v1/deviceEvents/6543a7c7-2d1c-4e86-8675-ba35fea2a1e9, payload :
{"deviceEvents":[{"component":"main","capability":"firmwareUpdate","attribute":"currentVersion","value":"switch_example_001","providerData":{"sequenceNumber":2,"timestamp":"1708535020063"}}]}
Sequence number return : 2
value is NULL
value is NULL
value is NULL
status: 8, stat: 2
I (8891) [IoT]: _do_state_updating(573) > Call usr status_cb with 0x208
I (9111) [IoT]: _iot_parse_noti_data(650) > payload : {"target":"6543a7c7-2d1c-4e86-8675-ba35fea2a1e9","values":{},"event":"device.preferences"}
I (9111) [IoT]: _iot_parse_noti_data(749) > No references
I (9121) [IoT]: iot_noti_sub_cb(829) > Ignore notification
E (32701) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x7780
I (32701) esp-tls-mbedtls: Certificate verified.
E (32701) esp-tls: Failed to open new connection
E (32701) transport_base: Failed to open a new connection
E (32711) HTTP_CLIENT: Connection failed, sock < 0
HTTP_EVENT_ERROR
Failed to open HTTP connection: 28674

About ESP8266 compilation issues

I encountered a problem that I could not solve by myself. The specific output log is as follows:
Generating esp8266.project.ld
Traceback (most recent call last):
File "/home//document/st-device-sdk-c-ref/bsp/esp8266/tools/ldgen/ldgen.py", line 150, in
main()
File "/home/
/document/st-device-sdk-c-ref/bsp/esp8266/tools/ldgen/ldgen.py", line 106, in main
dump = StringIO(subprocess.check_output([objdump, "-h", library]).decode())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 21: ordinal not in range(128)
make: *** [/home//document/st-device-sdk-c-ref/bsp/esp8266/components/esp8266/Makefile.projbuild:74:/home//document/st-device-sdk-c-ref/apps/esp8266/switch_example/build/esp8266/esp8266.project.ld] error 1

Checksum error flashing to ESP8266

Getting an MD5Sum error when attempting to flash to an ESP8266

esptool.py v2.4.0
Connecting........_
Chip is ESP8266EX
Features: WiFi
MAC: 50:02:91:d6:12:45
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x00011000 in 0.3 seconds (effective 250.7 kbit/s)...
Hash of data verified.
Compressed 9440 bytes to 6327...
Wrote 9440 bytes (6327 compressed) at 0x00000000 in 0.8 seconds (effective 92.1 kbit/s)...
Hash of data verified.
Compressed 634832 bytes to 413663...
Wrote 634832 bytes (413663 compressed) at 0x00014000 in 43.8 seconds (effective 115.9 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 116...
Wrote 3072 bytes (116 compressed) at 0x00008000 in 0.3 seconds (effective 76.8 kbit/s)...

A fatal error occurred: MD5Sum command returned unexpected result: '\xf6/j\x90\xa2\xf9\xf9\xaa\xf5B{\x96.\xa9'
make: *** [/home/edu/st-device-sdk-c-ref/bsp/esp8266/components/esptool_py/Makefile.projbuild:76: flash] Error 2

esp32-c3 issue when testing device

  1.        A detailed description of the issue
    

I´m trying to test my first directly connected device. And in the testing process with the mobile phone an error occurs. The error number that appears on the mobile is 86-002. Look at the photo of the mobile screen that i attached.

 I’m following the tutorial described in Direct Connected Devices thata are on the Samsung Developers site.

 I’m using A ESP32C3 DevKit as device.

 I am comiling and loading in the decive the example in st-device-sdk-c-ref/apps/esp32c3/switch_example.

 I have followed the enteri process as indicated.

 When I start the testing process, I see my device on the mobile phone.

 I select my device, then the mobile asks me for the Wi-Fi network to connect the device to.

 I select the wifi network and everythin seems to be fine but after a while the phone displays the screen with error 86-002.

 I have attached the log file that shows the device. In the file I see that at one point somethings is not right in the following lines:

I (59377) [IoT]: _iot_net_tls_connect(418) > Loading the CA root certificate 1317@0x3fcaffc4
I (60147) [IoT]: iot_es_connect(1196) > MQTT connect success
I (60247) [IoT]: _check_connection_response(79) > Connection response payload {"target":"STDK8ZNT4qNqnYkZ","currentTime":1702376425,"event":"expired.jwt"}
I (60247) [IoT]: _check_connection_response(92) > Set SNTP with current time 1702376425
W (60257) [IoT]: iot_es_connect(1227) > GG connection fail
I (60267) [IoT]: st_mqtt_disconnect(1434) > mqtt disconnect 0
I (60277) [IoT]: _iot_net_show_status(92) > [1702376425] network socket status: sockfd 54 readable 0 writable 4194304 sock_err 0 errno 34
E (60287) [IoT]: _do_iot_main_command(613) > failed to iot_es_connect for registration
E (60297) [IoT]: _iot_main_task(909) > failed handle cmd (1): -201

SmartThings app version (Menu > Settings > About SmartThings)
1.8.10.21

Mobile model number and OS versión
SAMSUNG GALAXY S22 ANDROID 12

Location from where you are contacting usc
SPAIN
registro.txt
pantalla

IoT Ethernet device onboarding support

How can I adopt using Ethernet and not WiFi?

I want be be able to Adopt using an ESP32 with Ethernet in my project in cases where Wifi is not suitable. I have several boards to work with to test but not sure where to start. It is not clear to me how the ST App will adopt an Ethernet based IoT device. Is it using UPNP/SSDP for discovery or does the user have to know the IP address?

https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware
https://www.olimex.com/Products/IoT/ESP32/ESP32-POE-ISO/open-source-hardware

Example needed for stand alone app on github

I have been putting my code in st-device-sdk-c-ref/apps/esp32_v4.x/AlarmDecoder-STSDK folder for testing and designing my device code. This is not optimal for putting a project on github. I need some help integrating into this build environment for my own project.

Thanks for any help!

Best
SM

Unable to register device to samsung acount

Error while registering st_switch using ESP32 to Samsung account. Code used is exactly the same as in this repository (along with this issue correction #25). Implementation details provided by smart things used. (esp-idf version 3.3 and toolchain provided in this repository used for the project). Device was successfully discovered in the smart things app but was unable to get registered to my Samsung account.
While using a monitor, the following output was printed after selecting the wifi network the device will connect to (error in bold).

I (67111) [IoT]: _iot_easysetup_gen_post_payload(247) > waiting.. response for [5]
I (67111) [IoT]: _es_wifi_prov_parse(1327) > no macAddress
I (67121) [IoT]: _es_wifi_prov_parse(1350) > ssid: test_wifi
I (67121) [IoT]: _es_wifi_prov_parse(1352) > mac addr: 00:00:00:00:00:00
I (67131) [IoT]: _es_json_parse_string(145) > failed to find 'locationId'
I (67131) [IoT]: _es_cloud_prov_parse(1425) > no locationId
I (67141) [IoT]: _es_json_parse_string(145) > failed to find 'roomId'
I (67151) [IoT]: _es_cloud_prov_parse(1446) > no roomId
I (67161) [IoT]: _es_cloud_prov_parse(1466) > brokerUrl: mqtt-apnortheast2.api.smartthings.com:8883
I (67161) [IoT]: _es_cloud_prov_parse(1467) > deviceName : SmartSwitch
I (67171) [IoT]: _es_wifiprovisioninginfo_handler(1594) > provisioning success
I (67181) [IoT]: http_msg_handler(338) > post cmd[5] ok
I (67201) [IoT]: _iot_easysetup_gen_post_payload(247) > waiting.. response for [6]
I (67201) [IoT]: http_msg_handler(338) > post cmd[6] ok
I (67211) [IoT]: _do_iot_main_command(332) > curr_main_cmd:9, curr_main_state:3/3
I (67371) wifi: station: 26:9f:ca:0e:6f:42 leave, AID = 1, bss_flags is 134243, bss:0x3ffc9bc8
I (67371) wifi: new:<1,0>, old:<1,0>, ap:<1,1>, sta:<0,0>, prof:1
I (67371) [IoT]: event_handler(139) > station:26:9f:ca:0e:6f:42leave, AID=1
I (68211) [IoT]: _do_update_timeout(161) > Current timeout : 100000 for 4
I (68211) [IoT]: _do_status_report(265) > Call usr status_cb with 2/2
status: 2, stat: 2
I (68211) [IoT]: _do_iot_main_command(332) > curr_main_cmd:1, curr_main_state:3/4
I (68221) [IoT]: iot_bsp_wifi_set_mode(212) > iot_bsp_wifi_set_mode = 2
I (68231) [IoT]: iot_bsp_wifi_set_mode(264) > [esp32] current mode=3 need to call esp_wifi_stop
I (68241) [IoT]: event_handler(98) > SYSTEM_EVENT_STA_STOP
E (68241) event: system_event_ap_stop_handle_default 223 esp_wifi_internal_reg_rxcb ret=0x3014
I (68251) [IoT]: event_handler(126) > SYSTEM_EVENT_AP_STOP
I (68261) wifi: flush txq
I (68261) wifi: stop sw txq
I (68261) wifi: lmac stop hw txq
I (68271) [IoT]: iot_bsp_wifi_set_mode(271) > AP Mode stopped
I (68771) wifi: mode : sta (3c:71:bf:af:a8:00)
I (68771) [IoT]: iot_bsp_wifi_set_mode(305) > connect to ap SSID:test_wifi
I (69131) wifi: new:<4,1>, old:<1,0>, ap:<255,255>, sta:<4,1>, prof:1
I (70111) wifi: state: init -> auth (b0)
I (70121) wifi: state: auth -> assoc (0)
I (70131) wifi: state: assoc -> run (10)
I (70241) wifi: connected with test_wifi, channel 4, 40U, bssid = c*:3*:e*:7*:*6:*c
I (70241) wifi: pm start, type: 1

I (70241) [IoT]: event_handler(145) > event_handler = 4
I (72351) event: sta ip: 192.---.---.--, mask: 255.---.---.-, gw: 192.---.-.-
I (72351) [IoT]: event_handler(113) > got ip:192.xxx.x.xxx rssi:------
I (72351) [IoT]: iot_bsp_wifi_set_mode(310) > AP Connected
I (72361) [IoT]: _clear_listen_socket(44) > Shutting down listen socket
I (72361) [IoT]: es_http_deinit(229) > http tcp deinit complete!
I (72371) [IoT]: iot_easysetup_deinit(462) > IOT_STATE_PROV_ES_DONE
I (72381) [IoT]: _do_iot_main_command(332) > curr_main_cmd:3, curr_main_state:3/4
I (72391) [IoT]: _do_cmd_tout_check(813) > New state updated for 4
I (72391) [IoT]: _do_iot_main_command(332) > curr_main_cmd:9, curr_main_state:4/4
I (72401) [IoT]: _do_state_updating(1483) > the state changes to IOT_STATE_CLOUD_REGISTERING
I (72411) [IoT]: _do_update_timeout(161) > Current timeout : 900000 for 6
I (72421) [IoT]: _do_status_report(265) > Call usr status_cb with 8/1
status: 8, stat: 1
I (72431) [IoT]: _do_iot_main_command(332) > curr_main_cmd:4, curr_main_state:4/6
I (72471) [IoT]: iot_es_connect(792) > connect_type: registration
I (72471) [IoT]: _iot_es_mqtt_connect(631) > url: mqtt-apnortheast2.api.smartthings.com, port: 8883
I (72471) [IoT]: _iot_es_mqtt_connect(640) > mqtt connect,
id : xxxxxxxxxxxxx
username : ST--------
password : xxxxxxxx
I (72511) [IoT]: _iot_net_tls_connect(160) > Loading the CA root certificate --------
I (74961) [IoT]: iot_es_connect(805) > MQTT connect success
I (75511) [IoT]: _do_cmd_tout_check(813) > New state updated for 6

"WIFI_STA_CONNECT_BIT event Timeout" error when finishing Onboarding on ESP8266

Hello everyone,

Not long ago a new error appeared, when trying to Direct-connect a ESP8266 board to SmartThings. I used a switch_example from this repo without any modifications. At first all goes well, the board is discovered and the phone asks which WiFi network to use. On the last step of Onboarding, the following error occurs:

E (134720) [IoT]: iot_bsp_wifi_set_mode(337) > WIFI_STA_CONNECT_BIT event Timeout
E (134726) [IoT]: _do_iot_main_command(564) > failed to set wifi_set_mode

After that, an error with code 86-002 appears on smartphone screen.

It is certainly a new error, as before (~several month ago) I repeated the same steps and all worked like charm. I used the same board, the same program and same developer account.

See full log in the attach
wifi_error.log

esp8266 build error

在使用官方推荐的python build.py esp8266 switch_example 进行编译的时候会有如下的错误:
Generating esp8266.project.ld LD build/switch_example.elf /mnt/e/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: /mnt/f/c/st-device-sdk-c-ref/iot-core/src/security/backend/software/lib/esp/libiot_security_ss.a(iot_security_ss.o):(.literal.F88ef4f295d2+0x0): undefined reference to iot_bsp_system_get_uniqueid'
/mnt/e/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: /mnt/f/c/st-device-sdk-c-ref/iot-core/src/security/backend/software/lib/esp/libiot_security_ss.a(iot_security_ss.o): in function F88ef4f295d2': /home/shkim/project/things/stdk/github-sec/st-device-sdk-c-ref/bsp/esp8266/components/iot_security_ss/iot_security_ss.c:55: undefined reference to iot_bsp_system_get_uniqueid'
/mnt/e/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: /mnt/f/c/st-device-sdk-c-ref/iot-core/src/security/backend/software/lib/esp/libiot_security_ss.a(iot_security_ss.o): in function F75695623470': /home/shkim/project/things/stdk/github-sec/st-device-sdk-c-ref/bsp/esp8266/components/iot_security_ss/iot_security_ss.c:91: undefined reference to iot_bsp_system_get_uniqueid'
collect2: error: ld returned 1 exit status
make: *** [/mnt/f/c/st-device-sdk-c-ref/bsp/esp8266/make/project.mk:510: /mnt/f/c/st-device-sdk-c-ref/apps/esp8266/switch_example/build/switch_example.elf] Error 1`

经过排查发现是因为在iot-core库中的一次提交feat : Remove unused bsp porting function移除掉了iot_bsp_system_get_uniqueid,此次的提交id为b19fbbe71d5305749aabc4127fec8c9838696b8e 希望修复一下编译的问题

谢谢

Feature Request while we all wait for 1.7.51...

Add "Linux" build option.
Being able to build for an embedded device is good but sometimes we just want to run the code inside of a Raspberry Pi or small linux router. This would make this build environment even more flexible for building daemons on a Linux device.

Example esp8266 code for sending temperature data

This guide was very helpful at getting a smart light working with an esp8266, however there aren't examples on sending data (eg temperature sensor) to Smartthings.
In the light_example, there is functionality for a dummy dust sensor, however this makes use of header files such as caps_dustSensor.h and caps_dustSensor.c. Is there a place I could find premade temperatureMeasurement caps header files, or an example on how to do so?
Thank you for your assistance

Issues with ota_demo

I recently updated my development environment to stdk 1.8.14 and idf v5.0.2.
Several problems have been occured in ota_demo.

1. Some sha256-related functions are no longer supported and cannot be compiled, so an update is required.

https://github.com/espressif/mbedtls/blob/dd91f30058dfad68d80267cc82cd8472c4aa54b5/include/mbedtls/compat-2.x.h

/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c: In function '_crypto_sha256':
/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:286:15: error: implicit declaration of function 'mbedtls_sha256_ret'; did you mean 'mbedtls_sha256_free'? [-Werror=implicit-function-declaration]
286 | ret = mbedtls_sha256_ret(src, src_len, dst, 0);
| ^~~~~~~~~~~~~~~~~~
| mbedtls_sha256_free
/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c: In function '_update_device':
/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:475:13: error: implicit declaration of function 'mbedtls_sha256_starts_ret'; did you mean 'mbedtls_sha256_starts'? [-Werror=implicit-function-declaration]
475 | if (mbedtls_sha256_starts_ret( &ctx, 0) != 0 ) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha256_starts
/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:611:29: error: implicit declaration of function 'mbedtls_sha256_update_ret'; did you mean 'mbedtls_sha256_update'? [-Werror=implicit-function-declaration]
611 | if (mbedtls_sha256_update_ret(&ctx, (const unsigned char *)upgrade_data_buf, data_read) != 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha256_update
/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:632:13: error: implicit declaration of function 'mbedtls_sha256_finish_ret'; did you mean 'mbedtls_sha256_finish'? [-Werror=implicit-function-declaration]
632 | if (mbedtls_sha256_finish_ret( &ctx, md) != 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha256_finish
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
HINT: You maybe using pre FreeRTOS V8.0.0 APIs. The backward compatibility of such APIs is no longer enabled by default. Please turn on CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY explicitly to use such APIs.
HINT: Please check that the function name is correct. Also it is possible that you've forgot to import mbedtls_sha256_ret library(s) in header file or add the necessary REQURIES component. Try to add missing libraries to your project header file or check idf_component_register(REQUIRES ...) section in your component CmakeList.txt file. For more information run 'idf.py docs -sp api-guides/build-system.html'.
Also, please check if the function has been removed, renamed or replaced by an alternative function - refer to the migration guide for more information.
HINT: The issue is better to resolve by replacing format specifiers to 'PRI'-family macros (include <inttypes.h> header file).

2. When compiling ota_demo, the following error occurs.

esp32@esp32-VirtualBox:~/st-device-sdk-c-ref$ python build.py esp32 ota_demo all
/bin/sh: 22: ./export.sh: [[: not found
Detecting the Python interpreter
Checking "python3" ...
Checking "python" ...
Python 3.7.5
"python" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Constraint file: /home/esp32/.espressif/espidf.constraints.v5.0.txt
Requirement files:

  • /home/esp32/st-device-sdk-c-ref/bsp/esp32/tools/requirements/requirements.core.txt
    Python being checked: /home/esp32/.espressif/python_env/idf5.0_py3.7_env/bin/python
    /home/esp32/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources
    Python requirements are satisfied.
    Updated PATH variable:
    /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/espcoredump:/home/esp32/st-device-sdk-c-ref/bsp/esp32/components/partition_table:/home/esp32/st-device-sdk-c-ref/bsp/esp32/components/app_update:/home/esp32/.espressif/tools/xtensa-esp-elf-gdb/11.2_20220823/xtensa-esp-elf-gdb/bin:/home/esp32/.espressif/tools/riscv32-esp-elf-gdb/11.2_20220823/riscv32-esp-elf-gdb/bin:/home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin:/home/esp32/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin:/home/esp32/.espressif/tools/xtensa-esp32s3-elf/esp-2022r1-11.2.0/xtensa-esp32s3-elf/bin:/home/esp32/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin:/home/esp32/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/home/esp32/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin:/home/esp32/.espressif/python_env/idf5.0_py3.7_env/bin:/home/esp32/st-device-sdk-c-ref/bsp/esp32/tools:/home/esp32/.local/bin:/home/esp32/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    Done! You can now compile ESP-IDF projects.
    Go to the project directory and run:

idf.py build

/home/esp32/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Executing action: all (aliases: build)
Running cmake in directory /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=0 /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo"...
-- Found Git: /usr/bin/git (found version "2.17.1")
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/sdkconfig
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Found Python3: /home/esp32/.espressif/python_env/idf5.0_py3.7_env/bin/python (found version "3.7.5") found components: Interpreter
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "ota_demo" version: v1.8.7-5-gaf35890-dirty
-- Adding linker script /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/soc/esp32/ld/esp32.peripherals.ld
Enter component.cmake
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_netif esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 iot-core_config json log lwip main mbedtls mqtt newlib nvs_flash openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/app_trace /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/app_update /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/bootloader /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/bootloader_support /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/bt /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/cmock /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/console /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/cxx /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/driver /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/efuse /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp-tls /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_adc /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_app_format /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_common /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_eth /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_event /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_gdbstub /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_hid /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_http_client /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_http_server /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_https_ota /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_https_server /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_hw_support /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_lcd /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_local_ctrl /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_netif /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_partition /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_phy /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_pm /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_psram /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_ringbuf /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_system /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_timer /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_wifi /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/espcoredump /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esptool_py /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/fatfs /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/freertos /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/hal /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/heap /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/http_parser /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/idf_test /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/ieee802154 /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/iot-core_config /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/json /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/log /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/lwip /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/main /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/mbedtls /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/mqtt /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/newlib /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/nvs_flash /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/openthread /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/partition_table /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/perfmon /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/protobuf-c /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/protocomm /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/pthread /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/sdmmc /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/soc /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/spi_flash /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/spiffs /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/tcp_transport /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/ulp /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/unity /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/usb /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/vfs /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/wear_levelling /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/wifi_provisioning /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/wpa_supplicant /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/xtensa
-- Configuring done
CMake Error at /home/esp32/st-device-sdk-c-ref/iot-core/src/CMakeLists.txt:71 (add_subdirectory):
Target "iotcore" links to:

idf::espressif__libsodium

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
cmake failed with exit code 1, output of the command is in the /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build/log/idf_py_stderr_output_18744 and /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build/log/idf_py_stdout_output_18744

Usage: python build.py apps/[BSP_NAME]/[APP_NAME]
or
python build.py [BSP_NAME] [APP_NAME]

[BSP_NAME] : [APP_NAME]
esp32 : light_example, switch_example, ota_demo
esp32c3 : light_example, switch_example
emw3166 : light_example, switch_example
rtl8720c : light_example, switch_example
esp32s2 : light_example
emw3080 : light_example, switch_example
esp32_v3.3 : light_example, switch_example, ota_demo
rtl8195 : light_example, switch_example
rtl8721c : light_example, switch_example
esp8266 : light_example, switch_example

ex) python build.py apps/esp32/switch_example
ex) python build.py esp32 light_example

Encrypting stnv bin partition

Hi,

I'm trying to modify esp32c3 "switch_example" to encrypt s/n and paired keys in stnv partition.

I've got working the example right in both modes, taking keys from device.JSON file and taking them from stnv partition (with flashing the keys BIN file in STNV partition). Now I want to encrypt this BIN file. To do that I follow next steps:

  1. I generate encrypted BIN file next way:
    “…/nvs_partition_gen.py encrypt input.csv out_enc.bin --version 1 --keygen”

  2. Then I flash encrypted bin to STNV partition doing next:
    “python $IDF_PATH/components/esptool_py/esptool/esptool.py --chip esp32c3 write_flash 0x9000 out_enc.bin”

  3. Finally, I flash bin file with the keys to decript STNV partition. I flash them in nvs_keys partition:
    “…parttool.py --partition-table-offset 0x8000 write_partition --partition-name=“nvs_key” --input keys-04-18_09-59.bin”

I put my ESP32c3 running but it fails. It seems that it doesn't get to connect with smartthings server.

Are those steps correct? Do I have to change something in "switch_example" code to initializate STNV as secure mode?

Any help would be greatly appreciated.

Best regards,

Asier.

Kconfig not working for ESP8266

Hi,

The Smartthings Kconfig file is not being picked up when using ESP8266 (works fine for ESP32). I copied the Kconfig from iot-core/src to my project's main/ so that menuconfig would pick it up. It's either that or define all the config variables manually, including "STDK_IOT_CORE" without which the source code won't even compile.

ESP8266 switch_example SSID error

I ended up getting this to work, but I'm curious about what the problem might have been.

I was able to get the switch_example to flash to the ESP8266, but when I tried to connect to the device with my phone, the phone gave the error: "Security policy prevents use of unsecure Wi-Fi networks." I tried all the solutions I could find, but nothing worked. I had read that connecting to the wifi network manually can help the phone trust it, so I found where where the SSID and password were stored and added a line which printed these to the serial monitor. I was able to connect to the wifi, but the same error came back.

Finally, I started digging around for some of the errors that were in the serial monitor.
3dfc8c00f82537e0a5e8d807004370c2b3741fda
I found that the first one (mbedtls_base64_decode = -0x002c) has something to do with invalid characters. I noticed there were spaces in the SSID, which is derived from the device name, so I removed the spaces from the device name and re-downloaded the onboarding_info.json. Spaces disappeared from the SSID, but I still got the same error. I saw a comment in another issue to delete the build folder and rebuild and this caused everything to work!

My question is, why did deleting the build folder and starting from scratch fix the issue? Isn't everything in there overwritten when the project is rebuilt?

Finally, there's a plot twist. I put the spaces back in the device name just to see if that was really the problem, and this time, the SSID had underscores instead of spaces. Here's a screenshot of remembered networks to prove I'm not losing my mind.

So second question: Does anyone know how this could have happened? I'm something of a novice at this stuff, so I'd love to know why.

Error while ESP32 build

Getting this error when attempting to build st_switch for esp32.
Provided the console log showing the error.
I have only simply followed the documentation provided in the repository (https://github.com/SmartThingsCommunity/st-device-sdk-c-ref/tree/master/apps/esp32/st_switch). Can someone please help me with this?
Used the ESP32 Toolchain for Linux as instructed in this repository.
Have setup the esp32-idf on the latest stable build (https://docs.espressif.com/projects/esp-idf/en/stable/get-started/index.html) and just incase, also on v3.3 as recommended on this repository.

command used: ./build.sh esp32 st_switch

Generating libspi_flash.a.sections_info
Generating libspiffs.a.sections_info
Generating libsrc.a.sections_info
Generating libtcp_transport.a.sections_info
Generating libtcpip_adapter.a.sections_info
Generating libulp.a.sections_info
Generating libunity.a.sections_info
Generating libvfs.a.sections_info
Generating libwear_levelling.a.sections_info
Generating libwifi_provisioning.a.sections_info
Generating libwpa_supplicant.a.sections_info
Generating libxtensa-debug-module.a.sections_info
Generating esp32.project.ld
LD build/smart_switch_demo.elf
/home/anand/st-device-sdk-c-ref/apps/esp32/st_switch/build/src/libsrc.a(iot_log_file.o):(.literal._iot_log_file_load_header+0x14): undefined reference to iot_log_read_flash' /home/anand/st-device-sdk-c-ref/apps/esp32/st_switch/build/src/libsrc.a(iot_log_file.o): In function _iot_log_file_load_header':
/home/anand/st-device-sdk-c-ref/iot-core/src/iot_log_file.c:94: undefined reference to iot_log_read_flash' /home/anand/st-device-sdk-c-ref/apps/esp32/st_switch/build/src/libsrc.a(iot_log_file.o): In function _iot_log_read_bytes':
/home/anand/st-device-sdk-c-ref/iot-core/src/iot_log_file.c:94: undefined reference to `iot_log_read_flash'
collect2: error: ld returned 1 exit status
make: *** [/home/anand/st-device-sdk-c-ref/bsp/esp32/make/project.mk:483: /home/anand/st-device-sdk-c-ref/apps/esp32/st_switch/build/smart_switch_demo.elf] Error 1

Build process very slow

I'll like to ask if building process is same slow realy or I'm make some wrong. Because for me has taken 2 - 3 hours to complete.

I'm build switch_example in a ESP8266 using comand python3 build.py apps/esp8266/switch_example. And I using to work a subsystem wsl2 linux. The build process is work normaly, after flash to device de system work corretly. But build is very too slowly.

Onboarding Error ESP32 Switch

I am attempting to run the st_switch program from this repo on an ESP32 chip.
After flashing the code onto the chip, i wasn't able to detect the device using the smart things app. I then realized the device's wifi ssid wasn't visible. I have made no changes to the code yet.
Added changes from previous issue to file sdkconfig (#25) as suggested by smart things.
I used the monitor to detect probable issues and got this after flashing:
(command used "./build.sh esp32 st_switch flash monitor")

MONITOR

I (309) cpu_start: Pro cpu up.
I (309) cpu_start: Application information:
I (309) cpu_start: Project name: smart_switch_demo
I (312) cpu_start: App version: v1.0.0-191-gd5f6ec6-dirty
I (319) cpu_start: Compile time: Jul 2 2020 21:16:21
I (325) cpu_start: ELF file SHA256: 65496e38ea8136e7...
I (331) cpu_start: ESP-IDF: v3.3-rc-10-g8f5cf4754
I (337) cpu_start: Single core mode
I (341) heap_init: Initializing. RAM available for dynamic allocation:
I (348) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (354) heap_init: At 3FFB87F8 len 00027808 (158 KiB): DRAM
I (361) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (367) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (373) heap_init: At 4008EFB4 len 0001104C (68 KiB): IRAM
I (379) cpu_start: Pro cpu start user code
I (61) cpu_start: Starting scheduler on PRO CPU.
E (65) [IoT]: iot_api_onboarding_config_load(498) > [mnId] wrong onboarding config value detected: MNID
E (65) [IoT]: st_conn_init(1092) > failed loading onboarding profile (-5)
fail to create the iot_context

I (75) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (85) gpio: GPIO[26]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (95) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (105) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (115) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (125) gpio: GPIO[2]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3

Can i do something to fix this? I have closely followed the documentation provided for st_switch, am using esp-idf v3.3 and installed toolchain as recommended in the readme files.

ESP8266 switch_example

I am working on switch_example on esp8266 using the code from this repo. Have followed all the steps mentioned in this repo and espressif website. Also I have run the example from ESP_RTOS_STDK so that my enviorment check is done. But now when I am trying with switch_example, I am stuck at this point. I couldn't figure out whats the problem and my device is not connected to wifi and smarthtings app also not recognizing the device.

I (353) [IoT]: _dump_device_info(747) > firmware_version: switch_example_001
I (356) [IoT]: iot_bsp_wifi_init(193) > [esp8266] iot_bsp_wifi_init
I (362) system_api: Base MAC address is not set, read default base MAC address from EFUSE
I (375) system_api: Base MAC address is not set, read default base MAC address from EFUSE
phy_version: 1163.0, 665d56c, Jun 24 2020, 10:00:08, RTOS new
I (450) phy_init: phy ver: 1163_0
I (475) [IoT]: iot_bsp_wifi_init(231) > [esp8266] iot_bsp_wifi_init done
I (479) [IoT]: st_conn_init(1134) > stdk_version : 1.8.7
I (481) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (495) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
��*�P*V��ET����T��K��u�U+UZ�Z�T��T
��*�P*V��ET����T��K��u�U+UZ�Z�T��T����Eu��T�QQ��jPU���u�����ZT�(UE����Q�UEu�����*�B����B�u��E+���T)UZV�R�Eu����ŪQB���U�*�u���ZT�(E����QT�E�j*QT��I (355) [IoT]: _dump
                                  ����Eu��T�QQ��jPU���u�����ZT�(UE����Q�UEu�����*�B����B�u��E+���T)UZV�R�Eu����ŪQB���U�*�u���ZT�(E����QT�E�j*QT��I (355) [IoT]: _dump_device_info(747) > firmware_version:
 switch_example_001
I (358) [IoT]: iot_bsp_wifi_init(193) > [esp8266] iot_bsp_wifi_init
I (364) system_api: Base MAC address is not set, read default base MAC address from EFUSE
I (377) system_api: Base MAC address is not set, read default base MAC address from EFUSE
phy_version: 1163.0, 665d56c, Jun 24 2020, 10:00:08, RTOS new
I (453) phy_init: phy ver: 1163_0
I (477) [IoT]: iot_bsp_wifi_init(231) > [esp8266] iot_bsp_wifi_init done
I (481) [IoT]: st_conn_init(1134) > stdk_version : 1.8.7
I (484) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (498) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

also when I have connected the LED on board, the switch thing is working. Please help me...

Issues related to st_conn_cleanup(iot_ctx, false) function

When I press the reset button for 5 seconds to initialize the device, factory reset function is executed. Because the AP has not started, onboarding can no longer proceed. AP mode is activated only when the power is reconnected.

static void connection_start(void) {
    iot_pin_t *pin_num = NULL;
    int err;
    err = st_conn_start(iot_ctx, (st_status_cb)&iot_status_cb, IOT_STATUS_ALL, NULL, pin_num);
    if (err) {
        printf("fail to start connection. err:%d\n", err);
    }
    if (pin_num) {
        free(pin_num);
    }
}

static void connection_start_task(void *arg) {
    connection_start();
    vTaskDelete(NULL);
}

void button_event(IOT_CAP_HANDLE *handle, int type, int count) {
...
    } else if (type == BUTTON_LONG_PRESS) {
        st_conn_cleanup(iot_ctx, false);
        xTaskCreate(connection_start_task, "connection_task", 2048, NULL, 10, NULL);
    }
}

I (185053) button_event(): button, clean-up provisioning & data without reboot
I (185053) [IoT]: st_conn_cleanup(1305) > st_conn_cleanup start (0)
D (185053) [IoT]: iot_dump_log(346) > LOG : 30000000 65a71b9a 0000051a 00000000
D (185063) [IoT]: _iot_net_tls_write(614) > 24@0x3ffd0450
D (185773) [IoT]: _iot_net_tls_read(575) > 1@0x3ffbc604
D (185773) [IoT]: _iot_net_tls_read(575) > 1@0x3ffbc605
D (185773) [IoT]: _iot_net_tls_read(575) > 2@0x3ffcf35e
D (185773) [IoT]: iot_dump_log(346) > LOG : 3000010a 65a71b9b 00000000 00000000
D (188833) [IoT]: _iot_net_tls_read(575) > 1@0x3ffcb094
D (188833) [IoT]: _iot_net_tls_read(575) > 1@0x3ffcb095
D (188833) [IoT]: _iot_net_tls_read(575) > 1@0x3ffcb096
D (188833) [IoT]: _iot_net_tls_read(575) > 139@0x3ffda67f
D (188843) [IoT]: _iot_mqtt_signin_client_callback(424) > raw msg : {"target":"99edeb78-df98-4439-8c59-4cce23830ad8","event":"device.deleted"}
D (188853) [IoT]: iot_dump_log(346) > LOG : 30000204 65a71b9e 00000000 00000000
I (188863) [IoT]: _iot_parse_noti_data(650) > payload : {"target":"99edeb78-df98-4439-8c59-4cce23830ad8","event":"device.deleted"}
D (188873) [IoT]: iot_dump_log(346) > LOG : 30000205 65a71b9e 00000000 00000000
D (188883) [IoT]: _iot_main_task(902) > cmd: 4

I (188883) [IoT]: _do_iot_main_command(586) > curr_main_cmd:4, curr_main_state:6
D (188893) [IoT]: iot_dump_log(346) > LOG : 30000000 65a71b9e 000002e8 00000000
I (188903) [IoT]: _do_iot_main_command(748) > Device-card deleting is done
D (188903) [IoT]: iot_dump_log(346) > LOG : 20000000 65a71b9e 000002ed c1eac1eb
D (188913) [IoT]: _iot_net_tls_write(614) > 4@0x3ffd0460
I (188923) [IoT]: iot_device_cleanup(1023) > start to erase device information
D (188923) [IoT]: iot_nv_erase_prov_data(303) > >>>HIT<<<
D (188933) [IoT]: _iot_nv_io_storage(104) > id = 1, mode = 2
D (188943) [IoT]: iot_security_be_init(2283) > security backend is 'software'
D (188943) [IoT]: iot_security_storage_write(155) > id:1
D (188953) [IoT]: _iot_security_be_bsp_fs_store(262) > id = 1
D (188963) [IoT]: iot_bsp_nv_get_data_path(25) > >>>HIT<<<
D (188963) [IoT]: _iot_security_be_bsp_fs_storage_id2filename(85) > storage file = 'WifiProvStatus'ty_be_init(2283) > snvs_open_from_partition stdk 1
D (188983) nvs: nvs_set_str WifiProvStatus NONE
D (188993) nvs: nv13) [IoT]iot_security_be_bsp_fs_store(262) > id = 6
D (1890) > id:1 written 4@0x3f400764
D (188993) [IoT]: _iot_nv_io_storage(104) > id = 6, mode = 2
D (189003) [IoT]: iot_security_be_init(2283) > security backend is 'software'
D (18900loudProvStatus NONE
D (189053) nvs: nvs_d:6
D (189013)13) [IoT]: iot_bsp_nv_get_data_path(25) > >>>HIT<<<T<<<0m
D (189053) [IoT]: iot_nv_erase(1136) > >>>Hme(85) > storage file = 'CloudProvStatus'
D (189033) nvs: nvs_open_from_partition stdk 1
D (189043) nvs: nvs_set_str CloudProvStatus NONE
D (189053) nvs: nvs_close 40
D (18_bsp__be_bsp_fs_remove(315) > id = 10
D (189083) [IoT]: iotIT<<<
D (189063) [IoT]: _iot_nv_io_storage(104) > id =n stdk 1
D (189103) nvs: nvs_erase_key Device_from_partitio> security backend is 'software'
D (189073) [IoT]: iot_secuect it first.

D (189123re is previous connecting, disconn_bsp_nv_get_data_path(25) > >>>HIT<<<
D (189093IoT]: _ionect(1434) > mqtt disconnect 0
I (189143) [n stdk 1
D (189103) nvs: nvs_erase_key DeviceID

D (000 00000000
I (189163) [IoT]: st_conn_cle1b9e 00000ect it first.

D (189123) [IoT]: iot_es_disconnect(1300) >)
D (189183) [IoT]: iot_dump_ > st_conn_start start (no-pinIoT]: _iot_net_show_status(92) > [1705450398] network socket stae 000004cb 0000[IoT]: iot_dump_log(346) > LOG : 20000000 65a71b9000 00000000
I (189163) [IoT]: st_conn_cleanup(1324) > st_conn_cleanup done (0)
D (189173) [IoT]: iot_dump_log()
D (189183) [IoT]: iot_dump_log(346) > LOG : 30000000 65a71b9e 000004c7 00000000
W (189193) [IoT]: st_conn_stae 000004cb 00000006
D (189213) [IoT]: iot_dump_log(346) > LOG : 20000104 65a71b9e fffffff5 00000000
D (189213) [IoT]: iot_nv_get_misc_info(1071) > >>>HIT<<<
D (189223) [IoT]: _iot_nv_io_storage(104) > id = 11, mode = 1
D (189233) [IoT]: iot_security_be_init(2283) > security backend is 'sfo'
bsp_fs_storage_id2filename(85) > storage file = 'MiscIn id:11
D (189243) [IoT]: _iot_security_be_bsp_fs_load(193) > id = 11
D (189243) [IoT]: _iot_security_be_bsp_fs_load_from_nv(100) > id = 11
D (189253) [IoT]: iot_bsp_nv_get_data_path(25) > >>>HIT<<<
D (189263) [IoT]: _iot_secfo'
D (189273) nvs: nvs_open_from_partition stdk 0
D (f-3001f7caa49a4","maj":0,"min":1},"loId":"0ee68f6a-656c-4dbc-a1cvs_get_str_or_blob MiscInfo
D (189283) nvs: nvs_close 42
D (189283) [IoT]: iot_security_storage_read(146) > id:11 read 133@0x3ffcf7dc
D (189293) [IoT]: iot_misc_info_store(1378)onnecting failed(-2) fostr : {"dip":{"id":"292bfe28-dc57-4c27-b1f-3001f7caa4ee","prevErr":"CE32"}
D (189313) [IoT]: iot_misc_info_store(1387) > Same misc_info, skip NV update
E (189313) [IoT]: iot_es_disconnect(1294) > There is no mqtt_ctx!!
W (189323) [IoT]: _iot_main_task(980) > COMM disconnecting failed(-2) for mqtt_yield
D (189333) [IoT]: iot_dump_log(346) > LOG : 20000000 65a71b9f 000003d5 fffffffe

#include "st_dev.h" is missing

I was trying to flash switch_example on esp8266, but I am getting an error that the header file is missing. Am I missing something?

I have used build.py python method.

ERROR****

#include "st_dev.h"
^~~~~~~~~~
compilation terminated.
make[1]: *** [main.o] Error 1
make: *** [component-main-build] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.