Flash and Authorize WR Modules

This topic describes two solutions about how to flash firmware to and authorize WR series modules.

Background information

After the module SDK firmware development is completed, you need to flash and authorize the module to enable connection to the Tuya Cloud. Tuya provides the following two flashing and authorization methods for different scenarios.

Supported chips

Applicable to the WR Series Module with the core chip of RTL8710BN. The following models are included.

Binaries

After this type of chip is compiled, four kinds of .bin files are generated as shown below:

Schematic diagram of Tuya technical documentation

Things to note

When the following circumstances occur during firmware compiling, run the command sudo apt-get install gawk to install gawk dependency.

image20201221095401437.png

Method 1: An integrated solution for flashing and authorization

This solution is suitable for the release stage. Since the Tuya module must be authorized to connect to the Tuya platform, the authorization step cannot be omitted.

The overall process of this solution is as follows:

  1. Upload the compiled firmware to the Tuya IoT Platform.
  2. A firmware key is generated on the platform, and an authorization code is generated based on the firmware key.
  3. flash and authorize the modules on the Cloud Module burning Authorization Platform.

Prepare hardware

Hardware preparation includes serial port assistant, any module equipped with chip platform RTL8710BN (using WR3 Module Datasheet as an example in this topic), and hardware connection diagram.

Schematic diagram of Tuya technical documentation
Module pin Serial pin
RXD1 TX
TXD1 RX
VCC VCC3.3V
GND GND

Upload firmware

  1. In step 3 Hardware Development of the product development process on the Tuya IoT Platform, click Add custom firmware.
    image.png

  2. Enter the firmware parameters and click OK.

    Parameter Description
    Firmware identifier It must be consistent with the name of the compiled firmware.
    Firmware type The module firmware
    Other parameters Enter as required.

    image.png

  3. In the Generated Firmware area, click Upload production firmware.
    Upload production firmware

  4. Upload the firmware and click Confirm.

Get authorization code and flash

Get the authorization code on the platform according to the PID, and download the Cloud Module burning Authorization Platform in reference to flashing and Authorization.

The flashing steps are:

  1. Power off the module in the first place.
  2. On the Cloud Module burning Authorization Platform, enter the authorization code and click Run.
  3. After the flashing is completed, power on the module.

Method 2: Separated solutions for flashing and authorization

This solution is suitable for the development stage. The feature of this solution is to authorize once and flash repeatedly. If the module has already been authorized once, you need only to modify and flash the firmware demo to make the module work properly.

Prepare hardware

Hardware preparation includes serial port assistant, any module equipped with chip platform RTL8710BN (using WR3 Module Datasheet as an example in this topic), and hardware connection diagram.

Note:

Module pin Serial pin
Log_TX RX
Log_RX TX
VCC VCC3.3V
GND GND

Prepare software

Download the RTL8710BN chip burning tool. Open the chip burning tool and it is shown as follows.

Things to note

Download description

Method 1: flash the user area firmware

Note: Connect Log_TX to GND before the module is powered on, and connect Log_TX to serial port RX after the module is powered on.

The prerequisite for this flashing method is that the boot firmware already exists.

  1. Select the chip and load the .bin file shown in the diagram, and enter 0x0800B000 as the address.

  2. Click Download.

Method 2: flash the whole firmware

Note: Connect Log_TX to GND before the module is powered on, and connect Log_TX to serial port RX after the module is powered on.

  1. As it is shown below, use an empty slice (without boot firmware) to load the QIO file, and enter 0x080000000 as the address.

  2. Click Download.

  3. After the flashing is completed, switch to the user area firmware and enter ATSC+Enter after power on. It is shown as follows.1.png

  4. The module receiving the ATSC+Enter command and printing the log as shown below indicates that the application code has been successfully started, and it can run properly after power on again.

    2.png