Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Matter Over Thread on ESP 32 C6 Xiao by Seeed Studio in Arduino IDE#11777

Unanswered
adm1nsys asked this question inQ&A
Discussion options

Hello to everyone! Is it possible to run Matter Over Thread no WiFi in Arduno IDE?
I made code which enable BLE first setup and then it's Matter Over WiFi. It's like mix mode. Can I make Matter Over Thread?

#defineCONFIG_ENABLE_CHIPOBLE1 #defineCHIP_DEVICE_CONFIG_ENABLE_THREAD1#defineCHIP_DEVICE_CONFIG_ENABLE_WIFI0 #include<Matter.h>#include<Preferences.h>#include<platform/CHIPDeviceLayer.h>#include<platform/ConnectivityManager.h>usingnamespacechip::DeviceLayer;#include"esp_mac.h"// Matter endpoint: On/Off LightMatterOnOffLight OnOffLight;Preferences matterPref;#ifndef LED_BUILTIN#defineLED_BUILTIN2#endifconstuint8_t ledPin    = LED_BUILTIN;constuint8_t buttonPin = BOOT_PIN;// BOOTconstchar *nsName ="MatterPrefs";constchar *onOffKey ="OnOff";uint32_t btn_ts =0;bool btn_down =false;constuint32_t debounceMs =250;constuint32_t decommissionHoldMs =5000;boolsetLightOnOff(bool state) {digitalWrite(ledPin, state ? HIGH : LOW);  matterPref.putBool(onOffKey, state);returntrue;}voidprintMacs() {uint8_t mac[6];esp_read_mac(mac, ESP_MAC_WIFI_STA);  Serial.printf("WiFi STA MAC: %02X:%02X:%02X:%02X:%02X:%02X\n",                mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);esp_read_mac(mac, ESP_MAC_WIFI_SOFTAP);  Serial.printf("WiFi AP  MAC: %02X:%02X:%02X:%02X:%02X:%02X\n",                mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);}voidsetup() {  Serial.begin(115200);pinMode(ledPin, OUTPUT);pinMode(buttonPin, INPUT_PULLUP);ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled);ConnectivityMgr().ClearWiFiStationProvision();printMacs();  matterPref.begin(nsName,false);bool last = matterPref.getBool(onOffKey,true);  OnOffLight.begin(last);  OnOffLight.onChange(setLightOnOff);  Matter.begin();if (!Matter.isDeviceCommissioned()) {    Serial.println("\n=== Matter over Thread (BLE commissioning) ===");    Serial.printf("Manual pairing code: %s\n", Matter.getManualPairingCode().c_str());    Serial.printf("QR code URL:        %s\n", Matter.getOnboardingQRCodeUrl().c_str());  }else {    Serial.printf("Resumed. Initial state: %s\n", OnOffLight.getOnOff() ?"ON" :"OFF");    OnOffLight.updateAccessory();  }}voidloop() {staticuint32_t lastNote =0;if (!Matter.isDeviceCommissioned() &&millis() - lastNote >5000) {    Serial.println("Waiting for commissioning…");    lastNote =millis();  }if (digitalRead(buttonPin) == LOW && !btn_down) {    btn_down =true;    btn_ts =millis();  }uint32_t dt =millis() - btn_ts;if (btn_down && dt > debounceMs &&digitalRead(buttonPin) == HIGH) {    btn_down =false;    OnOffLight.toggle();  }if (btn_down && dt > decommissionHoldMs) {    Serial.println("Decommissioning…");    OnOffLight.setOnOff(false);    Matter.decommission();    btn_ts =millis();  }}
You must be logged in to vote

Replies: 5 comments

Comment options

@SuGlider PTAL

You must be logged in to vote
0 replies
Comment options

ESP32-C6: OpenThread init fails in Arduino Core 3.3.0 (IDF 5.5) due to missing eventfd/select in core build

