Matter Bridge enable openthread

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Matter Bridge enable openthread

Postby f.h-f.s. » Mon Mar 04, 2024 4:30 pm

Hi there,

I am trying to enable OpenThread in the Matter-bridge build example. When I disable OpenThread the Matter sample works without issue.
However when I do that, the system crashes and I do not get any hints to why it is happening.
The backtrace seem to be corrupted and the LoadProhibited only shows calls to mem functions in ROM.

Does anyone have any experience with enabling OpenThread in a Matter example?
Does anyone know what logging I should enable to maybe get a hint to why I am crashing?

Code: Select all

I (1856) bridge-devicecallbacks: PostAttributeChangeCallback - Cluster ID: '0x8', EndPoint ID: '0x2', Attribute ID: '0x0'
I (1866) bridge-devicecallbacks: Current free heap: 2146879

I (1876) chip[DIS]: Updating services using commissioning mode 1
I (1876) chip[DIS]: CHIP minimal mDNS started advertising.
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x40056f17  PS      : 0x00060430  A0      : 0x82052c39  A1      : 0x3fce5030  
0x40056f17: __memcpy_aux in ROM

A2      : 0x3fce5371  A3      : 0x00002e9a  A4      : 0x00000008  A5      : 0x3fce5371  
A6      : 0x3fce5390  A7      : 0x0000000c  A8      : 0x00002e94  A9      : 0x3fce5290  
A10     : 0x3fce9710  A11     : 0x3fceedb4  A12     : 0x3fcc6478  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000011  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00002e9a  LBEG    : 0x400570a4  LEND    : 0x400570a9  LCOUNT  : 0x00000000  
0x400570a4: __memset_aux in ROM

0x400570a9: __memset_aux in ROM



Backtrace: 0x40056f14:0x3fce5030 |<-CORRUPTED
0x40056f14: __memcpy_aux in ROM

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: Matter Bridge enable openthread

Postby f.h-f.s. » Tue Mar 05, 2024 11:59 am

Just adding some more information. I enabled more logging for OpenThread but I am still not getting any hints about the crash.

Building with Connectedhomeip commit https://github.com/project-chip/connect ... 9119285a61

Building the example project
examples/bridge-app/esp32
from inside a container with
docker run --privileged -v /home/fhfs/Repos/connectedhomeip:/tmp/connectedhomeip --device=/dev/ttyACM0:/dev/ttyACM0 -it --rm ghcr.io/project-chip/chip-build-esp32:35
my sdkconfig.defaults.esp32s3 looks like:

Code: Select all

#
#    Copyright (c) 2021 Project CHIP Authors
#    Copyright (c) 2018 Nest Labs, Inc.
#    All rights reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
#    Description:
#      Some useful defaults for the demo app configuration.
#

# Default to 921600 baud when flashing and monitoring device
CONFIG_ESPTOOLPY_BAUD_921600B=y
CONFIG_ESPTOOLPY_BAUD=921600
CONFIG_ESPTOOLPY_COMPRESSED=y
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y

# Enable SPIRAM
CONFIG_SPIRAM=y

#enable BT
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y

#disable BT connection reattempt
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n

#enable lwip ipv6 autoconfig
CONFIG_LWIP_IPV6_AUTOCONFIG=y

# Use a custom partition table
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"


# Disable softap support by default
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
CONFIG_DEFAULT_WIFI_SSID="wifissid"
CONFIG_DEFAULT_WIFI_PASSWORD="wifipassword

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
CONFIG_MBEDTLS_ECJPAKE_C=y
CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y

# LwIP config for OpenThread
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
CONFIG_LWIP_MULTICAST_PING=y
# libopenthread_br.a and ESP32RouteTable.c both contain lwip_hook_ip6_route and lwip_hook_nd6_get_gw
# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

# Enable OpenThread
CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_SRP_CLIENT=y
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
CONFIG_OPENTHREAD_LOG_LEVEL_NOTE=y
CONFIG_OPENTHREAD_CLI=n
CONFIG_OPENTHREAD_DNS_CLIENT=y
CONFIG_OPENTHREAD_BORDER_ROUTER=y
CONFIG_OPENTHREAD_BR_AUTO_START=y
CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
CONFIG_ENABLE_MATTER_OVER_THREAD=y
CONFIG_THREAD_TASK_STACK_SIZE=5120

CONFIG_FREERTOS_USE_TRACE_FACILITY=y
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
CONFIG_AZURE_SAMPLE_USE_PLUG_AND_PLAY=y
CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y
CONFIG_ENABLE_DPS_SAMPLE=y
Log output:

