English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Protocol Application

Last Updated on : 2021-10-31 08:48:27

This topic describes the generic solution for interfacing with Tuya’s Bluetooth modules, consisting of protocol features description and common troubleshooting questions.

  • Protocol features description: describes how to use the Bluetooth generic protocol, including the basic features and extended features.
  • Common troubleshooting questions: common troubleshooting steps that can be used to identify and resolve problems that might occur in implementing this solution.

Concepts

Bluetooth generic firmware

The Bluetooth generic firmware is developed by Tuya for adapting to different Bluetooth chip platforms. Your MCU can interface with Tuya’s Bluetooth modules that have the generic firmware flashed to enable your product to connect to the Tuya IoT Development Platform. Besides it, the generic firmware provides extended features such as OTA update, production test, and low power mode.

Functionality

In a nutshell, the Bluetooth generic firmware provides two essential functions.

  • Network connectivity: The Bluetooth module flashed with the generic firmware and license can be connected to the Tuya IoT Development Platform.
  • Raw data pass-through: With the serial protocol, the Bluetooth module can communicate with the MCU to achieve remote control of a smart device.

The generic firmware does not process the data received from the MCU but only verifies the data. The module serves as a mediator that connects the MCU with the cloud and transmits data between them.

Firmware category

The generic firmware is classified by product categories.

Product category Chip/module
Locks TYBN1 and BK3431Q
Health or shared products BK3432, BK3431Q, and TYBT3L
Common products BK3432, TYBT3L, and TYBT4L

A module model can have various firmware specific to multiple product categories.

Protocol category

Protocol Description
Generic protocol Applies to all product categories
Low power protocol Applies to certain product categories
Lock-specific generic protocol Applies to the lock category
Health product-specific generic protocol Applies to the health product category

This topic describes the basic and generic protocol applicable to all categories. Specifically, the firmware varies depending on product categories and models. For more information, see Categories of generic firmware.

Bluetooth serial communication protocol

The serial communication between the Bluetooth module flashed with the generic firmware and the MCU follows the Bluetooth generic serial protocol. The serial communication enables the Bluetooth module to communicate the firmware features to the MCU.

This serial protocol comprises the basic features, such as heartbeat detection and status reporting, as well as extended features such as OTA update. For more information, see Bluetooth Serial Communication Protocol.

  • Basic features: the essential functionality to make a device IoT-enabled, which is to implement the two-way communication between a device and the cloud. The features include module initialization, network reset, and data transmission, with the commands from 0x00 to 0x09.
  • Extended features: a bunch of useful features to help you improve user experiences, such as OTA update, production test, and low power mode.

Tuya continuously updates the generic firmware with fixed issues and added new features.

MCU SDK

The MCU SDK contains the code used to implement the Bluetooth generic serial protocol so that you can directly port the SDK to your target platform to enable your product to connect to the Tuya IoT Development Platform. For more information, see MCU SDK Porting.

The MCU SDK requirements for the MCU are as follows.

  • Flash: at least 4 KB sector size
  • RAM: at least 512 bytes

Steps to get the MCU SDK are as follows.

  1. Log in to the Tuya IoT Development Platform and go to the product list.

  2. Choose a product in Developing and click Continue to Develop on the Operation column.

  3. Click the tab named Hardware Development. Scroll down the page, find Development Documents, and download the MCU SDK.

    Protocol Application

For more information, see Bluetooth Common Solution.

Next steps

If your MCU does not have sufficient resources or porting SDK is not feasible, you can interface the serial protocol yourself. Note that the basic features must be implemented. Otherwise, your product will not work properly. For more information, see Basic Features.

This section contains the following topics to help you quickly understand related concepts and how-to guides: