This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[Update Zigbee SDK] Problem when update from zigbee and thread 4.1.0 to zigbee and thread 4.2.0

Hi guys,

I have a question about migration guide from the old 4.1.0 thread and zigbee sdk to 4.2.0.

The story is that I have this project running 4.1.0 on my custom board with some bugs that seems to be fixed in 4.2.0 due to the release note. When I tried to update the SDK by pasting the new SDK in and then change SDK config as well as the makefile. For some more relevant context, the code I used as reference is the zigbee example light bulb to modify the project but after I successfully compile and flash the device, in zigbee_default_signal_handler I receive signal ID 22 which is the device can sleep signal but in the init system I have put it as router role. I also update the zigbee_helpers.c with

ZB_ERROR_CHECK(zb_zcl_set_backward_comp_mode(ZB_ZCL_AUTO_MODE));

ZB_ERROR_CHECK(zb_zcl_set_backward_compatible_statuses_mode(ZB_ZCL_STATUSES_ZCL8_MODE));

And as far as I know the this signal is only trigger when calling zb_sleep_now in the old SDK. So my question is that in the new SDK is there any part to be consider when init the system to not accidently trigger this behavior.

Thank you for any helps,

Best regards,

Tu

Parents Reply Children
  • Thank you for your support I will attach the SDK config files and makefile for you to check if there are any configuration should be made

    0726.app_config.h1307.sdk_config.h

    PROJ_DIR         := .
    COMPONENT_DIR    := $(PROJ_DIR)/components
    SRC_DIR          := $(PROJ_DIR)/main
    SDK_ROOT         := $(PROJ_DIR)/nrf_sdk_zigbee
    SDK_VERSION      := $(shell sed -n '1p' $(SDK_ROOT)/documentation/release_notes.txt | egrep -o "([0-9]+\.[0-9]+\.[0-9]+)")
    PROJECT_NAME     := $(shell basename "$(realpath $(PROJ_DIR))")
    OUTPUT_DIRECTORY := _build
    DATE             := $(shell git log -1 --format=%cd --date=format:"%Y%m%d")
    TAG_COMMIT       := $(shell git rev-list --abbrev-commit --tags --max-count=1)
    TAG              := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
    COMMIT           := $(shell git rev-parse --short HEAD)
    VERSION          := $(TAG:v%=%)
    
    ifeq ($(VERSION),)
    	VERSION := $(COMMIT)
    else
    ifneq ($(COMMIT), $(TAG_COMMIT))
    	VERSION := $(VERSION)-next-$(COMMIT)
    endif
    endif
    
    ifneq ($(shell git status --porcelain --ignore-submodules),)
    	VERSION := $(VERSION)-dirty
    endif
    
    NRF_IC           := nrf52833
    IC_NUM           := $(shell echo ${NRF_IC} | egrep -o "([0-9]+)")
    TARGETS          := nrf52833_xxaa
    TARGET_RELEASE   := $(TARGETS)_release
    TARGET_DEBUG     := $(TARGETS)_debug
    
    # Print some helpful info about what the user is compiling for
    space :=
    space +=
    $(info BUILD OPTIONS:)
    $(info $(space) Project name     $(PROJECT_NAME))
    $(info $(space) SDK version      $(SDK_VERSION))
    $(info $(space) App version      $(VERSION))
    $(info $(space) Chip             $(NRF_IC))
    $(info $(space) Date             $(DATE))
    $(info $(space) Make Type        $(MAKECMDGOALS))
    $(info $(space))
    
    $(OUTPUT_DIRECTORY)/$(TARGET_RELEASE).out: \
    	LINKER_SCRIPT  := smarthome_gcc_nrf52833.ld
    
    $(OUTPUT_DIRECTORY)/$(TARGET_DEBUG).out: \
    	LINKER_SCRIPT  := smarthome_gcc_nrf52833_noboot.ld
    
    # Source files common to all targets
    SRC_FILES += \
    	$(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_$(NRF_IC).S \
    	$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c \
    	$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \
    	$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_uart.c \
    	$(SDK_ROOT)/components/libraries/log/src/nrf_log_default_backends.c \
    	$(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
    	$(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \
    	$(SDK_ROOT)/external/zboss/src/commissioning/bdb/bdb_finding_binding.c \
    	$(SDK_ROOT)/external/zboss/osif/zb_nrf52_common.c \
    	$(SDK_ROOT)/external/zboss/osif/zb_nrf52_nrf_logger.c \
    	$(SDK_ROOT)/external/zboss/osif/zb_nrf52_logger.c \
    	$(SDK_ROOT)/external/zboss/osif/zb_nrf52_nvram.c \
    	$(SDK_ROOT)/external/zboss/osif/zb_nrf52_timer.c \
    	$(SDK_ROOT)/external/zboss/osif/zb_nrf52_transceiver.c \
    	$(SDK_ROOT)/components/libraries/button/app_button.c \
    	$(SDK_ROOT)/components/libraries/util/app_error.c \
    	$(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c \
    	$(SDK_ROOT)/components/libraries/scheduler/app_scheduler.c \
    	$(SDK_ROOT)/components/libraries/util/app_error_weak.c \
    	$(SDK_ROOT)/components/libraries/timer/app_timer2.c \
    	$(SDK_ROOT)/components/libraries/util/app_util_platform.c \
    	$(SDK_ROOT)/components/libraries/assert/assert.c \
    	$(SDK_ROOT)/components/libraries/util/nrf_assert.c \
    	$(SDK_ROOT)/components/libraries/timer/drv_rtc.c \
    	$(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \
    	$(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c \
    	$(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c \
    	$(SDK_ROOT)/external/fprintf/nrf_fprintf.c \
    	$(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/ha_sas.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_alarms_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_attr_value.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_basic_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_binary_input.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_c_daily_schedule.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_c_drlc.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_c_messaging.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_c_metering.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_c_price.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_c_wwah.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_color_control_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_common.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_continuous_value_change_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_control4_networking.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_dehumid_control.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_diagnostics_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_door_lock.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_el_measurement.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_en50523_appliance_events_and_alerts.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_fan_control.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_general_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_groups.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ias_ace_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ias_wd_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ias_zone_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_identify_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_illuminance_measurement.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_level_control_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_main.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_meter_identification.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_nvram.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_occupancy_sensing_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_on_off_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_on_off_switch_config.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ota_upgrade_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ota_upgrade_common.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ota_upgrade_minimal.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_ota_upgrade_srv_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_poll_control_client.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_poll_control_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_power_config_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_pressure_measurement.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_rel_humidity.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_reporting.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_s_daily_schedule.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_s_drlc.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_s_messaging.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_s_metering.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_s_price.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_s_wwah.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_scenes.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_shade_config_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_temp_measurement.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_thermostat_commands.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_thermostat_ui_config.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_time.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_window_covering.c \
    	$(SDK_ROOT)/external/zboss/src/zcl/zcl_wwah_common.c \
    	$(SDK_ROOT)/external/zboss/src/commissioning/bdb/zdo_commissioning_bdb.c \
    	$(SDK_ROOT)/external/zboss/src/commissioning/bdb/zdo_commissioning_bdb_formation.c \
    	$(SDK_ROOT)/external/zboss/src/commissioning/legacy/zdo_commissioning_classic.c \
        $(SDK_ROOT)/components/libraries/experimental_section_vars/nrf_section_iter.c \
    	$(SDK_ROOT)/external/zboss/src/zb_error/zb_error_to_string.c \
    	$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage.c \
    	$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage_nvmc.c \
    	$(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c \
    	$(SDK_ROOT)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c \
    	$(SDK_ROOT)/components/libraries/queue/nrf_queue.c \
    	$(SDK_ROOT)/components/libraries/ringbuf/nrf_ringbuf.c \
    	$(SDK_ROOT)/components/libraries/serial/nrf_serial.c \
    	$(SDK_ROOT)/components/libraries/sortlist/nrf_sortlist.c \
    	$(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
    	$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_twi.c \
    	$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c \
    	$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_power.c \
    	$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_rng.c \
    	$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c \
    	$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c \
    	$(SDK_ROOT)/modules/nrfx/hal/nrf_nvmc.c \
    	$(SDK_ROOT)/modules/nrfx/hal/nrf_ecb.c \
    	$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c \
    	$(SDK_ROOT)/modules/nrfx/soc/nrfx_atomic.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_rng.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_twi.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_twim.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_systick.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_timer.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_wdt.c \
    	$(SDK_ROOT)/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c \
    	$(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \
    	$(SRC_DIR)/main.c \
    	$(SRC_DIR)/config.c \
    	$(SRC_DIR)/periph_monitor.c \
    	$(SRC_DIR)/zigbee_touch_switch.c \
    	$(SRC_DIR)/zigbee_ss_led_driver_cluster.c \
    	$(SRC_DIR)/zigbee_led_driver.c \
    	$(SRC_DIR)/zigbee_custom_cluster_touch.c\
    	$(SRC_DIR)/zb_gateway_error_handler.c\
    	$(SRC_DIR)/zigbee_curtain_cluster.c\
    	$(SRC_DIR)/periph_curtain.c \
    	$(SRC_DIR)/zb_zcl_analog_output.c \
    	$(SDK_ROOT)/components/libraries/fds/fds.c \
    	$(SDK_ROOT)/components/libraries/crc16/crc16.c \
    	$(COMPONENT_DIR)/nrf_peripherals/nrf_fds_storage.c \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_touch/periph_touch.c \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_touch/touch_lib/sx9500/sx9500.c \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_touch/touch_lib/sx8636/sx8636.c \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_pwm/periph_pwm.c \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_adc/periph_adc.c \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_button/periph_button.c \
    	$(COMPONENT_DIR)/zigbee_mesh/zigbee_mesh.c \
    	$(COMPONENT_DIR)/zigbee_mesh/zigbee_helper.c \
    	$(COMPONENT_DIR)/zigbee_mesh/zigbee_attr_report.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_pwm.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_ppi.c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_saadc.c \
    	$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \
    	$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \
    	$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \
    	$(SDK_ROOT)/modules/nrfx/mdk/system_$(NRF_IC).c \
    	$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_qdec.c \
    
    # Include folders common to all targets
    INC_FOLDERS += \
    	$(SDK_ROOT)/external/zboss/osif \
    	$(SDK_ROOT)/integration/nrfx \
    	$(SDK_ROOT)/components/libraries/low_power_pwm \
    	$(SRC_DIR) \
    	$(SRC_DIR)/include \
    	$(SDK_ROOT)/components/libraries/fds \
    	$(SDK_ROOT)/components/libraries/crc16 \
    	$(SDK_ROOT)/external/nRF-IEEE-802.15.4-radio-driver/src \
    	$(SDK_ROOT)/components/libraries/scheduler \
    	$(SDK_ROOT)/components/libraries/experimental_section_vars \
    	$(SDK_ROOT)/components/libraries/atomic_fifo \
    	$(SDK_ROOT)/modules/nrfx/mdk \
    	$(SDK_ROOT)/components/libraries/queue \
    	$(SDK_ROOT)/components/libraries/strerror \
    	$(SDK_ROOT)/components/libraries/serial \
    	$(SDK_ROOT)/components/zigbee/common \
    	$(SDK_ROOT)/external/nRF-IEEE-802.15.4-radio-driver/src/fem \
    	$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
    	$(SDK_ROOT)/integration/nrfx/legacy \
    	$(SDK_ROOT)/components/libraries/button \
    	$(SDK_ROOT)/components/libraries/log \
    	$(SDK_ROOT)/modules/nrfx/hal \
    	$(SDK_ROOT)/components/libraries/log/src \
    	$(SDK_ROOT)/components/libraries/sortlist \
    	$(SDK_ROOT)/modules/nrfx/drivers/include \
    	$(SDK_ROOT)/external/zboss/include \
    	$(SDK_ROOT)/external/zboss/include/zcl \
    	$(SDK_ROOT)/components/libraries/ringbuf \
    	$(PROJ_DIR)/config \
    	$(SDK_ROOT)/external/fprintf \
    	$(SDK_ROOT)/components/libraries/balloc \
    	$(SDK_ROOT)/components/libraries/util \
    	$(SDK_ROOT)/modules/nrfx \
    	$(SDK_ROOT)/components \
    	$(SDK_ROOT)/external/segger_rtt \
    	$(SDK_ROOT)/components/libraries/memobj \
    	$(SDK_ROOT)/external/zboss/src/zb_error \
    	$(SDK_ROOT)/external/nRF-IEEE-802.15.4-radio-driver/src/fem/three_pin_gpio \
    	$(SDK_ROOT)/components/libraries/atomic \
    	$(SDK_ROOT)/external/zboss/include/ha \
    	$(SDK_ROOT)/external/zboss/src/zb_error \
    	$(SDK_ROOT)/external/zboss/src/include \
    	$(SDK_ROOT)/external/zboss/include/osif \
    	$(SDK_ROOT)/components/libraries/delay \
    	$(SDK_ROOT)/components/toolchain/cmsis/include \
    	$(SDK_ROOT)/external/zboss/include/addons \
    	$(SDK_ROOT)/components/libraries/mutex \
    	$(SDK_ROOT)/components/libraries/pwr_mgmt \
    	$(SDK_ROOT)/components/libraries/fstorage \
    	$(SDK_ROOT)/components/libraries/timer \
    	$(COMPONENT_DIR)/nrf_peripherals/include \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_touch/include \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_touch/touch_lib/sx8636 \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_touch/touch_lib/sx9500 \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_pwm/include \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_button/include \
    	$(COMPONENT_DIR)/nrf_peripherals/periph_adc/include \
    	$(COMPONENT_DIR)/zigbee_mesh/include \
    	$(SDK_ROOT)/components/libraries/hardfault/nrf52 \
    	$(SDK_ROOT)/components/libraries/hardfault \
    
    # Libraries common to all targets
    LIB_FILES += \
    	$(SDK_ROOT)/external/zboss/lib/gcc/libzboss.a \
    	$(SDK_ROOT)/external/zboss/lib/gcc/$(NRF_IC)/nrf_radio_driver.a \
    	$(SDK_ROOT)/external/zboss/lib/gcc/libgppb.a \
    
    # Optimization flags
    OPT = -O0 -ggdb3
    # Uncomment the line below to enable link time optimization
    #OPT += -flto
    
    # To make SEGGER RTT retarget to printf correctly, you need to get around
    # the silly ANSI C compatibility stuff that breaks our GCC builds
    PARAMS_DEFINE = -D_PARAMS\(paramlist\)=paramlist
    
    # C flags common to all targets
    CFLAGS += $(OPT)
    CFLAGS += $(PARAMS_DEFINE)
    CFLAGS += -DPROJECT_NAME=\"$(PROJECT_NAME)\"
    CFLAGS += -DPROJECT_VERSION=\"$(VERSION)\"
    CFLAGS += -DUSE_APP_CONFIG
    CFLAGS += -DAPP_TIMER_V2
    CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
    CFLAGS += -DCONFIG_ZIGBEE_ERROR_TO_STRING_ENABLED
    CFLAGS += -DFLOAT_ABI_HARD
    CFLAGS += -DLIBZBOSS_CONFIG_FILE=\"libzboss_config.h\"
    CFLAGS += -DNRF$(IC_NUM)_XXAA
    CFLAGS += -DZBOSS_BUILD
    CFLAGS += -DZB_NRF_INTERNAL
    #CFLAGS += -DZB_ROUTER_NO_ED
    CFLAGS += -DZB_NVRAM_FLASH_AUTO_ADDRESS
    CFLAGS += -DZB_ZCL_SCENES_OPTIONAL_COMMANDS_DISABLED
    CFLAGS += -DZB_ZCL_USE_ZCL7_AS_DEFAULT_REVISION
    #CFLAGS += -DZB_TRACE_LEVEL=0
    #CFLAGS += -DZB_TRACE_MASK=0
    CFLAGS += -mcpu=cortex-m4
    CFLAGS += -mthumb -mabi=aapcs
    CFLAGS += -Wall -Werror
    CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    
    # keep every function in a separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin -fshort-enums -Wno-packed-bitfield-compat
    CFLAGS += -Wno-error=unused-variable
    CFLAGS += -Wno-error=unused-function
    
    # C++ flags common to all targets
    CXXFLAGS += $(OPT)
    # Assembler flags common to all targets
    ASMFLAGS += -ggdb3
    ASMFLAGS += -mcpu=cortex-m4
    ASMFLAGS += -mthumb -mabi=aapcs
    ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    ASMFLAGS += -DAPP_TIMER_V2
    #ASMFLAGS += -DZB_ROUTER_NO_ED
    ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    ASMFLAGS += -DFLOAT_ABI_HARD
    ASMFLAGS += -DLIBZBOSS_CONFIG_FILE=\"libzboss_config.h\"
    ASMFLAGS += -DNRF$(IC_NUM)_XXAA
    
    # Linker flags
    LDFLAGS += $(OPT)
    LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
    LDFLAGS += -mcpu=cortex-m4
    LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # let linker dump unused sections
    LDFLAGS += -Wl,--gc-sections
    # use newlib in nano version
    LDFLAGS += --specs=nano.specs
    
    $(TARGET_RELEASE): CFLAGS += -D__HEAP_SIZE=8192
    $(TARGET_RELEASE): CFLAGS += -D__STACK_SIZE=8192
    $(TARGET_RELEASE): ASMFLAGS += -D__HEAP_SIZE=8192
    $(TARGET_RELEASE): ASMFLAGS += -D__STACK_SIZE=8192
    
    $(TARGET_DEBUG): CFLAGS += -DDEBUG
    $(TARGET_DEBUG): CFLAGS += -DDEBUG_NRF
    $(TARGET_DEBUG): CFLAGS += -D__HEAP_SIZE=8192
    $(TARGET_DEBUG): CFLAGS += -D__STACK_SIZE=8192
    $(TARGET_DEBUG): ASMFLAGS += -DDEBUG
    $(TARGET_DEBUG): ASMFLAGS += -DDEBUG_NRF
    $(TARGET_DEBUG): ASMFLAGS += -D__HEAP_SIZE=8192
    $(TARGET_DEBUG): ASMFLAGS += -D__STACK_SIZE=8192
    
    # Add standard libraries at the very end of the linker input, after all objects
    # that may need symbols provided by these libraries.
    LIB_FILES += -lc -lnosys -lm -lstdc++
    
    
    .PHONY: all release debug help
    
    # all targets
    all: release
    
    # release target
    release: $(TARGET_RELEASE)
    
    # debug target
    debug: $(TARGET_DEBUG)
    
    # Print all targets that can be built
    help:
    	@echo "following targets are available:"
    	@echo "    all (default) - build all targets: release and debug"
    	@echo "    release       - build $(TARGET_RELEASE)"
    	@echo "    debug         - build $(TARGET_DEBUG)"
    	@echo "    clean         - clean all targets"
    	@echo "    sdk_config    - starting external tool for editing sdk_config.h"
    	@echo "    flash         - flashing release binary"
    	@echo "    flash_debug   - flashing debug binary"
    	@echo ""
    
    TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
    
    include $(TEMPLATE_PATH)/Makefile.common
    
    $(foreach target_release, $(TARGET_RELEASE), $(call define_target, $(target_release)))
    $(foreach target_debug, $(TARGET_DEBUG), $(call define_target, $(target_debug)))
    
    .PHONY: flash flash_debug erase
    
    # Flash the program
    flash_softdevice:
    	nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s113/hex/s113_nrf52_7.0.1_softdevice.hex --sectorerase
    flash: release
    	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/$(TARGET_RELEASE).hex --sectorerase
    	nrfjprog -f nrf52 --reset
    	@make monitor
    # Flash the program
    flash_debug: debug
    	@echo Flashing: $(OUTPUT_DIRECTORY)/$(TARGET_DEBUG).hex
    	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/$(TARGET_DEBUG).hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    erase:
    	nrfjprog -f nrf52 --eraseall
    
    reset:
    	nrfjprog -f nrf52 --reset
    log:
    	JLinkRTTViewer
    
    monitor:
    	@echo "monitor" $(shell JLinkRTTViewerExe --device NRF52833_XXAA --interface swd --speed 4000 --connection usb --autoconnect)
    
    SDK_CONFIG_FILE := config/sdk_config.h
    CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
    sdk_config:
    	java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
    

  • Hi Charlie

    So, I have some update on the problem. So the problem is that I have this 

    void zboss_signal_handler(zb_bufid_t bufid)
    {
        zb_zdo_app_signal_hdr_t *p_sg_p = NULL;
        zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &p_sg_p);
        zb_ret_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
        /*NRF_LOG_INFO("zboss_signal_handler signal %d", sig);*/
        switch (sig) {
            default:
                ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
            break;
        }
    }
            

    If I uncomment the Log in this funtion it will pop up repeatedly signal 22. But the weird thing is that in the zigbee_default_signal_handler(bufid), when signal 22 hit, it will go to default like in this code. 

            default:
                /* Unimplemented signal. For more information see: zb_zdo_app_signal_type_e and zb_ret_e. */
                NRF_LOG_INFO("Unimplemented signal (signal: %d, status: %d)", sig, status);
                break;
    

    But I can never see the log pop up which means that The code in default signal handler has do some thing to filter out the signal. But still I can not figure out how to achieve the same outcome in the self implemented zboss_signal_handler

    I also test with the devkit pca10100 and have the same outcome. I also attach the code for you to check it out

    3884.light_bulb.zip

    Thank you

    Best regards,

    Tu

  • Hi Tu,

    Shouldn't this singal be processed by the following codes in zigbee_default_signal_handler function?

            case ZB_COMMON_SIGNAL_CAN_SLEEP:
            //NRF_LOG_INFO("zboss_signal_handler signal %d", sig);
                /* Zigbee stack can enter sleep state.
                 * If the application wants to proceed, it should call zb_sleep_now() function.
                 *
                 * Note: if the application shares some resources between Zigbee stack and other tasks/contexts,
                 *       device disabling should be overwritten by implementing one of the weak functions inside zb_nrf52840_common.c.
                 */
                zb_sleep_now();
                break;

    Best regards,

    Charlie

  • Hi Charlie,

    Well in the light bulb example, the device is a router so it will not process that signal but will put it in default case. If I remember correctly unless the device plays the role of a end device, it will never handle that signal.

    #ifdef ZB_USE_SLEEP
            case ZB_COMMON_SIGNAL_CAN_SLEEP:
                /* Zigbee stack can enter sleep state.
                 * If the application wants to proceed, it should call zb_sleep_now() function.
                 *
                 * Note: if the application shares some resources between Zigbee stack and other tasks/contexts,
                 *       device disabling should be overwritten by implementing one of the weak functions inside zb_nrf52840_common.c.
                 */
                zb_sleep_now();
                break;
    #endif
    

    As you can see the handle of this signal is only enable with ZB_USE_SLEEP is defined and that macro is only there if the device is ED as in the code below

    #ifdef ZB_ED_ROLE
    #define ZB_USE_SLEEP
    #endif
    

    So It does not really explain my question which is why in my void zboss_signal_handler(zb_bufid_t bufid) if I put the log there it will show that there are signal 22(ZB_SIGNAL_CAN_SLEEP) coming repeatedly, but when the signal is handled by zigbee_default_signal_handler , somehow the defaults handler ignore it.

    I want to know how to do it just to verify if this behavior is normal and if it will have any effect on the overall performance of the system.

    Looking forward to hearing from you,

    Best regards,

    Tu

Related