Code: Select all

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40375b37
0x40375b37: esp_restart_noos_dig at /opt/espressif/esp-idf/components/esp_system/port/esp_system_chip.c:57 (discriminator 1)

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x1750
load:0x403c9700,len:0x4
load:0x403c9704,len:0xc00
load:0x403cc700,len:0x2e04
entry 0x403c9908
I (26) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (26) boot: compile time Mar  5 2024 10:55:44
I (26) boot: Multicore bootloader
I (29) boot: chip revision: v0.1
I (33) boot.esp32s3: Boot SPI Speed : 80MHz
I (38) boot.esp32s3: SPI Mode       : DIO
I (42) boot.esp32s3: SPI Flash Size : 4MB
I (47) boot: Enabling RNG early entropy source...
I (53) boot: Partition Table:
I (56) boot: ## Label            Usage          Type ST Offset   Length
I (64) boot:  0 nvs              WiFi data        01 02 00009000 0000c000
I (71) boot:  1 phy_init         RF data          01 01 00015000 00001000
I (78) boot:  2 factory          factory app      00 00 00020000 001e0000
I (86) boot: End of partition table
I (90) esp_image: segment 0: paddr=00020020 vaddr=3c130020 size=4ac24h (306212) map
I (153) esp_image: segment 1: paddr=0006ac4c vaddr=3fc9aa00 size=05260h ( 21088) load
I (158) esp_image: segment 2: paddr=0006feb4 vaddr=40374000 size=00164h (   356) load
I (159) esp_image: segment 3: paddr=00070020 vaddr=42000020 size=125c9ch (1203356) map
I (384) esp_image: segment 4: paddr=00195cc4 vaddr=40374164 size=1684ch ( 92236) load
I (414) boot: Loaded app from partition at offset 0x20000
I (414) boot: Disabling RNG early entropy source...
I (426) cpu_start: Multicore app
I (426) esp_psram: Found 2MB PSRAM device
I (427) esp_psram: Speed: 40MHz
I (427) cpu_start: Pro cpu up.
I (431) cpu_start: Starting app cpu, entry point is 0x403756b0
0x403756b0: call_start_cpu1 at /opt/espressif/esp-idf/components/esp_system/port/cpu_start.c:157

I (0) cpu_start: App cpu up.
I (856) esp_psram: SPI SRAM memory test OK
I (865) cpu_start: Pro cpu start user code
I (865) cpu_start: cpu freq: 160000000 Hz
I (866) cpu_start: Application information:
I (868) cpu_start: Project name:     chip-bridge-app
I (874) cpu_start: App version:      v1.0
I (879) cpu_start: Compile time:     Mar  5 2024 10:55:31
I (885) cpu_start: ELF file SHA256:  f1f4bf551fad47db...
I (891) cpu_start: ESP-IDF:          v5.1.2
I (896) cpu_start: Min chip rev:     v0.0
I (900) cpu_start: Max chip rev:     v0.99 
I (905) cpu_start: Chip rev:         v0.1
I (910) heap_init: Initializing. RAM available for dynamic allocation:
I (917) heap_init: At 3FCBA530 len 0002F1E0 (188 KiB): DRAM
I (923) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (930) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (936) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (943) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator
I (951) spi_flash: detected chip: generic
I (955) spi_flash: flash io: dio
I (960) sleep: Configure to isolate all GPIO pins in sleep state
I (965) sleep: Enable automatic switching of GPIO sleep configuration
I (972) coexist: coex firmware version: b6d5e8c
I (978) coexist: coexist rom version e7ae62f
I (983) app_start: Starting scheduler on CPU0
I (988) app_start: Starting scheduler on CPU1
I (988) main_task: Started on CPU0
I (998) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1008) main_task: Calling app_main()
I (1058) pp: pp rom version: e7ae62f
I (1058) net80211: net80211 rom version: e7ae62f
I (1078) wifi:wifi driver task: 3fccef94, prio:23, stack:6656, core=0
I (1088) wifi:wifi firmware version: 91b9630
I (1088) wifi:wifi certification version: v7.0
I (1088) wifi:config NVS flash: enabled
I (1088) wifi:config nano formating: disabled
I (1098) wifi:Init data frame dynamic rx buffer num: 32
I (1098) wifi:Init static rx mgmt buffer num: 5
I (1108) wifi:Init management short buffer num: 32
I (1108) wifi:Init static tx buffer num: 16
I (1108) wifi:Init tx cache buffer num: 32
I (1118) wifi:Init static tx FG buffer num: 2
I (1118) wifi:Init static rx buffer size: 1600
I (1128) wifi:Init static rx buffer num: 10
I (1128) wifi:Init dynamic rx buffer num: 32
I (1128) wifi_init: rx ba win: 6
I (1138) wifi_init: tcpip mbox: 32
I (1138) wifi_init: udp mbox: 6
I (1148) wifi_init: tcp mbox: 6
I (1148) wifi_init: tcp tx win: 5744
I (1148) wifi_init: tcp rx win: 5744
I (1158) wifi_init: tcp mss: 1440
I (1158) wifi_init: WiFi IRAM OP enabled
I (1168) wifi_init: WiFi RX IRAM OP enabled
I (1168) chip[DL]: Device[Light 1]: ONLINE
I (1178) chip[DL]: Device[Light 2]: ONLINE
I (1178) chip[DL]: Device[Light 3]: ONLINE
I (1188) chip[DL]: Device[Light 4]: ONLINE
I (1208) chip[DL]: NVS set: chip-counters/reboot-count = 11740 (0x2DDC)
I (1208) chip[DL]: Real time clock set to 946684800 (0100/00/01 00:00:00 UTC)
I (1208) BLE_INIT: BT controller compile version [59725b5]
I (1218) BLE_INIT: Bluetooth MAC: 34:85:18:7e:7e:8e

