Hello,
I am implementing Fan Device (provisional) on nRF52840 with Matter over Thread. I implemented Fan Device Endpoint and Cluster with ZAP tool according to Adding clusters to Matter Application. Clusters and Attributes were set as default.
I created zcl_callbacks.cpp and implemented the MatterPostAttributeChangeCallback() function. To check the operation, I added only the code that outputs the log in the function called in app_task.cpp.
zcl_callbacks.cpp (excerpt):
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath& attributePath, uint8_t type, uint16_t size, uint8_t* value)
{
ClusterId clusterId = attributePath.mClusterId;
AttributeId attributeId = attributePath.mAttributeId;
if (clusterId != FanControl::Id)
{
return;
}
switch (attributeId)
{
case FanControl::Attributes::FanMode::Id:
AppTask::Instance().FanModeChanged(static_cast<FanControl::FanModeType>(*value));
break;
case FanControl::Attributes::FanModeSequence::Id:
AppTask::Instance().FanModeSequenceChanged(static_cast<FanControl::FanModeSequenceType>(*value));
break;
case FanControl::Attributes::PercentSetting::Id:
AppTask::Instance().PercentSettingChanged(*value);
break;
default:
return;
}
}
app_task.cpp (excerpt):
void AppTask::FanModeChanged(const Clusters::FanControl::FanModeType type)
{
LOG_INF("FanMode: %d", (uint8_t) type);
}
void AppTask::FanModeSequenceChanged(const Clusters::FanControl::FanModeSequenceType type)
{
LOG_INF("FanModeSequence: %d", (uint8_t) type);
}
void AppTask::PercentSettingChanged(const uint8_t percent)
{
LOG_INF("Percent: %d", percent);
}
I used a configuration based on prj_no_dfu.conf that added log output.
#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# This sample uses Kconfig.defaults to set options common for all
# samples. This file should contain only options specific for this sample
# or overrides of default values.
# Enable CHIP
CONFIG_CHIP=y
CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
CONFIG_CHIP_PROJECT_CONFIG="src/chip_project_config.h"
# 32768 == 0x8000 (example Product ID added temporaly,
# but it must be changed with proper PID from the list:
# https://github.com/project-chip/connectedhomeip/blob/482e6fd03196a6de45465a90003947ef4b86e0b1/docs/examples/discussion/PID_allocation_for_example_apps.md)
CONFIG_CHIP_DEVICE_PRODUCT_ID=32768
CONFIG_STD_CPP14=y
# Add support for LEDs and buttons on Nordic development kits
CONFIG_DK_LIBRARY=y
# Bluetooth Low Energy configuration
CONFIG_BT_DEVICE_NAME="MatterTemplate"
# Other settings
CONFIG_THREAD_NAME=y
CONFIG_MPU_STACK_GUARD=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_CHIP_LIB_SHELL=y
# Disable NFC commissioning
CONFIG_CHIP_NFC_COMMISSIONING=n
# Disable Matter OTA DFU
CONFIG_CHIP_OTA_REQUESTOR=n
# Disable QSPI NOR
CONFIG_CHIP_QSPI_NOR=n
# Reduce application size
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_MODE_IMMEDIATE=y
The build has completed successfully. I wrote the binary to nRF52840.
Following the Matter: Template article, I used an iPhone 8 to commission the nRF52840 to a Matter network with an Apple TV 4K configured as a Border Router. This also completed successfully and was recognized as a Fan Device by the iPhone.
However, the Fan Device control does not work properly. When turning on/off or adjusting airflow, the device frequently goes into a "no response" state and does not accept any operations for a certain period of time. Ican switch it on/off after a certain period of time (if you leave it for a certain period of time, it will become "no response" again and you will not be able to switch it. Looking at the logs, it seems that the CASE session is being restarted). The air volume adjustment remains in a "no response" state and is almost impossible to operate.
As a side note, perhaps the entire Matter over Thread network is malfunctioning, but when the Fan Device is "no response" and I operate the Nanoleaf Essentials Bulb that is participating in the Matter network, it also becomes "no response".
When I wrote the Matter: Light bulb sample to the nRF52840 as is and made it work, it did not become "no response" and worked normally.
I can't find the cause by looking at the logs and sources myself. Is it because the Fan Device is provisional that it does not work properly?
How can I resolve this issue?
- Development PC
- OS: Windows 10
- SDK: nRF Connect SDK 2.5.0
- ZAP tool: v2024.01.20
- Microcontroller
- nRF52840
- Border Router
- Apple TV 4K Wi-Fi + Ethernet (tvOS 17.3)
- Matter Controller
- iPhone 8 (iOS 16.3)