espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.69k stars 7.29k forks source link

HA_on_off_light example not working on ESP32-H2 (IDFGH-11795) #12890

Open Liniik opened 10 months ago

Liniik commented 10 months ago

Answers checklist.

IDF version.

v5.1.2

Espressif SoC revision.

ESP32-H2 (revision v0.1)

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

ESP32-H2-DEVKITM-1-N4

Power Supply used.

USB

What is the expected behavior?

Proper initialization and working device. I expect log like in the example's README like this:

I (901) ESP_ZB_LIGHT: Zigbee stack initialized
I (901) ESP_ZB_LIGHT: Start network steering
I (2611) ESP_ZB_LIGHT: Joined network successfully (Extended PAN ID: aa:98:48:01:a0:03:f7:84, PAN ID: 0x0e8b)

Then I'd expect to be able to add it to my Home Assistant instance and use it.

What is the actual behavior?

This log - last three lines are the problem - ESP_FAIL during init and not working example.

SPIWP:0xee
mode:DIO, clock div:1
load:0x4083cfd0,len:0xcd4
load:0x4083efd0,len:0x2da0
load:0x408460e8,len:0x1778
entry 0x4083cfd0
I (23) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (23) boot: compile time Dec 28 2023 21:48:24
I (25) boot: chip revision: v0.1
I (26) boot.esp32h2: SPI Speed      : 64MHz
I (31) boot.esp32h2: SPI Mode       : DIO
I (35) boot.esp32h2: SPI Flash Size : 2MB
I (40) boot: Enabling RNG early entropy source...
I (45) boot: Partition Table:
I (49) boot: ## Label            Usage          Type ST Offset   Length
I (56) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (64) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (71) boot:  2 factory          factory app      00 00 00010000 000a2800
I (79) boot:  3 zb_storage       Unknown data     01 81 000b3000 00004000
I (86) boot:  4 zb_fct           Unknown data     01 81 000b7000 00000400
I (94) boot: End of partition table
I (98) esp_image: segment 0: paddr=00010020 vaddr=42068020 size=10d30h ( 68912) map
I (126) esp_image: segment 1: paddr=00020d58 vaddr=40800000 size=072c0h ( 29376) load
I (136) esp_image: segment 2: paddr=00028020 vaddr=42000020 size=65bc0h (416704) map
I (253) esp_image: segment 3: paddr=0008dbe8 vaddr=408072c0 size=06c48h ( 27720) load
I (267) boot: Loaded app from partition at offset 0x10000
I (268) boot: Disabling RNG early entropy source...
I (278) cpu_start: Unicore app
I (279) cpu_start: Pro cpu up.
W (288) clk: esp_perip_clk_init() has not been implemented yet
I (295) cpu_start: Pro cpu start user code
I (295) cpu_start: cpu freq: 96000000 Hz
I (296) cpu_start: Application information:
I (298) cpu_start: Project name:     light_bulb
I (303) cpu_start: App version:      1
I (307) cpu_start: Compile time:     Dec 28 2023 21:48:07
I (313) cpu_start: ELF file SHA256:  9681cbbd13c902ed...
I (319) cpu_start: ESP-IDF:          v5.1.2
I (324) cpu_start: Min chip rev:     v0.0
I (329) cpu_start: Max chip rev:     v0.99 
I (334) cpu_start: Chip rev:         v0.1
I (339) heap_init: Initializing. RAM available for dynamic allocation:
I (346) heap_init: At 40814690 len 00038CF0 (227 KiB): D/IRAM
I (352) heap_init: At 4084D380 len 00002B60 (10 KiB): STACK/DIRAM
I (360) spi_flash: detected chip: generic
I (364) spi_flash: flash io: dio
W (367) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (381) sleep: Configure to isolate all GPIO pins in sleep state
I (388) sleep: Enable automatic switching of GPIO sleep configuration
I (395) app_start: Starting scheduler on CPU0
I (400) main_task: Started on CPU0
I (400) main_task: Calling app_main()
W (410) rmt: channel resolution loss, real=10666666
I (410) gpio: GPIO[8]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (440) phy: phy_version: 211,0, 5857fe5, Nov  1 2023, 11:31:09
I (440) phy: libbtbb version: ce629d6, Nov  1 2023, 11:31:19
I (450) main_task: Returned from app_main()
I (460) ESP_ZB_ON_OFF_LIGHT: ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
I (460) ESP_ZB_ON_OFF_LIGHT: Zigbee stack initialized
W (8650) ESP_ZB_ON_OFF_LIGHT: Failed to initialize Zigbee stack (status: ESP_FAIL)

