This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Losing cloud connection, Thread CoAP Cloud example (SDK 0.11.0)

Dear Thread-experts,

I have troubles with your Thread CoAP Cloud example. I am using:

  • Thread SDK V0.11.0
  • Border Router V0.11.0, ethernet (not Wi-Fi)
  • cloud_coap_client example, adapted that I send more data (buffer size =256bytes)
  • Eclipse
  • Preview DVK, V0.9.0

I observe that after a while (sometimes day, sometimes minutes), no data are sent to the cloud. I debugged and my FW is running find and I don't get any errors (function otCoapSendRequest() is executed without error). However, the data is not visible in the cloud. The only way to recover it is: erasing the FW on the Border Router Network-Co-Processor-Thread-Module (Preview DVK). After erasing and reprogramming the DVK with the NCP, I can send data again for a certain time, until it brakes down again.

What I have observed is: when I send only 64bytes (insted of 256bytes): it tends to run more stable (some samples are missing, but the system is recovering itself).

I send the 256bytes every 6 minutes.

How can I debug that issue in more detail?

Thank you, Reto

    • gcc: GNU Tools ARM Embedded/5.4 2016q3/bin
    • make: (see below)
    • OS: Windows 10
    • The OpenThread source code was fixed and Jonathan accepted it (see #2424 via #2435.)

    My make file:

    PROJECT_NAME     := thread_cloud_coap_client_pca10056
    TARGETS          := nrf52840_xxaa_thingsio
    OUTPUT_DIRECTORY := _build
    
    SDK_ROOT := ../../../Nordic_nRFSDK/nRF_Thread_SDK0.11.0
    PROJ_DIR := .
    SRC_DIR := ../../../Cellabox_nRF52840
    
    $(OUTPUT_DIRECTORY)/nrf52840_xxaa_thingsio.out: \
      LINKER_SCRIPT  := $(PROJ_DIR)/openthread_nrf52840.ld
    
    # Source files common to all targets
    SRC_FILES += \
      $(SDK_ROOT)/components/libraries/experimental_log/src/nrf_log_backend_rtt.c \
      $(SDK_ROOT)/components/libraries/experimental_log/src/nrf_log_backend_serial.c \
      $(SDK_ROOT)/components/libraries/experimental_log/src/nrf_log_default_backends.c \
      $(SDK_ROOT)/components/libraries/experimental_log/src/nrf_log_frontend.c \
      $(SDK_ROOT)/components/libraries/experimental_log/src/nrf_log_str_formatter.c \
      $(SDK_ROOT)/components/boards/boards.c \
      $(SDK_ROOT)/components/libraries/button/app_button.c \
      $(SDK_ROOT)/components/libraries/util/app_error.c \
      $(SDK_ROOT)/components/libraries/util/app_error_weak.c \
      $(SDK_ROOT)/components/libraries/scheduler/app_scheduler.c \
      $(SDK_ROOT)/components/libraries/timer/app_timer.c \
      $(SDK_ROOT)/components/libraries/util/app_util_platform.c \
      $(SDK_ROOT)/components/libraries/util/nrf_assert.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)/components/libraries/experimental_memobj/nrf_memobj.c \
      $(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
      $(SDK_ROOT)/components/drivers_nrf/clock/nrf_drv_clock.c \
      $(SDK_ROOT)/components/drivers_nrf/common/nrf_drv_common.c \
      $(SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \
      $(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c \
      $(SDK_ROOT)/components/drivers_nrf/hal/nrf_nvmc.c \
      $(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c \
      $(SDK_ROOT)/components/libraries/bsp/bsp.c \
      $(SDK_ROOT)/components/libraries/bsp/bsp_nfc.c \
      $(SDK_ROOT)/components/libraries/bsp/experimental/bsp_thread.c \
      $(PROJ_DIR)/main.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)/components/toolchain/gcc/gcc_startup_nrf52840.S \
      $(SDK_ROOT)/components/toolchain/system_nrf52840.c \
      $(SDK_ROOT)/components/thread/experimental/utils/thread_assert.c \
      $(SDK_ROOT)/components/thread/experimental/utils/thread_dns_utils.c \
      $(SDK_ROOT)/components/thread/experimental/utils/thread_utils.c \
      $(SDK_ROOT)/components/drivers_nrf/twi_master/nrf_drv_twi.c \
      $(SDK_ROOT)/components/drivers_nrf/rtc/nrf_drv_rtc.c \
      $(SDK_ROOT)/components/drivers_nrf/saadc/nrf_drv_saadc.c \
      $(SDK_ROOT)/components/drivers_nrf/hal/nrf_saadc.c \
      $(SRC_DIR)/thread_coap_utils.c \
      $(SRC_DIR)/cb_i2c.c \
      $(SRC_DIR)/cb_shtc1.c \
      $(SRC_DIR)/cb_lps22hb.c \
      $(SRC_DIR)/cb_sgpc3.c \
      $(SRC_DIR)/cb_sht30.c \
      $(SRC_DIR)/cb_lmp91000.c \
    
    # Include folders common to all targets
    INC_FOLDERS += \
      $(SDK_ROOT)/components/drivers_nrf/common \
      $(PROJ_DIR) \
      $(SDK_ROOT)/components/libraries/experimental_section_vars \
      $(SDK_ROOT)/components/libraries/experimental_log \
      $(SDK_ROOT)/components/libraries/experimental_memobj \
      $(SDK_ROOT)/components/libraries/atomic \
      $(SDK_ROOT)/components/device \
      $(SDK_ROOT)/components/drivers_nrf/clock \
      $(SDK_ROOT)/components/libraries/bsp/experimental \
      $(SDK_ROOT)/components/toolchain/cmsis/include \
      $(SDK_ROOT)/components/libraries/balloc \
      $(SDK_ROOT)/components/thread/experimental/utils \
      $(SDK_ROOT)/components/thread/experimental/app_utils \
      $(SDK_ROOT)/components/drivers_nrf/hal \
      $(SDK_ROOT)/components \
      $(SDK_ROOT)/components/libraries/scheduler \
      $(SDK_ROOT)/components/libraries/strerror \
      $(SDK_ROOT)/components/libraries/experimental_log/src \
      $(SDK_ROOT)/external/fprintf \
      $(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
      $(SDK_ROOT)/external/segger_rtt \
      $(SDK_ROOT)/components/toolchain/gcc \
      $(SDK_ROOT)/components/drivers_nrf/delay \
      $(SDK_ROOT)/external/openthread/include \
      $(SDK_ROOT)/external/nrf_cc310/include \
      $(SDK_ROOT)/components/drivers_nrf/gpiote \
      $(SDK_ROOT)/components/libraries/bsp \
      $(SDK_ROOT)/components/boards \
      $(SDK_ROOT)/components/libraries/timer \
      $(SDK_ROOT)/components/libraries/button \
      $(SDK_ROOT)/components/libraries/util \
      $(SDK_ROOT)/components/toolchain \
      $(SDK_ROOT)/components/drivers_nrf/twi_master \
      $(SDK_ROOT)/components/drivers_nrf/hal/ \
      $(SDK_ROOT)/components/drivers_nrf/rtc/ \
      $(SDK_ROOT)/components/drivers_nrf/saadc/ \
      $(SRC_DIR) \
    
    # Libraries common to all targets
    LIB_FILES += \
      $(SDK_ROOT)/external/openthread/lib/gcc/libopenthread-cli-ftd.a \
      $(SDK_ROOT)/external/openthread/lib/gcc/libopenthread-ftd.a \
      $(SDK_ROOT)/external/openthread/lib/gcc/libopenthread-nrf52840-sdk.a \
      $(SDK_ROOT)/external/openthread/lib/gcc/libopenthread-diag.a \
      $(SDK_ROOT)/external/openthread/lib/gcc/libmbedcrypto-cc310.a \
      $(SDK_ROOT)/external/nrf_cc310/lib/libcc310_gcc_0.9.0.a \
    
    # Optimization flags
    OPT = -O3 -g3
    # Uncomment the line below to enable link time optimization
    #OPT += -flto
    
    # C flags common to all targets
    CFLAGS += $(OPT)
    CFLAGS += -DBOARD_PCA10056
    CFLAGS += -DCONFIG_GPIO_AS_PINRESET
    CFLAGS += -DNRF52840_XXAA
    CFLAGS += -DOPENTHREAD_ENABLE_APPLICATION_COAP
    CFLAGS += -DSWI_DISABLE0
    CFLAGS += -DUART_ENABLED=0
    CFLAGS += -D__HEAP_SIZE=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 
    
    # C++ flags common to all targets
    CXXFLAGS += $(OPT)
    
    # Assembler flags common to all targets
    ASMFLAGS += -g3
    ASMFLAGS += -mcpu=cortex-m4
    ASMFLAGS += -mthumb -mabi=aapcs
    ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    ASMFLAGS += -DBOARD_PCA10056
    ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
    ASMFLAGS += -DNRF52840_XXAA
    ASMFLAGS += -DOPENTHREAD_ENABLE_APPLICATION_COAP
    ASMFLAGS += -DSWI_DISABLE0
    ASMFLAGS += -DUART_ENABLED=0
    ASMFLAGS += -D__HEAP_SIZE=0
    
    # Linker flags
    LDFLAGS += $(OPT)
    LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -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
    
    
    # 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
    
    
    .PHONY: default help
    
    # Default target - first one defined
    default: nrf52840_xxaa_thingsio
    
    # Print all targets that can be built
    help:
    	@echo following targets are available:
    	@echo 	nrf52840_xxaa_thingsio
    	@echo		sdk_config - starting external tool for editing sdk_config.h
    	@echo		flash      - flashing binary
    
    TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
    
    include $(TEMPLATE_PATH)/Makefile.common
    
    $(foreach target, $(TARGETS), $(call define_target, $(target)))
    
    .PHONY: flash erase
    
    # Flash the program
    flash: $(OUTPUT_DIRECTORY)/nrf52840_xxaa_thingsIO.hex
    	@echo Flashing: $<
    	nrfjprog -f nrf52 --program $< --sectorerase
    	nrfjprog -f nrf52 --reset
    
    erase:
    	nrfjprog -f nrf52 --eraseall
    
    SDK_CONFIG_FILE := $(SRC_DIR)/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)
    
Related