espressif / esp-thread-br

Espressif Thread Border Router SDK
Apache License 2.0
98 stars 19 forks source link

Could not get ESP32-C6 Thread Network working via the ESP Thread Border Router (TZ-1014) #83

Closed digidhamu closed 2 days ago

digidhamu commented 1 month ago

I could not get ESP32-C6 joined to Thread Network. I do have ESP Thread Border Router running and connected WiFi and able to ping the IPv6 address from outside. Could you please assist me anything wrong I am doing from the below.

Commands Used

cd esp-matter/examples/light
cp sdkconfig.defaults.c6_thread sdkconfig.defaults.esp32c6
idf.py set-target esp32c6
idf.py build
idf.py -p /dev/tty.usbserial-110 flash monitor

SDKConfig

Configured as per Thread Border Router dataset active output

CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP"
CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX="fd00:db8:a0:0::/64"
CONFIG_OPENTHREAD_NETWORK_CHANNEL=15
CONFIG_OPENTHREAD_NETWORK_PANID=0x1234
CONFIG_OPENTHREAD_NETWORK_EXTPANID="1122334455667788"
CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff"
CONFIG_OPENTHREAD_NETWORK_PSKC="cfc6427eedd997e0ce8a8a75058cfc65"

Console Output

Executing action: flash
Running ninja in directory /Users/dhamukrish/esp/esp-matter/examples/light/build
Executing "ninja flash"...
[1/1] cd /Users/dhamukrish/esp/esp-matter/examples/light/build/bootlo...mukrish/esp/esp-matter/examples/light/build/bootloader/bootloader.bin
Bootloader binary size 0x54d0 bytes. 0x6b30 bytes (56%) free.
[2/10] Performing build step for 'chip_gn'
ninja: no work to do.
[7/8] cd /Users/dhamukrish/esp/esp-matter/examples/light/build/esp-id...e.bin /Users/dhamukrish/esp/esp-matter/examples/light/build/light.bin
light.bin binary size 0x17a7a0 bytes. Smallest app partition is 0x1e0000 bytes. 0x65860 bytes (21%) free.
[7/8] cd /Users/dhamukrish/esp/esp-idf/components/esptool_py && /opt/...rs/dhamukrish/esp/esp-idf/components/esptool_py/run_serial_tool.cmake
esptool.py --chip esp32c6 -p /dev/tty.usbserial-110 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 bootloader/bootloader.bin 0x20000 light.bin 0xc000 partition_table/partition-table.bin 0x1d000 ota_data_initial.bin
esptool.py v4.7.0
Serial port /dev/tty.usbserial-110
Connecting....
Chip is ESP32-C6 (QFN40) (revision v0.0)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: 40:4c:ca:ff:fe:4d:f5:ac
BASE MAC: 40:4c:ca:4d:f5:ac
MAC_EXT: ff:fe
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00020000 to 0x0019afff...
Flash will be erased from 0x0000c000 to 0x0000cfff...
Flash will be erased from 0x0001d000 to 0x0001efff...
Compressed 21712 bytes to 13079...
Writing at 0x00000000... (100 %)
Wrote 21712 bytes (13079 compressed) at 0x00000000 in 0.6 seconds (effective 273.2 kbit/s)...
Hash of data verified.
Compressed 1550240 bytes to 937495...
Writing at 0x0019841c... (100 %)
Wrote 1550240 bytes (937495 compressed) at 0x00020000 in 24.4 seconds (effective 508.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 181...
Writing at 0x0000c000... (100 %)
Wrote 3072 bytes (181 compressed) at 0x0000c000 in 0.1 seconds (effective 219.6 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 31...
Writing at 0x0001d000... (100 %)
Wrote 8192 bytes (31 compressed) at 0x0001d000 in 0.1 seconds (effective 464.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Executing action: monitor
Running idf_monitor in directory /Users/dhamukrish/esp/esp-matter/examples/light
Executing "/Users/dhamukrish/.espressif/python_env/idf5.2_py3.9_env/bin/python /Users/dhamukrish/esp/esp-idf/tools/idf_monitor.py -p /dev/tty.usbserial-110 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c6 --revision 0 --decode-panic backtrace /Users/dhamukrish/esp/esp-matter/examples/light/build/light.elf -m '/Users/dhamukrish/.espressif/python_env/idf5.2_py3.9_env/bin/python' '/Users/dhamukrish/esp/esp-idf/tools/idf.py' '-p' '/dev/tty.usbserial-110'"...
--- WARNING: Serial ports accessed as /dev/tty.* will hang gdb if launched.
--- Using /dev/cu.usbserial-110 instead...
--- esp-idf-monitor 1.4.0 on /dev/cu.usbserial-110 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xe (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x1804
load:0x4086c410,len:0xe58
load:0x4086e610,len:0x2e20
entry 0x4086c41a
I (23) boot: ESP-IDF v5.2.1 2nd stage bootloader
I (24) boot: compile time Jul 21 2024 17:06:31
I (24) boot: chip revision: v0.0
I (26) boot.esp32c6: SPI Speed      : 80MHz
I (31) boot.esp32c6: SPI Mode       : DIO
I (36) boot.esp32c6: SPI Flash Size : 4MB
I (41) boot: Enabling RNG early entropy source...
I (46) boot: Partition Table:
I (50) boot: ## Label            Usage          Type ST Offset   Length
I (57) boot:  0 esp_secure_cert  unknown          3f 06 0000d000 00002000
I (64) boot:  1 nvs              WiFi data        01 02 00010000 0000c000
I (72) boot:  2 nvs_keys         NVS keys         01 04 0001c000 00001000
I (79) boot:  3 otadata          OTA data         01 00 0001d000 00002000
I (87) boot:  4 phy_init         RF data          01 01 0001f000 00001000
I (94) boot:  5 ota_0            OTA app          00 10 00020000 001e0000
I (102) boot:  6 ota_1            OTA app          00 11 00200000 001e0000
I (109) boot:  7 fctry            WiFi data        01 02 003e0000 00006000
I (117) boot: End of partition table
I (121) boot: No factory image, trying OTA 0
I (126) esp_image: segment 0: paddr=00020020 vaddr=42130020 size=3aad8h (240344) map
I (184) esp_image: segment 1: paddr=0005ab00 vaddr=40800000 size=05518h ( 21784) load
I (190) esp_image: segment 2: paddr=00060020 vaddr=42000020 size=12a7f0h (1222640) map
I (443) esp_image: segment 3: paddr=0018a818 vaddr=40805518 size=0ff58h ( 65368) load
I (459) esp_image: segment 4: paddr=0019a778 vaddr=50000000 size=00004h (     4) load
I (464) boot: Loaded app from partition at offset 0x20000
I (491) boot: Set actual ota_seq=1 in otadata[0]
I (491) boot: Disabling RNG early entropy source...
I (502) cpu_start: Unicore app
W (511) clk: esp_perip_clk_init() has not been implemented yet
I (518) cpu_start: Pro cpu start user code
I (518) cpu_start: cpu freq: 160000000 Hz
I (518) cpu_start: Application information:
I (521) cpu_start: Project name:     light
I (525) cpu_start: App version:      1.0
I (530) cpu_start: Compile time:     Jul 21 2024 17:22:44
I (536) cpu_start: ELF file SHA256:  44a08992b...
I (541) cpu_start: ESP-IDF:          v5.2.1
I (546) cpu_start: Min chip rev:     v0.0
I (551) cpu_start: Max chip rev:     v0.99 
I (556) cpu_start: Chip rev:         v0.0
I (561) heap_init: Initializing. RAM available for dynamic allocation:
I (568) heap_init: At 4082A3E0 len 00052230 (328 KiB): RAM
I (574) heap_init: At 4087C610 len 00002F54 (11 KiB): RAM
I (580) heap_init: At 50000004 len 00003FE4 (15 KiB): RTCRAM
I (587) spi_flash: detected chip: generic
I (591) spi_flash: flash io: dio
W (595) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
W (609) rmt(legacy): legacy driver is deprecated, please migrate to `driver/rmt_tx.h` and/or `driver/rmt_rx.h`
I (619) sleep: Configure to isolate all GPIO pins in sleep state
I (626) sleep: Enable automatic switching of GPIO sleep configuration
I (633) coexist: coex firmware version: 77cd7f8
I (638) coexist: coexist rom version 5b8dcfa
I (643) main_task: Started on CPU0
I (643) main_task: Calling app_main()
I (663) led_driver_ws2812: Initializing light driver
I (663) gpio: GPIO[9]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (673) app_main: Light created with endpoint_id 1
I (693) chip[DL]: NVS set: chip-counters/reboot-count = 12 (0xC)
I (693) chip[DL]: Real time clock set to 946684800 (0100/00/01 00:00:00 UTC)
I (693) BLE_INIT: Using main XTAL as clock source
I (703) BLE_INIT: ble controller commit:[217f1bf]
I (703) phy_init: phy_version 250,e14681b,Jan 24 2024,17:43:11
I (703) OPENTHREAD: Host connection mode none
I (743) phy: libbtbb version: 939f79c, Jan 24 2024, 17:43:26
I (753) NimBLE: GAP procedure initiated: stop advertising.

I (753) NimBLE: Failed to restore IRKs from store; status=8

I (753) CHIP[DL]: BLE host-controller synced
I (773) OPENTHREAD: OpenThread attached to netif
I (783) chip[DL]: OpenThread started: OK
I (783) chip[DL]: Setting OpenThread device type to ROUTER
I (1273) chip[DL]: Configuring CHIPoBLE advertising (interval 25 ms, connectable)
I (1273) NimBLE: GAP procedure initiated: advertise; 
I (1273) NimBLE: disc_mode=2
I (1273) NimBLE:  adv_channel_map=0 own_addr_type=1 adv_filter_policy=0 adv_itvl_min=40 adv_itvl_max=40
I (1283) NimBLE: 

I (1293) chip[DL]: CHIPoBLE advertising started
I (1293) chip[SVR]: Initializing subscription resumption storage...
I (1303) chip[SVR]: Server initializing...
I (1303) chip[TS]: Last Known Good Time: 2023-10-14T01:16:48
I (1313) chip[FP]: Fabric index 0x2 was retrieved from storage. Compressed FabricId 0x177A590849C59026, FabricId 0x0000000000000001, NodeId 0x0000000000000002, VendorId 0xFFF4
I (1333) chip[DMG]: AccessControl: initializing
I (1333) chip[DMG]: Examples::AccessControlDelegate::Init
I (1343) chip[DMG]: AccessControl: setting
I (1343) chip[DMG]: DefaultAclStorage: initializing
I (1353) chip[DMG]: DefaultAclStorage: 1 entries loaded
I (1363) chip[ZCL]: Using ZAP configuration...
I (1363) esp_matter_cluster: Cluster plugin init common callback
I (1363) chip[DMG]: AccessControlCluster: initializing
I (1373) chip[ZCL]: 0x42135990ep 0 clus 0x0000_0030 attr 0x0000_0000 not supported
I (1383) chip[ZCL]: Initiating Admin Commissioning cluster.
I (1383) chip[SVR]: Fabric already commissioned. Disabling BLE advertisement
I (1393) chip[IN]: CASE Server enabling CASE session setups
I (1403) chip[SVR]: Joining Multicast groups
I (1403) chip[SVR]: Server Listening...
I (1413) esp_matter_core: Dynamic endpoint 0 added
I (1413) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000003's Attribute 0x00000001 is 0 **********
I (1433) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000004's Attribute 0x00000000 is 128 **********
I (1443) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000004's Attribute 0x0000FFFC is <invalid type: 0> **********
I (1453) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x0000FFFC is 1 **********
I (1463) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00004003 is 0 **********
I (1473) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00000000 is 0 **********
I (1483) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00000000 is 0 **********
I (1503) chip[ZCL]: Endpoint 1 On/off already set to new value
I (1503) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000008's Attribute 0x00000002 is 1 **********
I (1513) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000008's Attribute 0x00000003 is 254 **********
I (1533) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000008's Attribute 0x0000FFFC is 3 **********
I (1543) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000008's Attribute 0x00000000 is 64 **********
I (1553) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000008's Attribute 0x00004000 is 64 **********
I (1563) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000008's Attribute 0x00000000 is 64 **********
I (1573) led_driver_ws2812: led set r:0, g:0, b:0
I (1583) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x00004010 is 250 **********
I (1593) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x00000007 is 250 **********
I (1603) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x0000400B is 0 **********
I (1613) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x0000400C is 65279 **********
I (1633) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x00000007 is 250 **********
I (1643) led_driver_ws2812: led set r:0, g:0, b:0
I (1643) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x00000008 is 2 **********
I (1653) esp_matter_attribute: ********** W : Endpoint 0x0001's Cluster 0x00000300's Attribute 0x00004001 is 2 **********
I (1673) esp_matter_core: Dynamic endpoint 1 added
I (1673) NimBLE: GAP procedure initiated: stop advertising.

I (1683) led_driver_ws2812: led set r:0, g:0, b:0
I (1683) chip[DL]: CHIPoBLE advertising stopped
I (1693) NimBLE: GAP procedure initiated: stop advertising.

I (1703) led_driver_ws2812: led set r:0, g:0, b:0
I (1703) led_driver_ws2812: led set r:0, g:0, b:0
I (1773) main_task: Returned from app_main()
> I (3703) chip[DL]: BLE deinit successful and memory reclaimed
I (3703) app_main: BLE deinitialized and memory reclaimed
chshu commented 1 month ago

The Matter light example can't join the pre-configured Thread network automatically, it requires the matter commissioning, please follow this instruction: https://docs.espressif.com/projects/esp-matter/en/latest/esp32h2/developing.html#commissioning

If you want the device to join the network automatically, you can use the ot_cli example, and enable the CONFIG_OPENTHREAD_AUTO_START option.

BTW, the C6 log I (1383) chip[SVR]: Fabric already commissioned. Disabling BLE advertisement indicates the device is already commissioned, need to erase flash before the next test.