Tuya CB Modules: Flash and Authorize Guide

Version: 20240614

1. Applicability

This guide applies to CBX series modules with the BK7231N built-in, including:

2. Preparation

Before flashing and authorizing the module, ensure you have the following:

2.1 Register with the PMS

Open Smart PMS, sign up, select 'Personal developer' in the 'Type' field, and enter your registration information. You will receive an email after registration.

The registration process involves filling in basic information such as area, type, company, mailbox, mobile number, verification code, applicant name, and the reason for application. You must also read and agree to the Terms of Service, Legal Notices, and Privacy Policy.

2.2 Download and Install Production Toolkit

2.2.1 Download Production Toolkit

  1. Log in to the Smart PMS.
  2. Navigate to 'Knowledge Base Management' > 'Software Download'.
  3. Find and download the 'Production Toolkit'.

2.2.2 Install Production Toolkit

  1. Open the installer. If prompted with a 'Windows protected your PC' message, click 'More info' and then 'Run anyway'.
  2. Follow the onscreen instructions to install, specifying the installation directory as needed.
  3. After installation, open the software and log in with your Smart PMS account and password.
  4. Click 'TYMZ'.
  5. Check the installation result. A yellow screen indicates a successful installation.

If you encounter a white blank screen, you need to configure the software:

  1. Go to 'File' > 'Set Up'.
  2. In 'Basic Setting', change 'Multi Selection' from '1*1' to '1*2' and click 'OK'.
  3. Change '1*2' back to '1*1'. The software should now work correctly.

2.3 Download Beken Writer

Download the Beken Writer flashing tool by clicking the provided link (e.g., bk_writer_gui_V1.6.3).

3. Flash Firmware

The flashing process varies depending on the development board or module. For the Sandwich development board, the Cloud Module Burning Authorization Platform software is recommended.

3.1 Custom Development

This method is for the product release step in a custom development solution. It involves uploading the compiled firmware to the Tuya Developer Platform, obtaining a token, and then using the Cloud Module Burning Authorization Platform software to flash and authorize the module. Only authorized modules can connect to the Tuya Developer Platform. The Beken Writer can be used to flash existing or updated firmware to an authorized module.

3.1.1 Upload Firmware

  1. Log in to the Tuya Developer Platform, select the target product, and navigate to the 'Hardware Development' step.
  2. Click 'Add custom firmware' and complete the required information.

Parameter Name: Firmware Identifier
Description: Must be identical to the project folder name under the 'apps' directory (e.g., wifi_one_light). Upload the production file from this project folder.

Parameter Name: Flash Size
Description: Typically 16 Mbit (2 MB). Refer to the module's datasheet for the exact flash size.

Parameter Name: Firmware Version
Description: Must be identical to the version used during compilation.

Parameter Name: Firmware for production
Description: Upload the binary file with the .bin or .QIO suffix.

Parameter Name: User area firmware
Description: Upload the binary file with the .UA suffix.

Parameter Name: Firmware updates
Description: Upload the binary file with the .UG suffix.

Parameter Name: Operation mode
Description: Select the QIO option.

After uploading firmware, click 'Upload Firmware' and then 'Save'.

Next, enable the firmware version:

  1. Click 'Enable Firmware'.
  2. Choose 'General availability' for the deployment scope and click 'Save and Enable'. 'General availability' is suitable for individual developers. Use caution for mass production scenarios.

3.1.2 Get Production Credentials

After the firmware is uploaded and enabled, obtain free licenses (credentials) from the Tuya Developer Platform. These are required for flashing and authorization using the Cloud Module Burning Authorization Platform software.

  1. Click 'Get 2 Free Licenses'.
  2. In 'Delivery Mode', select 'Credential' and click 'Submit'.

Types of credentials:

Find your product by PID and click 'Download Credential'. Extract the downloaded file and copy the credential from the Token_information.txt file.

Open the Cloud Module Burning Authorization Platform software, enter the credential in the token input box, and select 'Burning Authorization' for the work station.

3.1.3 Flashing and Authorization

  1. Open the Cloud Module Burning Authorization Platform software.
  2. Click 'Enter Token', input your credential, select 'Burning Authorization' as the work station, and click 'OK'.
  3. Connect your board to the computer using a USB to UART converter. Refer to the pin connection table for USB to UART converter pins and Sandwich SoC board pins (VCC, GND, TX, RX).
  4. Select the correct COM Port and click 'Run'. Immediately power off the board and then power it on again, or press the reset button to restart.

Important Notes:

(Optional) If you fail to enter production test, ensure the board has been connected to the network for less than 15 minutes, as the testing channel may shut down.

3.2 Sandwich Development Board

This method is for flashing and authorizing Sandwich development boards, particularly those created with the Tuya no-code development solution. The module must be bound with a Sandwich SoC microcontroller board to request credentials (tokens) from the Tuya Sandwich Evaluation Kit. Without this binding, tokens cannot be granted, and flashing/authorization cannot be performed.

3.2.1 Sandwich Development Board Setup

  1. Navigate to 'Tuya Developer Platform' > 'Product' > 'IoT Lab' > 'Evaluation Kit'.
  2. Click 'Add Development Board' and enter the board's ID and password in the dialog box.

