Bug in Matter Light_Bulb Example on nRF52840 Development Board

Dear Nordic Support Team,

I am currently using the nRF52840 development board and working on developing a dimmer switch. During the development process, I encountered a bug. I have tried updating the SDKs to resolve the issue, but even after upgrading to SDK version 2.9, the problem persists.

Here is the issue:
When running the Matter light_bulb example without making any modifications and flashing it to the development board, the dimming and on/off functionality work perfectly when controlled through the Apple HomeKit app. However, the issue occurs in the following scenario:

  1. I turn off the light using the HomeKit app.
  2. Then, I turn it back on using the physical button on the development board.

In this case, the light turns on at 1% brightness, but the HomeKit app incorrectly shows the brightness level as 100%.

This issue has been present since SDK version 2.5 and persists in version 2.9. Despite my efforts, I have not been able to resolve it.

Could you please provide guidance or a solution to address this issue?

Thank you for your support.

Parents
  • Hi Marte,

    Thank you for your response.

    I’ve been trying to retrieve the application logs from my nRF52840 development board but haven’t been successful so far. I attempted to use Segger RTT Viewer for this purpose, but I couldn’t get it to work.

    Could you please guide me on how to properly retrieve hardware logs from the device? Any specific steps or recommendations would be greatly appreciated.

    Looking forward to your advice.

    Best regards,

  • Hi,

    The Matter samples use UART for logging by default, so you should be able to see the log in a terminal emulator. Some options we provide are the Serial Terminal app in nRF Connect for Desktop or using the terminal in our nRF Connect for VS Code extension. You can also use other programs such as PuTTy, TeraTerm, Picocom, etc.

    Our documentation provides more detailed information about logging here: Testing and optimization.

    Best regards,
    Marte

  • Hi,

    How are you turning the LED off in Apple Homekit? Based on the log, it seems like you are turning it off by dimming it instead of toggling it. This will cause the brightness to be 1 just before it's turned off. Pressing button 2 will cause the LED to toggle to the previous state, which in this case would be turned on with a brighness of 1%.

    Here you can see that the brightness is reduced from 254 to 1, and finally turned off:

    [05:21:08.449,493] <inf> chip: [ZCL]Event: move from 254
    [05:21:08.472,503] <inf> chip: [ZCL] to 1 
    [05:21:08.494,720] <inf> chip: [ZCL](diff -1)
    [05:21:08.515,716] <inf> chip: [ZCL]Cluster LevelControl: attribute CurrentLevel set to 1
    [05:21:08.540,466] <inf> app: Level Action has been initiated
    [05:21:08.562,652] <inf> app: Setting brightness level to 1
    [05:21:08.584,716] <inf> app: Level Action has been completed
    [05:21:08.606,994] <inf> chip: [ZCL]Setting on/off to OFF due to level change
    [05:21:08.630,767] <inf> chip: [ZCL]Toggle ep1 on/off from state 1 to 0
    [05:21:08.673,431] <inf> chip: [ZCL]Cluster OnOff: attribute OnOff set to 0
    [05:21:08.697,021] <inf> app: Turn Off Action has been initiated
    [05:21:08.719,543] <inf> app: Turn Off Action has been completed

    Here it is turned on after pressing button 2, with CurrentLevel set to 1:

    [05:21:11.764,282] <inf> app: Turn On Action has been initiated
    [05:21:11.786,834] <inf> app: Turn On Action has been completed
    [05:21:11.809,417] <inf> app: Action is already in progress or active.
    [05:21:11.849,182] <inf> chip: [ZCL]Cluster OnOff: attribute OnOff set to 1
    [05:21:11.873,138] <inf> chip: [ZCL]Cluster LevelControl: attribute CurrentLevel set to 1

    Best regards,
    Marte

  • Hi Marte
    Thanks you for your fast response.

    I will also send you the logs for when I turn off the light via HomeKit toggle and then turn it back on using the physical button on the development board. You'll see that the same issue occurs again.

    That said, regardless of whether this problem persists, your point isn’t entirely accurate. No dimmer product remembers the last dimmed state (e.g., 1%) when turned off through the dimmer. Instead, it recalls the last state before dimming.

    Even assuming your argument is correct, why does the light turn on at 1% while HomeKit displays its status as 100%?

    [01:54:29.106,201] <inf> chip: [EM]>>> [E:18258r S:23797 M:242747526] (S) Msg RX from 1:000000007394C4FD [364F] --- Type 0001:08 (IM:InvokeCommandRequest)
    [01:54:29.137,420] <inf> chip: [ZCL]Toggle ep1 on/off from state 1 to 0
    [01:54:29.161,895] <inf> chip: [EM]<<< [E:18258r S:23797 M:27083915 (Ack:242747526)] (S) Msg TX to 1:000000007394C4FD [364F] --- Type 0001:09 (IM:InvokeCommandResponse)
    [01:54:29.193,847] <inf> chip: [IN](S) Sending msg 27083915 on secure session with LSID: 23797
    [01:54:29.220,947] <inf> chip: [ZCL]Event: move from 254
    [01:54:29.245,941] <inf> chip: [ZCL] to 1 
    [01:54:29.266,479] <inf> chip: [ZCL](diff -1)
    [01:54:29.287,506] <inf> chip: [ZCL]Cluster LevelControl: attribute CurrentLevel set to 1
    [01:54:29.312,225] <inf> app: Level Action has been initiated
    [01:54:29.334,442] <inf> app: Setting brightness level to 1
    [01:54:29.356,506] <inf> app: Level Action has been completed
    [01:54:29.378,784] <inf> chip: [ZCL]Setting on/off to OFF due to level change
    [01:54:29.402,526] <inf> chip: [ZCL]Toggle ep1 on/off from state 1 to 0
    [01:54:29.441,650] <inf> chip: [ZCL]Cluster OnOff: attribute OnOff set to 0
    [01:54:29.465,270] <inf> app: Turn Off Action has been initiated
    [01:54:29.487,762] <inf> app: Turn Off Action has been completed
    [01:54:29.510,467] <inf> chip: [ZCL]Off completed. reset OnTime to  0
    [01:54:29.533,660] <inf> chip: [ZCL]Cluster LevelControl: attribute CurrentLevel set to 254
    [01:54:29.565,979] <inf> chip: [EM]<<< [E:13241i S:23797 M:27083916] (S) Msg TX to 1:000000007394C4FD [364F] --- Type 0001:05 (IM:ReportData)
    [01:54:29.595,520] <inf> chip: [IN](S) Sending msg 27083916 on secure session with LSID: 23797
    [01:54:29.622,406] <inf> chip: [DMG]Refresh Subscribe Sync Timer with min 0 seconds and max 600 seconds
    [01:54:29.653,381] <inf> chip: [EM]>>> [E:18258r S:23797 M:242747527 (Ack:27083915)] (S) Msg RX from 1:000000007394C4FD [364F] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [01:54:29.686,828] <inf> chip: [EM]>>> [E:13241i S:23797 M:242747528 (Ack:27083916)] (S) Msg RX from 1:000000007394C4FD [364F] --- Type 0001:01 (IM:StatusResponse)
    [01:54:29.718,475] <inf> chip: [IM]Received status response, status is 0x00
    [01:54:29.742,797] <inf> chip: [EM]<<< [E:13241i S:23797 M:27083917 (Ack:242747528)] (S) Msg TX to 1:000000007394C4FD [364F] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [01:54:29.775,054] <inf> chip: [IN](S) Sending msg 27083917 on secure session with LSID: 23797
    [01:54:34.365,081] <inf> app: Turn On Action has been initiated
    [01:54:34.387,634] <inf> app: Turn On Action has been completed
    [01:54:34.410,217] <inf> app: Action is already in progress or active.
    [01:54:34.454,193] <inf> chip: [ZCL]Cluster OnOff: attribute OnOff set to 1
    [01:54:34.478,302] <inf> chip: [ZCL]Cluster LevelControl: attribute CurrentLevel set to 1
    [01:54:34.510,192] <inf> chip: [EM]<<< [E:13242i S:23797 M:27083918] (S) Msg TX to 1:000000007394C4FD [364F] --- Type 0001:05 (IM:ReportData)
    [01:54:34.539,978] <inf> chip: [IN](S) Sending msg 27083918 on secure session with LSID: 23797
    [01:54:34.567,413] <inf> chip: [DMG]Refresh Subscribe Sync Timer with min 0 seconds and max 600 seconds
    [01:54:34.612,030] <inf> chip: [EM]>>> [E:13242i S:23797 M:242747529 (Ack:27083918)] (S) Msg RX from 1:000000007394C4FD [364F] --- Type 0001:01 (IM:StatusResponse)
    [01:54:34.643,676] <inf> chip: [IM]Received status response, status is 0x00
    [01:54:34.667,999] <inf> chip: [EM]<<< [E:13242i S:23797 M:27083919 (Ack:242747529)] (S) Msg TX to 1:000000007394C4FD [364F] --- Type 0000:10 (SecureChannel:StandaloneAck)
    [01:54:34.700,225] <inf> chip: [IN](S) Sending msg 27083919 on secure session with LSID: 23797
    uart:~$

  • Hi,

    I have asked the developers about this, and I am waiting for a reply from them. I will get back to you early next week.

    Best regards,
    Marte

  • Hi,

    The developers have started looking into this. I will most likely have an update by Tuesday or Wednesday next week.

    Best regards,
    Marte

