<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95127/testing-and-extensive-debugging-of-matter-based-application</link><description>Hello I am currently developing a custom Matter device (dimmer, to be exact) with UI (buttons and buzzer) and using Matter Template app as a foundation for my code. Right now, I have a working device with required functionality, but during testing with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Jan 2023 12:50:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95127/testing-and-extensive-debugging-of-matter-based-application" /><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/404799?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 12:50:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:096896ed-b3dd-4294-9c7a-d8472a19af0d</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Great to hear that the issue with freezing has been resolved. I have notified the developers that you are also experiencing the same problem as in the Github issue.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/404647?ContentTypeID=1</link><pubDate>Thu, 12 Jan 2023 19:29:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:848e6de3-703a-4734-96fb-fda0b7ab0ccf</guid><dc:creator>Denys Kalynichenko</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;Sorry for long waiting time.&lt;br /&gt;It seems that I had problems&amp;nbsp;with the&amp;nbsp;version of my SDK. I am using NCS v2.2.0, and I was using it during problem occurrence, but after force update of SDK (through toolchain manager &amp;#39;Update SDK&amp;#39; option) I can no longer observe long freezes.&lt;br /&gt;Another reason of why I have my problem fixed can be related to my properly executed deferred attribute assignment to CurrentLevel attribute.&lt;br /&gt;&amp;quot;Light bulb&amp;quot; example during my tests was behaving properly too.&lt;br /&gt;Although I am noticing the same behaviour as in mentioned issue on Github (very long command execution does not have accurate execution time, in my case for 10sec command has ~12sec execution), it is not as critical as random long freezes I had previously.&lt;br /&gt;Thank you for attention and for guidance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/402920?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 09:48:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fc4ead4-f9ef-4dc4-a70e-bc38b6a341ad</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have not been able to reproduce this issue yet.&lt;/p&gt;
&lt;p&gt;I asked the developers, and the only issue they are aware of is the following, where Matter&amp;#39;s MoveToLevel implementation is broken due to assuming that a single tick takes a very short time, which is usually not the case on constrained devices:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/project-chip/connectedhomeip/issues/24193"&gt;https://github.com/project-chip/connectedhomeip/issues/24193&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This issue might be causing the MoveToLevel command to execute for much longer than specified in the argument.&lt;/p&gt;
&lt;p&gt;Can you test with the light bulb sample and see if you are able to reproduce the issue there?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/402473?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2022 21:52:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d63aadb1-66c2-4331-afba-c670af222eff</guid><dc:creator>Denys Kalynichenko</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;I should have said this earlier, but I am noticing this behavior only sometimes, less frequently with dimmer algorithm off. To replicate it, I am sending Move To Level command each time the last one successfully finishes its execution. The number of consecutive Move To Level commands is random: in general there are 2-10 commands between freezes. Also, I specifically used different time intervals between commands (up to a minute between commands)&lt;br /&gt;&lt;br /&gt;My application handler, each time it is called by &lt;em&gt;MatterPostAttributeChangeCallback&lt;/em&gt;, calls:&lt;br /&gt;- start of PWM generation for buzzer (PWM generation is stopped through k_timer timeout callback); after PWM generation stop k_timer instance starts again for the same period for blanking period, when buzzer cannot be controlled.&lt;br /&gt;- configuring parameters for my dimmer algorithm, which uses beforementioned peripherals. PPI channels used are allocated through&amp;nbsp;&lt;em&gt;nrfx_ppi_channel_alloc&lt;/em&gt; function;&lt;br /&gt;- my application also uses address LEDs, I2C devices and UART for logging, peripherals used for this functionality are UART0, SPI2 and TWI1 (specifically assigned so that there is no shared registed addresses between them)&lt;br /&gt;&lt;br /&gt;During these application freezes every possible app functionality is broken: &lt;br /&gt;- buzzer call function is not called&lt;br /&gt;- dimmer algorithm, that uses EGU0 IRQ handler with priority 2 for synchronization with input signal, loses synchronization&lt;br /&gt;&lt;br /&gt;I tested again with&amp;nbsp;&lt;span&gt;&amp;nbsp;CONFIG_LOG_MODE_IMMEDIATE=y and noticed the same behaviour (I am using Termite as a COM port terminal, so there is no colors or font changes).&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:13.637,969] [1B][0m&amp;lt;dbg&amp;gt; chip: LogV: [DMG]Endpoint 1, Cluster 0x0000_0005 update version to bad3b254[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:13.649,902] [1B][0m&amp;lt;dbg&amp;gt; chip: LogV: [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 5012241e[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:13.661,865] [1B][0m&amp;lt;inf&amp;gt; chip: [ZCL]Event: move from 146[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:13.669,952] [1B][0m&amp;lt;inf&amp;gt; chip: [ZCL] to 145 [1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:13.676,879] [1B][0m&amp;lt;inf&amp;gt; chip: [ZCL](diff -1)[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:15.436,401] [1B][0m&amp;lt;dbg&amp;gt; chip: LogV: [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 5012241f[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:15.448,211] [1B][0m&amp;lt;inf&amp;gt; app: current uptime 435448[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:15.455,718] [1B][0m&amp;lt;inf&amp;gt; app: setting new dimmer brightness 0..254 145[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:15.464,843] [1B][0m&amp;lt;inf&amp;gt; buzzer: called? 0[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:15.471,893] [1B][0m&amp;lt;dbg&amp;gt; chip: LogV: [DMG]Endpoint 1, Cluster 0x0000_0005 update version to bad3b255[1B][0m
[1B][1;32muart:~$ [1B][m[1B][8D[1B][J[00:07:15.483,825] [1B][0m&amp;lt;dbg&amp;gt; chip: LogV: [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 50122420[1B][0m&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/402379?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2022 09:16:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee2c5b8c-da98-4c3a-93e0-8fba12af0cf0</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Denys,&lt;/p&gt;
&lt;p&gt;Thank you for the explanation on how you have tested. I&amp;nbsp;am not able to test this today myself, but I will try to reproduce it and test tomorrow.&lt;/p&gt;
&lt;p&gt;How are you checking/verifying that the application freezes? Is this based on the timing from the logs (such as with &amp;quot;current uptime %lld&amp;quot;, k_uptime_get()), or are you seeing it from other behavior as well? Unless you have configured otherwise, logs will be buffered and processed at a later time.&amp;nbsp;You can test by making the application log immediately in the context of the call by setting&amp;nbsp;CONFIG_LOG_MODE_IMMEDIATE=y.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/402315?ContentTypeID=1</link><pubDate>Tue, 27 Dec 2022 14:57:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:704269bf-d91d-4135-b37c-9075600d1324</guid><dc:creator>Denys Kalynichenko</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;Thank you for your attention. I tried to resolve this issue myself and tried to use different options available for debugging, although with no success.&lt;br /&gt;Here I will publish current findings.&lt;br /&gt;I added&amp;nbsp;additional clusters and supplemented code to my Matter app using guide &amp;#39;Adding clusters to Matter application&lt;em&gt;&amp;#39;&amp;nbsp;&lt;/em&gt;&amp;nbsp;(&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/nrf/ug_matter_gs_adding_clusters.html)"&gt;developer.nordicsemi.com/.../ug_matter_gs_adding_clusters.html&lt;/a&gt;)&amp;nbsp;as a reference. The code I used to push changed attribute values to my application is below:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;app_task.h&amp;quot;

#include &amp;lt;app-common/zap-generated/ids/Attributes.h&amp;gt;
#include &amp;lt;app-common/zap-generated/ids/Clusters.h&amp;gt;
#include &amp;lt;app/ConcreteAttributePath.h&amp;gt;
#include &amp;lt;app-common/zap-generated/attributes/Accessors.h&amp;gt;



using namespace ::chip;
using namespace ::chip::app::Clusters;



void MatterPostAttributeChangeCallback(
    const chip::app::ConcreteAttributePath &amp;amp; attributePath,
    uint8_t type, uint16_t size, uint8_t * value)
{
    AppEvent event;
    ClusterId clusterId = attributePath.mClusterId;
	AttributeId attributeId = attributePath.mAttributeId;
    if (clusterId == OnOff::Id &amp;amp;&amp;amp; attributeId == OnOff::Attributes::OnOff::Id)
    {

        event.Type = AppEventType::DimmerOnOff;
        event.DimmerEvent.State = *value;
        event.Handler = AppTask::DimmerCHIPControl;
        AppTask::Instance().PostEvent(event);
    }
    else if (clusterId == LevelControl::Id &amp;amp;&amp;amp; attributeId == LevelControl::Attributes::CurrentLevel::Id)
    {
        bool onoff;
        OnOff::Attributes::OnOff::Get(attributePath.mEndpointId, &amp;amp;onoff);
        if (onoff)
        {
            event.Type = AppEventType::DimmerLevelControl;
            event.DimmerEvent.NewLevel = *value;
            event.Handler = AppTask::DimmerCHIPControl;
            AppTask::Instance().PostEvent(event);
        }

    }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;My application handler to Matter attribute change:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void AppTask::DimmerCHIPControl(const AppEvent &amp;amp;event)
{
	LOG_INF(&amp;quot;current uptime %lld&amp;quot;, k_uptime_get());
	uint8_t buzzer_duration;
	if (event.Type == AppEventType::DimmerOnOff)
	{

		sCh0IsOn = event.DimmerEvent.State;
		buzzer_duration = 100U;
	}
	if (event.Type == AppEventType::DimmerLevelControl)
	{
		buzzer_duration = 50U;
		sCh0Brightness = event.DimmerEvent.NewLevel;
		LOG_INF(&amp;quot;setting new dimmer brightness 0..254 %d&amp;quot;, sCh0Brightness);
	}
	buzzer_squeak(BUZZER_STANDARD_VOLUME, buzzer_duration);
	leds[LED_CH0].channelState = sCh0IsOn;
	dimmer_brightness_set(sCh0Brightness*4U + 1U);
	dimmer_state_set(sCh0IsOn);
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;My test setup consists of precompiled chip-tool app on Ubuntu 20.04 VM and OTBR in Docker on the same VM, which works fine. This reported issue appears during pushing commands like &amp;#39;move-to-level&amp;#39; (level control cluster) with non-zero transition time:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;./chip-tool-release levelcontrol move-to-level 20 2 0 0 222 1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Currently, I&amp;#39;m outputting logs into my serial terminal (115200 baud rate), using CONFIG_MATTER_LOG_LEVEL_DEBUG.&lt;br /&gt;In my logs, that I attached below, I can see that I have ~1.5sec delay between consecutive attribute change callbacks:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;D: 1007718 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529ae
I: 1007725 [ZCL]Event: move from 173
I: 1007728 [ZCL] to 172 
I: 1007730 [ZCL](diff -1)
D: 1007750 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529af
I: current uptime 1007756
I: setting new dimmer brightness 0..254 172
D: 1007764 [DMG]Endpoint 1, Cluster 0x0000_0005 update version to 108217c8
D: 1007771 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529b0
I: 1007777 [ZCL]Event: move from 172
I: 1007781 [ZCL] to 171 
I: 1007783 [ZCL](diff -1)
D: 1007802 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529b1
I: current uptime 1007809
I: setting new dimmer brightness 0..254 171
D: 1007816 [DMG]Endpoint 1, Cluster 0x0000_0005 update version to 108217c9
D: 1007823 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529b2
I: 1007830 [ZCL]Event: move from 171
I: 1007833 [ZCL] to 170 
I: 1007835 [ZCL](diff -1)
D: 1009510 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529b3
I: current uptime 1009517
I: setting new dimmer brightness 0..254 170
D: 1009524 [DMG]Endpoint 1, Cluster 0x0000_0005 update version to 108217ca
D: 1009531 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529b4
I: 1009538 [ZCL]Event: move from 170
I: 1009541 [ZCL] to 169 
I: 1009544 [ZCL](diff -1)
D: 1009562 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 445529b5
I: current uptime 1009569
I: setting new dimmer brightness 0..254 169
D: 1009577 [DMG]Endpoint 1, Cluster 0x0000_0005 update version to 108217cb&lt;/pre&gt;&lt;br /&gt;I tried to use different methods to debug and see what is going on during these 1.5 seconds of app &amp;#39;freeze&amp;#39;:&lt;br /&gt;- standard debugging via VS Code debugging is not viable because any breakpoint or CPU halt will crash my application without any useful data.&lt;br /&gt;- I tried to implement SEGGER SystemView (as Monitor Mode Debugging is not supported by NCS), but connection with my target crashes every time my device receives Matter command (J-Link SystemView overflow).&lt;br /&gt;&lt;br /&gt;Dimmer driver uses 1 software interrupt called by pin change every 10ms, timing functions showed execution time ~50us. It uses NRFX drivers to configure hardware peripherals.&amp;nbsp;Resources allocated: PPI channel 15, GPIOTE, TIMER0 and EGU0.&lt;br /&gt;&lt;br /&gt;Buzzer driver uses one k_timer instance for timing the start and the end of PWM generation for buzzer. PWM generation uses standard PWM driver.&lt;br /&gt;&lt;br /&gt;Buttons, LEDs etc. do not affect this issue, as I already tested my app without initialised peripheral handling and still observed this behavior.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m waiting for your response.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Best wishes,&lt;br /&gt;Denys&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing and extensive debugging of Matter-based application</title><link>https://devzone.nordicsemi.com/thread/402301?ContentTypeID=1</link><pubDate>Tue, 27 Dec 2022 14:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83ed3edb-daf7-4f5d-97b2-ace20573f7e3</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have started looking into your issue and will get back to you tomorrow.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>