cancel
Showing results for 
Search instead for 
Did you mean: 

How to put Matter Device into Sleep Mode

AkihiroN
Associate III

We are developing a Matter device using X-CUBE-MATTER.
When we set CFG_FULL_LOW_POWER to 1 to enable sleep mode, pressing B1 for 10 seconds does not enter Factory Reset and BLE advertising is not executed.
When we checked the current consumption, it seems to be in sleep mode, but because BLE advertising is not executed, commissioning is not possible.
Please tell me the solution or the specification.
The development environment is described below.
Hardware: STM32WB5MMG-DK
Firmware: Window-App-SBSFU
X-CUBE-MATTER Version: 1.1
Implementation CFG_FULL_LOW_POWER is set to 1

12 REPLIES 12
EPASZ.1
ST Employee

Hello,

in app_conf.h where you are setting CFG_FULL_LOW_POWER 1, there is also this code below.

2024-10-09 09_22_57-app_conf.h - STM32CubeExpansion_MATTER_V1.1.0 - Visual Studio Code.png

Which means that buttons are not used at all. You can simply change this define to enable them.

Thank you very much.
So, if the buttons are not available when CFG_FULL_LOW_POWER is enabled, how does Factory do it? Also, how is Advertising done?

EPASZ.1
ST Employee

As I said above you can change the above defines so that the buttons are active with low power. Then after rebuilding, you can use button1 to do factory reset and advertise.

With the default settings, factory reset cannot be done in low power mode.

 

Thank you.
I understand.
However, I still cannot commission Window-App-SBSFU.
Is it only possible to use Sleep Mode with Generic-Switch-App?

I noticed one thing: even in the xxx-App-SBSFU project, if you comment out UTIL_LPM_SetStopMode(1 << CFG_LPM_APP_THREAD, UTIL_LPM_ENABLE);, you can confirm that commissioning is possible with CFG_FULL_LOW_POWER = 1. However, I think this does not put it into Sleep Mode. Please provide a solution.

EPASZ.1
ST Employee

It is possible that in low power modes, the device is not communication fast enough with the OTBR to do the commissioning.

In such case, you can disable the LP modes by commenting out the UTIL_LPM command in app_entry and then enable them again inside AppTask::Init() (if the device is already commissioned on boot)EPASZ1_0-1730880532395.png

+ inside AppTask::MatterEventHandler (when the commissioning is finished)

EPASZ1_1-1730880636153.png

You could go a step further by enabling it at the start and disabling it on BLE connection (that's the start of commissioning) but that's up to you.

Thank you for your reply.
If I want to implement it as follows, how should I modify it?

Condition 1: If commissioning has not been performed
When the device starts up, disable Sleep Mode and execute Advertising
When the Advertising time is over, enable Sleep Mode
If commissioning is performed and the connection is successful, enable Sleep Mode

Condition 2: If commissioning has been performed
When the device starts up, enable Sleep Mode

Also, isn't the ICD Management Cluster essential for putting the Matter device into Sleep Mode?

EPASZ.1
ST Employee

Most is covered by what I wrote in my previous post. To enable LP modes after BLE advertising is over, you need to copy/replace the 3 attached files and then register some callbacks in AppTask::Init()

APP_MATTER_BLE_Set_Advertising_Callback((BLEFastAdvertisingCallback) BleAdvFastHandle, (BLESlowAdvertisingCallback) BleAdvSlowHandle, (BLEStopAdvertisingCallback) BleAdvStopHandle);
Define BleAdvStopHandle callback so that it enable the LP mode like above.
No, ICD cluster only lets the controller know that the device uses LP modes. This is defined inside CHIPProjectConfig.h. Default values are used, but it generally works well because Run/LP modes are managed by FreeRTOS.