Reply Children
  • Thank you, Marte
    I am eagerly waiting for the developers' response so we can resolve this issue.

  • Hi,

    The developers ran some tests. They can confirm that the light does not turn on with a brightness of 100% when performing the same steps as you, but in their tests, the Apple Home app reported the brightness as between 1%-3% after turning it on with the button on the DK, and not 100% as you experience.

    When it comes to what is expected behavior, this is something that depends on your demands and can be changed in your implementation.

    In our sample, when the slider is down to 0%, we set the level to 0% and OnOff to 0. When button 2 is pressed, OnOff is changed to 1, but the level is still 0%. In the app, the developers see that this is shown as 1%, most likely because the app cannot show 0% as the light being turned on, so if OnOff is 1, i.e. the light is on, the app shows it as 1% instead.

    However, you can change the sample to match the behavior you expect and make the light turn on to 100% when the button is pressed rather than the previous level.

    Best regards,
    Marte

  • Thank you for your response.

    Actually, 

    If we set aside the dimming behavior of the system and focus only on the on/off functionality, the issue still persists. When the light is at 100% brightness and we turn it off using the toggle in the Apple Home app (not the slider), and then turn it back on using button 2 on the DK, the light should return to 100% brightness as it was before. However, the light turns on at 1% brightness, and we can only see a very dim glow on LED 2.

    If we also consider the dimming functionality, When we turn off the light at 50% brightness using the Apple Home app toggle and then turn it back on with the same toggle, the light correctly turns back on at 50% brightness. However, if we perform the same action using the physical button on the DK, the LED turns on at 1% brightness.

    Development on Matter examples should be based on a proper platform and correct implementation. I have customized the Light Bulb example to suit my needs, but I cannot resolve this specific issue. My expectation is that when the light is turned off from 100% brightness using the toggle and then turned back on with the physical button o n DK, it should turn on at 100% brightness, not at 1%.

  • Hi,

    Currently, only On Action or Off Actions are initiated in LightingActionEventHandler() upon a button press, but you can get it to set the brightness to 100% by initiating a Level Action, i.e. Nrf::PWMDevice::LEVEL_ACTION when the button is pressed. For example, in the Window Covering sample, InitiateAction() is called to set the level in window_covering.cpp#L248-L256.

    Best regards,
    Marte

Related