I (1218) main_task: Returned from app_main()
I (1218) phy_init: phy_version 620,ec7ec30,Sep  5 2023,13:49:13
I (1278) NimBLE: GAP procedure initiated: stop advertising.

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

I (1278) CHIP[DL]: BLE host-controller synced
I (1788) chip[DL]: Starting ESP WiFi layer
I (1788) wifi:mode : sta (34:85:18:7e:7e:8c)
I (1788) wifi:enable tsf
W (1788) wifi:Haven't to connect to a suitable AP now!
I (1788) chip[DL]: Attempting to connect WiFi station interface
I (1798) chip[DL]: WiFi station state change: NotConnected -> Connecting
I (1798) chip[DL]: Done driving station state, nothing else to do...
I (1808) chip[SVR]: SetupQRCode: [MT:Y.K90KE600KA0648G00]
I (1818) chip[SVR]: Copy/paste the below URL in a browser to see the QR Code:
I (1828) chip[SVR]: https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3AY.K90KE600KA0648G00
I (1838) chip[SVR]: Manual pairing code: [34970112332]
I (1838) chip[SVR]: Initializing subscription resumption storage...
I (1848) chip[SVR]: Server initializing...
I (1848) chip[TS]: Last Known Good Time: 2023-10-14T01:16:48
I (1858) chip[DMG]: AccessControl: initializing
I (1858) chip[DMG]: Examples::AccessControlDelegate::Init
I (1868) chip[DMG]: AccessControl: setting
I (1878) chip[DMG]: DefaultAclStorage: initializing
I (1878) chip[DMG]: DefaultAclStorage: 0 entries loaded
I (1898) chip[ZCL]: Using ZAP configuration...
I (1908) chip[DMG]: AccessControlCluster: initializing
I (1908) chip[ZCL]: Initiating Admin Commissioning cluster.
I (1908) bridge-devicecallbacks: PostAttributeChangeCallback - Cluster ID: '0x30', EndPoint ID: '0x0', Attribute ID: '0x0'
I (1918) bridge-devicecallbacks: Current free heap: 2121587

I (1928) bridge-devicecallbacks: PostAttributeChangeCallback - Cluster ID: '0x8', EndPoint ID: '0x2', Attribute ID: '0x0'
I (1938) bridge-devicecallbacks: Current free heap: 2121539

I (1948) chip[DIS]: Updating services using commissioning mode 1
I (1958) chip[DIS]: CHIP minimal mDNS started advertising.
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x40056f17  PS      : 0x00060430  A0      : 0x82052df9  A1      : 0x3fceb770  
0x40056f17: __memcpy_aux in ROM

A2      : 0x3fcebab1  A3      : 0x00002f6e  A4      : 0x00000008  A5      : 0x3fcebab1  
A6      : 0x3fcebad0  A7      : 0x0000000c  A8      : 0x000005ed  A9      : 0x3fceb9d0  
A10     : 0x600fe010  A11     : 0x600fe8b8  A12     : 0x3fccb568  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00002f6e  LBEG    : 0x400570a4  LEND    : 0x400570a9  LCOUNT  : 0x00000000  
0x400570a4: __memset_aux in ROM

0x400570a9: __memset_aux in ROM



Backtrace: 0x40056f14:0x3fceb770 |<-CORRUPTED
0x40056f14: __memcpy_aux in ROM





ELF file SHA256: f1f4bf551fad47db

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: Matter Bridge enable openthread

Postby f.h-f.s. » Thu Mar 07, 2024 3:17 pm

Problems disappear when using a matter sample from the esp-matter repository.

The esp-matter docker build image"espressif/esp-matter:latest" is also much more convenient to build the projects, although it is much larger than the connectedhomeip build image "ghcr.io/project-chip/chip-build-esp32:35" 5GB vs 15GB.

Who is online

Users browsing this forum: pepgra and 165 guests