WiFi module MCU development overview

WiFi module MCU development overview

1. Introduction

If you have higher development and configuration requirements for the product and the “Plug and Play Solution" cannot meet the demand, you can choose the way of MCU development. You can download the MCU SDK in the third step of the product development “Hardware Debug”. The MCU SDK is This is a MCU procedure generated automatically from the product’s function datapoint according to Tuya Serial Port Communication Protocol. MCU engineer can develop this procedure quickly on this basis. This article will introduce you to the specific steps of MCU development.

2. MCU development procedure

2.1 Creating a Product on the Tuya Smart Platform and Downloading the MCU Development Package

This section describes how to create a heater product on the Tuya Smart platform as an individual developer.

  1. Visit https://iot.tuya.com and register a developer account. Then, log in to the platform using the account.

2)Click Create on the Product page. Choose Home Appliances II and select Heater.

  1. Select data points (DPs) based on product requirements. If there are custom functions, add them as required. For details about custom product functions, see https://docs.tuya.com/en/product/function.html.

4)Select a favorite app control panel template and scan the QR code to verify the effect. More panel templates are provided for enterprise accounts. To upgrade your account, contact Tuya business personnel.

5)Download an MCU development package with one click.

6)Check the downloaded package. The following figure shows the materials contained in an MCU development package.

2.2 Protocol Framework

The SDK package has the following requirements on MCU hardware resources:

  • Flash memory: 4 KB
  • RAM: tens of bytes (depending on the DP data length), or 260 KB or higher if the OTA upgrade function is required
  • The number of nested functions is 9.

Users without sufficient resources can implement protocol interworking without using the MCU SDK.

Protocols are classified into basic and functional protocols. Basic protocols are independent of products. They are common protocols of modules and include module initialization commands and some extended functional commands. Functional protocols are DP data transmitting and receiving commands that the platform automatically generates based on the definition of each product DP. You can refer to details:https://docs.tuya.com/en/mcu/mcu-protocol.html

2.3 Migrating Tuya’s MCU SDK

If the MCU resources are sufficient, you can directly download the MCU SDK resource package for development. Roadmap: Step 1: Compile the MCU basic program and migrate the SDK file. Step 2: Verify the macro definition in protocol.h. Step 3: Migrate the protocol.c file and invoke functions. Step 4: Optimize the DP data report and delivery functions. Step 5: Optimize the network configuration and indicator functions. Step 6: Optimize the product testing function.

2.4 MCU debug

Tuya provides two simulation assistants to help you improve the interworking efficiency, understand the protocol format, and verify data. One assistant simulates the Wi-Fi module, and the other simulates the MCU. Using both assistants can effectively improve the development efficiency. For details, visit https://docs.tuya.com/en/mcu/mcu_debug_assistant.html.

400 Call

Consult

400-881-8611