Steps to reproduce.

  1. Create project using example HA_on_off_light
  2. Build, flash and monitor the device

Debug Logs.

No response

More Information.

ESP-IDF installed as per documentation here I have some C programming background but I am completely new to this low level programming of ESPs so I don't even know where to look when the ESP_FAIL shows up. ESP-IDF Doctor output with redacted PATH:

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS win32 x64 10.0.19045 
System environment variable IDF_PYTHON_ENV_PATH 
 undefined 
System environment variable PATH 
 REDACTED
System environment variable PYTHON 
 undefined 
Visual Studio Code version 1.85.1 
Visual Studio Code language en 
Visual Studio Code shell C:\Program Files\PowerShell\7\pwsh.exe 
ESP-IDF Extension version 1.6.5 
Workspace folder c:<HOMEPATH>\Desktop\HA_on_off_light 
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH}
ESP-IDF Path (idf.espIdfPath) C:<HOMEPATH>\Documents\esp-idf
ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}
ESP-Matter Path (idf.espMatterPath) ${env:ESP_MATTER_PATH}
Custom extra paths (idf.customExtraPaths) C:<HOMEPATH>\.espressif\tools\xtensa-esp-elf-gdb\12.1_20221002\xtensa-esp-elf-gdb\bin;C:<HOMEPATH>\.espressif\tools\riscv32-esp-elf-gdb\12.1_20221002\riscv32-esp-elf-gdb\bin;C:<HOMEPATH>\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\bin;C:<HOMEPATH>\.espressif\tools\xtensa-esp32s2-elf\esp-12.2.0_20230208\xtensa-esp32s2-elf\bin;C:<HOMEPATH>\.espressif\tools\xtensa-esp32s3-elf\esp-12.2.0_20230208\xtensa-esp32s3-elf\bin;C:<HOMEPATH>\.espressif\tools\riscv32-esp-elf\esp-12.2.0_20230208\riscv32-esp-elf\bin;C:<HOMEPATH>\.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin;C:<HOMEPATH>\.espressif\tools\cmake\3.24.0\bin;C:<HOMEPATH>\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin;C:<HOMEPATH>\.espressif\tools\ninja\1.10.2;C:<HOMEPATH>\.espressif\tools\idf-exe\1.0.3;C:<HOMEPATH>\.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64;C:<HOMEPATH>\.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64;C:<HOMEPATH>\.espressif\tools\esp-rom-elfs\20230320
Custom extra vars (idf.customExtraVars)
    OPENOCD_SCRIPTS: C:<HOMEPATH>\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921/openocd-esp32/share/openocd/scripts
    IDF_CCACHE_ENABLE: 1
    ESP_ROM_ELF_DIR: C:<HOMEPATH>\.espressif\tools\esp-rom-elfs\20230320/
