Protocol Application

Last Updated on : 2021-10-08 03:25:32download

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

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

Concepts

Wi-Fi generic firmware

The Wi-Fi generic firmware is developed by Tuya for adapting to different Wi-Fi chip platforms. Your MCU can interface with Tuya’s Wi-Fi modules that have the generic firmware flashed to enable your product to connect to the Tuya IoT Platform. Besides it, the generic firmware provides extended features such as OTA update, time sync, and weather services.

In a nutshell, the Wi-Fi generic firmware provides two essential functions.

  • Network connectivity: The Wi-Fi module flashed with the generic firmware and license can be connected to the Tuya IoT Platform.

  • Raw data pass-through: With the serial protocol, the Wi-Fi 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.

Wi-Fi generic serial protocol

The serial communication between the Wi-Fi module flashed with the generic firmware and the MCU follows the Wi-Fi generic serial protocol. The serial communication enables the Wi-Fi 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 Wi-Fi 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 0x08.

  • Extended features: a bunch of useful features to help you improve user experiences, such as OTA update, local time sync, and Wi-Fi functionality test.

    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 Wi-Fi 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 Platform. For more information, see MCU SDK Porting.

The MCU SDK requirements for the MCU are as follows.

  • Memory: 4 KB
  • RAM: About 100 bytes of the RAM are required, depending on the data length of the data point (DP). If you enable OTA updates, it must be greater than 260 bytes.
  • Nested function: 9-level.

Steps to get the MCU SDK are as follows.

  1. Log in to the Tuya IoT 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.

For more information about the development process, see Wi-Fi 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.