It failed to run attributes set function in the timer callback handler.

Software version: nRF CONNECT SDK v2.4.2.  Project: Matter light bulb

I have created a soft timer, and defined a function named "autoAdjustPWMLevel" as callback handler, like the pic shows.

Everything is fine but when I want to set the attribute value and call this "Set" function, it run wrong even if it compile and build normally.

chip::app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::Set()

Parents Reply Children
  • It can not set the attribute rightly, and it can not be commissioned into Matter Network normally. The most obvious phenomenon is that the LED0(which indicates the Thread network status) no longer blink. It looks like that the main program isn't normal, but it doesn't crash. 

  • Could you upload your project so that I can test it at my end?

  • I have uploaded my code to https://github.com/L1amaGod/Light_bulb .  My app codes are in gl-inet/gl_app.cpp. Please help me have a look, thank you so much!!!

  • Just focus on the Line 106 ~ 108 in gl-inet/gl_app.cpp( github.com/.../gl_app.cpp ). When I uncomment these three lines, it will cause some problems like what I said before.

  • I am not able to compile your project when I try to compile it similar to the light_bulb. 

    === child image mcuboot -  begin ===
    loading initial cache file E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/child_image_preload.cmake
    -- Application: E:/ncs/v2.4.2/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.20.5
    Loading Zephyr default modules (Zephyr base).
    -- Found Python3: E:/ncs/toolchains/v2.3.0/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
    -- Cache files will be written to: E:/ncs/v2.4.2/zephyr/.cache
    -- Zephyr version: 3.3.99 (E:/ncs/v2.4.2/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.15.2 (E:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.2 (E:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found Dtc: E:/ncs/toolchains/v2.3.0/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: E:/ncs/v2.4.2/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay
    -- Generated zephyr.dts: E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/zephyr/dts.cmake
    Parsing E:/ncs/v2.4.2/modules/lib/matter/config/nrfconnect/chip-module/Kconfig.mcuboot.root
    Loaded configuration 'E:/ncs/v2.4.2/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration 'E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/child_image/mcuboot/prj.conf'
    Merged configuration 'E:/ncs/v2.4.2/nrf/subsys/partition_manager/ext_flash_mcuboot_secondary.conf'
    Merged configuration 'E:/ncs/v2.4.2/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration 'E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to 'E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/zephyr/.config'
    Kconfig header saved to 'E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: e:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38") 
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: E:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Warning at E:/ncs/v2.4.2/nrf/lib/flash_patch/CMakeLists.txt:8 (message):
      
    
            ----------------------------------------------------------
            --- WARNING: To maintain the integrity of secure boot, ---
            --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---
            ----------------------------------------------------------
    
    
    CMake Warning at E:/ncs/v2.4.2/zephyr/CMakeLists.txt:839 (message):
      No SOURCES given to Zephyr library: lib__libc__common
    
      Excluding target from build.
    
    
    MCUBoot bootloader key file: E:/ncs/v2.4.2/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/build/mcuboot
    === child image mcuboot -  end ===
    
    CMake Warning at E:/ncs/v2.4.2/nrf/modules/mcuboot/CMakeLists.txt:310 (message):
      
    
              ---------------------------------------------------------
              --- WARNING: Using default MCUBoot key, it should not ---
              --- be used for production.                           ---
              ---------------------------------------------------------
              
    
    
    
    CMake Warning at E:/ncs/v2.4.2/nrfxlib/openthread/cmake/extensions.cmake:113 (message):
       
       Current nrf_security configuration does not provide all MBEDTLS options which are required by precompiled OpenThread libraries.
       The minimum of MBEDTLS configuration is stored at: E:/ncs/v2.4.2/nrfxlib/openthread/lib/cortex-m4/hard-float/v1.3/ftd/oberon/nrf_security_mbedtls_configuration.h
    
    Call Stack (most recent call first):
      E:/ncs/v2.4.2/nrfxlib/openthread/CMakeLists.txt:82 (check_openthread_dependencies)
    
    
    CMake Warning at E:/ncs/v2.4.2/zephyr/CMakeLists.txt:839 (message):
      No SOURCES given to Zephyr library: lib__libc__common
    
      Excluding target from build.
    
    
    CMake Warning at E:/ncs/v2.4.2/zephyr/CMakeLists.txt:1865 (message):
      __ASSERT() statements are globally ENABLED
    
    
    -- Found partition manager static configuration: E:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml
    Partition 'mcuboot' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_pad' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary_app' is not included in the dynamic resolving since it is statically defined.
    Partition 'settings_storage' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_secondary' is not included in the dynamic resolving since it is statically defined.
    -- Configuring done
    CMake Error at E:/ncs/v2.4.2/zephyr/cmake/modules/extensions.cmake:424 (add_library):
      Cannot find source file:
    
        //callback-stub.cpp
    Call Stack (most recent call first):
      E:/ncs/v2.4.2/zephyr/cmake/modules/kernel.cmake:210 (zephyr_library_named)
      E:/ncs/v2.4.2/zephyr/cmake/modules/zephyr_default.cmake:124 (include)
      E:/ncs/v2.4.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      E:/ncs/v2.4.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:30 (find_package)
    
    
    -- Generating done
    CMake Generate step failed.  Build files cannot be regenerated correctly.
    FATAL ERROR: command exited with status 1: 'E:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' -DWEST_PYTHON=E:/ncs/toolchains/v2.3.0/opt/bin/python.exe '-Be:\ncs\v2.4.2\nrf\samples\matter\Light_bulb-main\build' -GNinja -DBOARD=nrf52840dk_nrf52840 -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DBOARD_ROOT:STRING=e:/ncs/v2.4.2/nrf/samples/matter/light_bulb-main -DCONF_FILE:STRING=e:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/prj.conf -DDTC_OVERLAY_FILE:STRING=e:/ncs/v2.4.2/nrf/samples/matter/Light_bulb-main/boards/nrf52840dk_nrf52840.overlay '-Se:\ncs\v2.4.2\nrf\samples\matter\Light_bulb-main'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

Related