Repro (ESP32-C6, Arduino Core 3.3.0 / IDF 5.5):

  • Boards Manager:Zigbee Mode = Off

  • build_opt.h:

    -DCHIP_DEVICE_CONFIG_ENABLE_WIFI=0-DCHIP_DEVICE_CONFIG_SOC_WIFI_SUPPORTED=0-DCHIP_DEVICE_CONFIG_ENABLE_THREAD=1-DCONFIG_ENABLE_CHIPOBLE=1-DINET_CONFIG_ENABLE_IPV4=0-DINET_CONFIG_ENABLE_IPV6=1
  • Core compile flags (.../esp32c6/flags/defines) include:

    -DOPENTHREAD_FTD=1-DOPENTHREAD_CONFIG_FILE="openthread-core-esp32x-ftd-config.h"

    butdo not include:

    -DCONFIG_VFS_SUPPORT_SELECT=1-DCONFIG_ESP_EVENTFD=1

Runtime:

E (xxxx) OPENTHREAD: esp_openthread_task_queue_init(...): Failed to create OpenThread task queue event fdE (xxxx) OPENTHREAD: esp_openthread_platform_init(...): esp_openthread_task_queue_init failedassert failed: modem_clock_device_disable modem_clock.c:236 (refs >= 0)

Hypothesis / root cause:
OpenThread port on ESP requireseventfd +select() (i.e.,esp_vfs_eventfd_register()) before OT init. The current Arduino core for ESP32-C6 appears to be builtwithoutCONFIG_VFS_SUPPORT_SELECT andCONFIG_ESP_EVENTFD, so OT init fails and the cleanup path trips the modem clock refcount assert.

Request:
Please provide a C6/H2 core build with the following Kconfig options enabled (preview/nightly is fine). I can test binaries immediately.

# 802.15.4 + OpenThreadCONFIG_IEEE802154_ENABLED=yCONFIG_OPENTHREAD_ENABLED=yCONFIG_OPENTHREAD_RADIO_NATIVE=yCONFIG_OPENTHREAD_FTD=y          # (or MTD if preferred)# VFS / eventfd (fixes the crash)CONFIG_VFS_SUPPORT_SELECT=yCONFIG_ESP_EVENTFD=y# Network for Matter over ThreadCONFIG_LWIP_IPV6=yCONFIG_LWIP_IPV4=n# Matter / CHIPCONFIG_ENABLE_MATTER_OVER_THREAD=yCONFIG_ENABLE_CHIPOBLE=y# Disable radio competitors in this buildCONFIG_ZB_ENABLED=nCONFIG_WIFI_ENABLED=n

Notes:

  • The presence of-DOPENTHREAD_FTD=1 inflags/defines shows OT libs are linked, but withouteventfd/select the platform init cannot create the task queue FD.
  • Target:ESP32-C6 (Thread via native 802.15.4), BLE on, Wi-Fi off, IPv6-only.
  • Happy to validate a preview Boards Manager package or drop-inesp32-arduino-libs archive.
You must be logged in to vote
0 replies
Comment options

ESP-Matter code will select the Netowrk in a specific order: WiFi -> Thread -> ETH.
Given that C6 has WiFi enabled, it will always start it.

It is possible to create a C6 Matter Application using Arduino Matter API + Thread using Arduino as IDF Component.
Anyway anew issue has been create to track it.

You must be logged in to vote
0 replies
Comment options

@adm1nsys

This is how Matter over Thread shall be bulit using the ESP32-C6:

1- Install IDF 5.5.0 into your computer. It can be done following the guide inhttps://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/get-started/index.html

For Windows:https://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/get-started/index.html
For Linux or MacOS:https://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/get-started/linux-macos-setup.html

2- Test IDF with idf.py --version to check if it is installed and configured correctly. It shall outputESP-IDF v5.5

3- Clone the repository with the Arduino as IDF Component project.
git clonehttps://github.com/SuGlider/Arduino_ESP-Matter-over-Thread_ESP32-C6

4- Open an IDF terminal and execute idf.py set-target esp32c6

5- Execute idf.py -p <your COM or /dev/tty port connected to the ESP32-C6> flash monitor

6- It will build, upload and show the UART0 output in the screen.

7- Try to add the Matter RGB light to your Matter environment.

You must be logged in to vote
0 replies
Comment options

For the records, there is a Matter over Thread example for C6/C5/H2 in
https://github.com/espressif/arduino-esp32/tree/master/idf_component_examples/Arduino_ESP_Matter_over_OpenThread

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@adm1nsys@SuGlider@P-R-O-C-H-Y

[8]ページ先頭

©2009-2025 Movatter.jp