3.2.2 Get the Token

After the board is bound, click 'Request a new authorization code for the board'. In the dialog box, select the target product to obtain the token.

3.2.3 Flashing and Authorization

  1. Copy the token from the Tuya Developer Platform and open the Cloud Module Burning Authorization Platform software.
  2. For more information, refer to the 'Flash firmware and authorize module' section.

3.3 Beken Writer

This method is for the development step, allowing unlimited flashing with a single authorization. The module must be authorized before flashing. Ensure the correct flash partition is selected for proper writing. The Cloud Module Burning Authorization Platform software is used for flashing and authorization each time. For efficiency, the chip vendor's flashing tool can flash authorized modules unlimited times.

3.3.1 Beken Writer Usage

The Beken Writer tool flashes firmware to the application zone and cannot authorize the module. It can be used to flash an authorized module. Firmware upload to the Tuya Developer Platform is not required for this tool.

  1. Select the target module's chip model from the 'Flashing Object' dropdown list (e.g., BK7231 for WB3S, BK7231N for CBU).
  2. Click 'Browse' and select the binary file with the .UA suffix.
  3. Set 'Start Address' to 0x00011000 and 'Operation Length' to 0x00119000.
  4. Select the correct serial port from 'COM Port' and set 'Baud Rate' to the maximum value for faster flashing.
  5. Click 'Run'. Power cycle the board to start flashing. The updated firmware will be flashed without needing re-authorization.

To erase memory data:

For Beken chips, specific settings are:

4. FAQs

4.1 Failed to get token, no permissions for actions

Troubleshooting:

  1. Log in to Smart PMS.
  2. Navigate to 'Production Manage' > 'Work Order Management' > 'Activation Code Verification'.
  3. Enter your credential and click 'OK'.
  4. Return to the flashing software and re-enter your credential.

4.2 Bus contention error

Troubleshooting: Close all flashing tools or unplug and replug the USB to TTL converter.

4.3 Fail to get firmware fingerprint

This may occur if the flashed firmware name or version number does not match the authorized one.

Troubleshooting:

  1. Enter the correct token matching the firmware fingerprint and run authorization.
  2. Try flashing and authorization again (this does not apply to 'Authorization Only' certificates).

4.4 Fail to enter production test

This can happen if the module has been connected to the network for over 15 minutes, shutting down the testing channel. The message 'have activated over 15 min, not enter mf_init' indicates the device has disabled production test mode.

Troubleshooting: Erase flashing data before authorization.

4.4.1 Modify code (generic method)

To avoid authorization failure due to disabled production test, call the function mf_test_ignore_close_flag(); within the pre_device_init() function in the tuya_device.c file.

4.4.2 Erase data with chip manufacturer's tool for Beken series

Use the bk_writer tool. Select the appropriate chip (BK7231 or BK7231N) in the 'Flashing Object'. Set the start address and operation length as specified (e.g., 0x001EE000 and 0x00012000 for CBU). Select the COM port, click 'Erase Flash', and restart the module.

Models: Flash and Authorize CB Modules, Authorize CB Modules, CB Modules, Modules

File Info : application/pdf, 30 Pages, 1.87MB

PDF preview unavailable. Download the PDF instead.

Flash and Authorize CB Modules Tuya Developer Platform Tuya Developer Platform

References

LaTeX via pandoc with the Eisvogel template xdvipdfmx (20200315)

Related Documents

Preview Tuya BK3432 Flash and Authorization Guide
A comprehensive guide on flashing and authorizing the Tuya BK3432 chip for connection to the Tuya Developer Platform. Covers hardware preparation, firmware authorization, and necessary tools.
Preview Tuya TyuTool Firmware Download and Debug Guide
A comprehensive guide for developers on using Tuya's TyuTool to download firmware to T5 modules, configure serial ports and baud rates, and view debug logs. Includes instructions for installation and troubleshooting.
Preview TuyaOS Product Creation Guide
A comprehensive guide on creating custom products using the TuyaOS platform, covering steps from product category selection to obtaining authorization codes.
Preview Tuya Flash Firmware Guide for T5-AI Gateway
A comprehensive guide on flashing firmware to the Tuya T5-AI gateway development board using the Tuya Wind IDE and OTA updates.
Preview Tuya Trade-in Process and Conditions
This document outlines the Tuya trade-in process, detailing the conditions, operational steps for token acquisition and registration, production certificate confirmation, and production testing. It also includes frequently asked questions and tool logic for the trade-in service.
Preview Tuya BLE SDK Guide for Developers
Comprehensive guide to the Tuya BLE SDK, covering framework, concepts, porting, API reference, OTA upgrades, and production testing for Bluetooth Low Energy device development with Tuya Smart.
Preview Tuya Firmware Update Guide
A comprehensive guide to firmware updates for devices integrated with the Tuya platform, covering update processes, status checks, error codes, and API descriptions.
Preview Tuya Firmware Update Guide for Smart App SDK
A comprehensive guide to firmware updates using the Tuya Smart App SDK, covering update processes, status queries, error codes, and API descriptions for developers.