TUYA Zigbee SDK Document
SDK Document version
version
Preparation / Revision Instructions
Revised by
Revision date
Remarks
1.0.0
Create document
Liang Deng / Peng Zhang
2020-03-26
SDK summarize
Tuya Zigbee EFR32 SDK is used to develop Zigbee 3.0 standard products. This SDK is abstracted again based on the Silicon Labs SDK ,The complex Zigbee technical details are shielded, which is convenient for developers to get started quickly. The SDK mainly includes three parts: hardware interface, network interface and tool interface,And provide some types of sample code to demonstrate the use of various interfaces and the basic development specifications of Zigbee device access to the Tuya system.
SDK download
https://github.com/TuyaInc/tuya_zigbee_sdk
SDK Directory Structure
├── app
│ ├── build-all.py
│ ├── light
│ ├── sensor
│ ├── smart_plug
│ └── switch
├── doc
│ ├── datasheet
│ ├── SPEC
│ ├── docking standard
│ └── development manual
├── include
│ ├── hal_adc.h
│ ├── hal_battery.h
│ ├── hal_flash.h
│ ├── hal_gpio.h
│ ├── hal_i2c.h
│ ├── hal_pwm.h
│ ├── hal_spi.h
│ ├── hal_systick_timer.h
│ ├── hal_timer.h
│ ├── hal_uart.h
│ ├── tuya_app_timer.h
│ ├── tuya_mcu_os.h
│ ├── tuya_mf_test.h
│ ├── tuya_oem_kit.h
│ ├── tuya_tools.h
│ ├── tuya_zigbee_modules.h
│ ├── tuya_zigbee_sdk.h
│ ├── tuya_zigbee_stack.h
│ ├── type_def.h
│ ├── zigbee_attr.h
│ ├── zigbee_cmd.h
│ ├── zigbee_dev_template.h
│ ├── zigbee_modules.h
│ └── zigbee_raw_cmd_api.h
├── lib
│ ├── gcc_lib
│ └── iar_lib
├── sdk
│ ├── platform
│ └── tool
└── tools
├── gcc-arm-none-eabi-9-2019-q4-major
├── gcc-arm-none-eabi-9-2019-q4-major.tar.bz2
├── gcc_boot
└── iar_toolsDirectory Introduction
Directory
Explanation
app
The entry path of the application project, which contains example codes of various categories
doc
Zigbee related files
include
SDK interface file
lib
SDK library files are divided into IAR version library and GCC version library
sdk
Some tools and link scripts
tools
Related tools and scripts used in compilation
SDK Overall process

User-implemented function interface
dev_power_on_init()
Instructions
Zigbee SDK will call this function according to the system flowchart,Users need to at least create Zigbee devices,network parameter setting。
Sample code snippet
dev_system_on_init()
Instructions Zigbee SDK will call this function according to the system flowchart,Users can realize Zigbee attribute operation, hardware initialization, software timing processing and other initialization. Sample code snippet
nwk_state_changed_callback()
Instructions Zigbee SDK will call this function according to the system flowchart,Users can implement Zigbee network status processing. Sample code snippet
Quick development guide
The SDK development kit contains documentation and examples, and the use of and attribute sample code is the only rule of quick start. It is recommended to compile, run, and network with the sample code first, and then try to modify the code to achieve personalized functions.
Example description
Directory
Explanation
light
Projects including Zigbee lamps, including lamp switching and brightness adjustment functions
sensor
The project including Zigbee door sensor, including door sensor opening, closing and battery power reporting function
smart_plug
Including the Zigbee socket project, including the opening and closing function of the socket
switch
Including Zigbee relay switch project, including relay on and off functions
Document description
Document directory
Explanation
datasheet
Zigbee chip data sheet
SPEC
Contains Zigbee Alliance Standard Reference Manual
Development Manual
All documents used for development
API call restrictions
Call after Call after
Functional category
Function name
Features
Restrictions
hardware
user_uart_init
Single serial port configuration, including serial port hardware parameters and serial port data receiving callback function, The receiving function is already a function after receiving queue processing,n ot interrupting the environment
dev_system_on_init ,Don't call it in dev_power_on_init , It will be conflicted with the serial port production test
gpio_raw_init
gpio Original initialization
If it is multiplexed with serial port IO, it needs to be called after dev_system_on_init and after. If there is no multiplexing, there is no limit to call
gpio_int_register
gpio Interrupt initialization
If it is multiplexed with serial port IO, it needs to be called after dev_system_on_init and after. If there is no multiplexing, there is no calling limit
Software delay event
dev_timer_stop
Stop a delayed execution event early
dev_system_on_init ,Don't call it in dev_power_on_init, Calling too early will cause an exception,The event frame has not been initialized。If called in an interrupt, At least ensure that the interrupt is generated after dev_system_on_init </ strong> </ td>
dev_timer_start_with_callback
Start a delayed execution event and set the event processing function
appendix
Glossary
noun
Explanation
IoT platform
iot.tuya.com
Zigbee SDK
Based on Silicon branch Zigbee protocol stack after cutting、Optimized packaged Tuya’s Zigbee SDK
Attribute
Attribute (属性)Is a data value reflecting the physical quantity or state
Cluster
Cluster (群集)Is a cluster containing one or more attributes
EndPoint
EndPoint (端点)It is the entrance of the application layer of the protocol stack, that is, the entrance address, and it can also understand where the application object exists. It is a group of clusters defined for the realization of a device description.
Device Id
The serial number defined for each device in Zigbee
Weak current equipment
Refers to battery-powered equipment,A device called sleep end device in the Zigbee protocol
Powerful equipment
Refers to a device that uses mains electricity or is powered from a mains voltage-stabilized power supply, which is called a router in the Zigbee protocol
PID
product ID,Each product created on the Tuya IoT platform will generate a unique product number, which is associated with the product specific function points, APP control panel, shipping information, etc.
SOC
system on chip,The hardware itself has no MCU, and the control program is written into the network module
SDK
Software Development Kit,A software development kit, a collection of related documents, examples, and tools to assist in the development of a certain type of software. In order to encourage developers to use their systems or languages, many SDKs are provided free of charge, as are Tuya's
Firmware
Firmware is a program written in EROM (Erasable Read Only Memory) or EEPROM (Electrically Erasable Programmable Read Only Memory). Firmware refers to the device "driver" stored inside the device. Through the firmware, the operating system can implement the operation of a specific machine according to the standard device driver. For example, the optical drive and the recorder have internal firmware. Firmware is the software that serves as the most basic and lowest level of a system
OTA
It means firmware upgrade, we support OTA
Last updated
Was this helpful?