Virtual env Python Path (idf.pythonBinPath) C:<HOMEPATH>\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe
Serial port (idf.port) COM5
OpenOCD Configs (idf.openOcdConfigs) board/esp32h2-bridge.cfg
ESP-IDF Tools Path (idf.toolsPath) C:<HOMEPATH>\.espressif
Git Path (idf.gitPath) C:<HOMEPATH>\.espressif\tools\idf-git\2.39.2\cmd\git.exe
-------------------------------------------------------- Configurations access -------------------------------------------------------------
Access to ESP-ADF Path (idf.espAdfPath) false
Access to ESP-IDF Path (idf.espIdfPath) true
Access to ESP-MDF Path (idf.espMdfPath) false
Access to ESP-Matter Path (idf.espMatterPath) false
Access to ESP-IDF Custom extra paths
Access to C:<HOMEPATH>\.espressif\tools\xtensa-esp-elf-gdb\12.1_20221002\xtensa-esp-elf-gdb\bin: true
Access to C:<HOMEPATH>\.espressif\tools\riscv32-esp-elf-gdb\12.1_20221002\riscv32-esp-elf-gdb\bin: true
Access to C:<HOMEPATH>\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\bin: true
Access to C:<HOMEPATH>\.espressif\tools\xtensa-esp32s2-elf\esp-12.2.0_20230208\xtensa-esp32s2-elf\bin: true
Access to C:<HOMEPATH>\.espressif\tools\xtensa-esp32s3-elf\esp-12.2.0_20230208\xtensa-esp32s3-elf\bin: true
Access to C:<HOMEPATH>\.espressif\tools\riscv32-esp-elf\esp-12.2.0_20230208\riscv32-esp-elf\bin: true
Access to C:<HOMEPATH>\.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin: true
Access to C:<HOMEPATH>\.espressif\tools\cmake\3.24.0\bin: true
Access to C:<HOMEPATH>\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin: true
Access to C:<HOMEPATH>\.espressif\tools\ninja\1.10.2: true
Access to C:<HOMEPATH>\.espressif\tools\idf-exe\1.0.3: true
Access to C:<HOMEPATH>\.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64: true
Access to C:<HOMEPATH>\.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64: true
Access to C:<HOMEPATH>\.espressif\tools\esp-rom-elfs\20230320: true
Access to Virtual env Python Path (idf.pythonBinPath) true
Access to CMake in environment PATH undefined
Access to Ninja in environment PATH undefined
Access to ESP-IDF Tools Path (idf.toolsPath) true
-------------------------------------------------------- Configurations has spaces -------------------------------------------------------------
Spaces in system environment Path true
Spaces in ESP-ADF Path (idf.espAdfPath) false
Spaces in ESP-IDF Path (idf.espIdfPath) false
Spaces in ESP-MDF Path (idf.espMdfPath) false
Spaces in ESP-Matter Path (idf.espMatterPath) false
Spaces in ESP-IDF Custom extra paths
Spaces in C:<HOMEPATH>\.espressif\tools\xtensa-esp-elf-gdb\12.1_20221002\xtensa-esp-elf-gdb\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\riscv32-esp-elf-gdb\12.1_20221002\riscv32-esp-elf-gdb\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\xtensa-esp32s2-elf\esp-12.2.0_20230208\xtensa-esp32s2-elf\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\xtensa-esp32s3-elf\esp-12.2.0_20230208\xtensa-esp32s3-elf\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\riscv32-esp-elf\esp-12.2.0_20230208\riscv32-esp-elf\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\cmake\3.24.0\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin: false
Spaces in C:<HOMEPATH>\.espressif\tools\ninja\1.10.2: false
Spaces in C:<HOMEPATH>\.espressif\tools\idf-exe\1.0.3: false
Spaces in C:<HOMEPATH>\.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64: false
Spaces in C:<HOMEPATH>\.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64: false
Spaces in C:<HOMEPATH>\.espressif\tools\esp-rom-elfs\20230320: false
Spaces in Virtual env Python Path (idf.pythonBinPath) false
Spaces in ESP-IDF Tools Path (idf.toolsPath) false
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version 2.39.2.windows.1
ESP-IDF version 5.1.2
Python version 3.11.2
Python's pip version 23.3.1
-------------------------------------------------- Project configuration settings ----------------------------------------------------------
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
bitarray version: 2.8.5
bitstring version: 4.1.4
CacheControl version: 0.13.1
certifi version: 2023.11.17
cffi version: 1.16.0
charset-normalizer version: 3.3.2
click version: 8.0.4
colorama version: 0.4.6
construct version: 2.10.69
contextlib2 version: 21.6.0
cryptography version: 39.0.2
ecdsa version: 0.18.0
esp-coredump version: 1.9.0
esp-debug-backend version: 1.0.3
esp-idf-kconfig version: 1.4.1
esp-idf-monitor version: 1.3.4
esp-idf-panic-decoder version: 1.0.1
esp-idf-size version: 1.0.1
esptool version: 4.7.dev3
filelock version: 3.13.1
freertos-gdb version: 1.0.2
gcovr version: 6.0
idf-component-manager version: 1.4.1
idna version: 3.6
intelhex version: 2.3.0
Jinja2 version: 3.0.3
kconfiglib version: 14.1.0
lxml version: 4.9.3
markdown-it-py version: 3.0.0
MarkupSafe version: 2.1.3
mdurl version: 0.1.2
msgpack version: 1.0.7
packaging version: 23.2
pip version: 23.3.1
pycparser version: 2.21
pyelftools version: 0.29
pygdbmi version: 0.9.0.2
Pygments version: 2.17.2
pyparsing version: 3.0.9
pyserial version: 3.5
pywin32 version: 306
PyYAML version: 6.0.1
reedsolo version: 1.7.0
requests version: 2.31.0
requests-file version: 1.5.1
requests-toolbelt version: 1.0.0
rich version: 13.7.0
schema version: 0.7.5
setuptools version: 69.0.2
six version: 1.16.0
tqdm version: 4.66.1
urllib3 version: 1.26.18
websocket-client version: 1.7.0
windows-curses version: 2.3.2
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages Python requirements are satisfied.
---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages Python requirements are satisfied.
---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages Python requirements are satisfied.
---------------------------------------------------- Visual Studio Code launch.json --------------------------------------------------------
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "espidf",
      "name": "Launch",
      "request": "launch"
    }
  ]
} 
---------------------------------------------------- Visual Studio Code c_cpp_properties.json ----------------------------------------------
{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "${config:idf.toolsPathWin}\\tools\\riscv32-esp-elf\\esp-12.2.0_20230208\\riscv32-esp-elf\\bin\\riscv32-esp-elf-gcc.exe",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            },
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

--------------------------------------------------------------------------------------------------------------------------------------------
nopnop2002 commented 9 months ago

Before flashing to the board, you need to do the following: idf.py -p PORT erase-flash

Liniik commented 9 months ago

Of course I did that... The result is the same. I have two devkits, erased both, tried on both, nothing.

nopnop2002 commented 9 months ago

This is my logging. phy_version and libbtbb version are different from yours.

I (410) main_task: Started on CPU0
I (410) main_task: Calling app_main()
W (420) rmt: channel resolution loss, real=10666666
I (420) gpio: GPIO[8]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (450) phy: phy_version: 220,2, 37a29de, Dec 29 2023, 16:30:13
I (450) phy: libbtbb version: 944f18e, Dec 29 2023, 16:30:30
I (460) main_task: Returned from app_main()
I (470) ESP_ZB_ON_OFF_LIGHT: ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
I (470) ESP_ZB_ON_OFF_LIGHT: Zigbee stack initialized
I (470) ESP_ZB_ON_OFF_LIGHT: Start network steering
I (41150) ESP_ZB_ON_OFF_LIGHT: Network steering was not successful (status: ESP_FAIL)
I (82840) ESP_ZB_ON_OFF_LIGHT: Network steering was not successful (status: ESP_FAIL)
Liniik commented 9 months ago

What is "phy"? How can I update it? I installed everything via VS Code per instructions and the esp-idf extension shows as up to date. But you still have ESP_FAIL at the end.

nopnop2002 commented 9 months ago

the esp-idf extension shows as up to date.

I (23) boot: ESP-IDF v5.1.2 2nd stage bootloader

Your esp-idf is not the latest version V5.1. Latest is:

I (23) boot: ESP-IDF v5.1.2-602-gdb1e54a0c5-dirty 2nd stage bootloader

But this is probably not the cause.

Liniik commented 9 months ago

As you can see, in the editor I can't update it because it shows as latest version. Last update on the market is 13. 12. 2023. Is there any settings where I could update it more? image

nopnop2002 commented 9 months ago

Is there any settings where I could update it more?

I'm not using VScode IDE.

I used this.

$ git clone -b release/v5.1 --recursive https://github.com/espressif/esp-idf.git
$ cd esp-idf
$ ./install.sh

But this is probably not the cause.

nopnop2002 commented 9 months ago

Looks similar to this. https://github.com/espressif/esp-idf/issues/12657

xieqinan commented 8 months ago

@Liniik

Would you be able to utilize two chips to run the light and switch examples provided here initially?

Liniik commented 8 months ago

Sorry guys, I have a lot of things going on, I'll try it as soon as I can and let you know the results

Alvin1Zhang commented 3 weeks ago

@Liniik Thanks for reporting, would you please help share if any updates for the issue? Thanks.

Liniik commented 1 week ago

@Alvin1Zhang Yes, but I don't know when. I completely abandoned the idea of direct development with any esp board given that no help came for an issue completely blocking whole progress. So I need to find the boards and get the environment updated and running again.