“
Product Information
Specifications
- Product Name: Flash and Authorize CB Modules
- Version: 20240614
- Online Version
Product Usage Instructions
1. Applicability
After embedded firmware development, you need to flash the
firmware to the module and authorize the module to connect to the
cloud. This topic describes three options to flash the firmware and
authorize the module.
2. Preparation
2.1 Register with the PMS
Open Smart PMS and sign up. Select Personal developer in Type
and enter the registration information. Then, you will receive an
email after registration.
2.2 Download and Install Production Toolkit
Follow these steps to download and install the Production
Toolkit:
- Log in to the Smart PMS.
- Choose Knowledge Base Management > Software Download. Find
Production Toolkit and download it. - Open the installer. When prompted, click Run anyway.
- Follow the onscreen instructions to begin installing.
- After installation, open the software, log in with your Smart
PMS account, and click TYMZ.
2.3 Download Beken Writer
Click on bk_writer_gui_V1.6.3 to download the Beken Writer
flashing tool.
3. Flash Firmware
The flashing process varies depending on different development
boards or modules. If you develop with the Sandwich development
board, it’s recommended to use the Cloud Module Burning
Authorization Platform software to flash the firmware.
3.1 Custom Development
This method applies to the product release step in the custom
development solution. Upload the compiled firmware to the Tuya
Developer Platform, get the token, and then use the Cloud Module
Burning Authorization Platform software to flash the firmware and
authorize the module.
Only the authorized module can be connected to the Tuya
Developer Platform. You can use the Beken Writer to flash existing
or updated firmware to an authorized module.
FAQs
4.1 Failed to get token, no permissions for actions
This error occurs when there are insufficient permissions for
actions related to token retrieval.
4.2 Bus contention error
This error indicates a conflict on the bus during
communication.
4.3 Fail to get firmware fingerprint
This error occurs when there is a failure in obtaining the
firmware fingerprint.
4.4 Fail to enter production test
This error indicates a failure to enter the production test
mode.
“`
Flash and Authorize CB Modules
Version: 20240614
Online Version
Contents
Contents
1 Applicability
2
2 Preparation
3
2.1 Register with the PMS . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Download and install Production Toolkit . . . . . . . . . . . . . . . . . 4
2.3 Download Beken Writer . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Flash firmware
9
3.1 Custom development . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Sandwich Development Board . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Beken Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4 FAQs
24
4.1 Failed to get token, no permissions for actions . . . . . . . . . . . . . 24
4.2 Bus contention error . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3 Fail to get firmware fingerprint . . . . . . . . . . . . . . . . . . . . . 25
4.4 Fail to enter production test . . . . . . . . . . . . . . . . . . . . . . . 25
I
Contents
After embedded firmware development, you need to flash the firmware to the module and authorize the module to connect to the cloud. This topic describes three options to flash the firmware and authorize the module.
· Custom development: applies to the product release step in the custom development solution.
· Sandwich development board: flashes firmware to and authorizes the Sandwich development board.
· Flashing tool from the chip vendor: applies to the development step. You can flash firmware to the module unlimited times with authorizing the module once. :::important In this topic, a credential, a license, and a token mean the same thing. :::
1 / 28
1 Applicability
1 Applicability
This topic applies to CBX series modules with the BK7231N built in. · CBU · CBU-IPEX · CBLC5 · CBLC9 · CB1S · CB3S · CB3L · CB2S · CB8P · CB2L · CB3SE · CBU-NL · CB3S-NL
2 / 28
2 Preparation
2 Preparation
Before you flash the firmware and authorize the module, you need to have the following items ready:
· An account of the Smart PMS · Production Toolkit software installed on your computer · Beken Writer from the chip vendor installed on your computer · A USB to UART converter
2.1 Register with the PMS
Open Smart PMS and sign up. Select Personal developer in Type and enter the registration information. Then, you will receive an email after registration.
3 / 28
2 Preparation
2.2 Download and install Production Toolkit
2.2.1 Download Production Toolkit 1. Log in to the Smart PMS. 2. Choose Knowledge Base Management > Software Download. Find Production Toolkit and download it.
2.2.2 Install Production Toolkit 1. Open the installer. When you are prompted with the following window, click More info.
4 / 28
2 Preparation
2. Click Run anyway. 3. Follow the onscreen instructions to begin installing. You can specify an instal-
lation directory as needed. 4. After installation, open the software and log in with your Smart PMS account
and password. 5. Click TYMZ.
5 / 28
2 Preparation
6. Check the installation result.
· If you have a yellow screen, it means the installation is successful. You can 6 / 28
2 Preparation then download the Beken Writer. · If you have a white blank screen, you need to set the software to make it run correctly. 1. Choose File > Set Up.
Figure 1: img 2. In Basic Setting, change 1*1 for Multi Selection to 1*2 and click OK. You will have two yellow screen sections.
7 / 28
2 Preparation
Figure 2: img 3. Then, change 1*2 back to 1*1. This software will work fine.
2.3 Download Beken Writer
Click bk_writer_gui_V1.6.3 to download the Beken Writer flashing tool.
8 / 28
3 Flash firmware
3 Flash firmware
The flashing process varies, depending on different development boards or modules. If you develop with the Sandwich development board, we recommend that you use the Cloud Module Burning Authorization Platform software to flash the firmware.
3.1 Custom development
This method applies to the product release step in the custom development solution. Specifically, upload the compiled firmware to the Tuya Developer Platform, get the token, and then use the Cloud Module Burning Authorization Platform software to flash the firmware and authorize the module.
Only the authorized module can be connected to the Tuya Developer Platform. You can use the Beken Writer to flash existing or updated firmware to an authorized module.
3.1.1 Upload firmware
1. Log in to the Tuya Developer Platform, click the target product, and then go to the Hardware Development step.
2. Click Add custom firmware and complete the required information.
Parameter name Firmware identifier
Flash Size
Description
The Firmware Identifier must be identical to the name of the project folder under the apps directory. Assume that the firmware identifier is wifi_one_light. You should upload the production file of the project wifi_one_light under the apps directory.
The Flash Size is 16 Mbit, equal to 2 MB. See the datasheet for the flash size of the network module you use.
9 / 28
Parameter name Parameters not framed in red
3 Flash firmware
Description Note: 1 byte = 8 bits. 16 Mbit ÷ 8 = 2 MB. Use the default settings.
1. Click Upload Firmware to upload the firmware in the next step. Set the following parameters and click Save.
Parameter name Firmware version Firmware for production
Description
The Firmware Version must be identical to the one used for compilation. Upload the binary file with the suffix QIO.
10 / 28
Parameter name
User area firmware Firmware updates Operation mode
3 Flash firmware
Description Upload the binary file with the suffix UA. Upload the binary file with the suffix UG. Select the QIO option.
11 / 28
3 Flash firmware
1. Click Enable Firmware. 12 / 28
3 Flash firmware
2. Choose General availability for deployment scope and click Save and Enable. General availability is selected to facilitate product management for you as an individual developer. If your product is built for mass production, proceed with caution when choosing the development scope.
13 / 28
3 Flash firmware
3.1.2 Get production credentials After the firmware is uploaded to and enabled on the Tuya Developer Platform, you can get free licenses. They are required when you flash the firmware and autho-
14 / 28
3 Flash firmware rize the module by using the Cloud Module Burning Authorization Platform software.
1. Click Get 2 Free Licenses.
2. For Delivery Mode, choose Credential and click Submit. · Credential: The flashing and authorization software writes a unique credential to a device. It can read the specified numbers of credentials and write them to devices in bulk. To use credentials, make sure you have uploaded the production firmware to the Tuya Developer Platform. · License List: A list provides license information in plain text, which must be written to devices manually one by one. · Credential (Authorization Only): The flashing and authorization software writes a unique credential to a device for the purpose of authorization only without the need for firmware.
15 / 28
3 Flash firmware
Figure 3: get_token_2 3. Find your product by PID and click Download Credential.
4. Extract the downloaded file and open the Token_information.txt file. Copy the credential.
5. Open the Cloud Module Burning Authorization Platform software, enter your credential in the token input box, and select Burning Authorization for the work station. If you get an error message saying Failed to get token, no permissions for actions, follow the instructions in the FAQs section to troubleshoot the problem.
16 / 28
3 Flash firmware
3.1.3 Flashing and Authorization 1. Open the Cloud Module Burning Authorization Platform software, click Enter Token, enter your credential, select Burning Authorization for the work station, and click OK.
17 / 28
3 Flash firmware
2. Connect your board to your computer by using a USB to UART converter. The pin connection table is as below:
USB to UART converter pins
VCC GND TX RX
Sandwich SoC board pins
VCC GND RX TX
3. Select the correct COM Port and click Run. Immediately power off the board and power on it again. Alternatively, you can directly press the reset button to restart the board.
:::important
· To restart the board, do not directly disconnect the USB to UART converter from your computer. Otherwise, flashing will fail. You should disconnect the VCC and GND jumper wires between the board and the USB to UART converter and connect them again.
· The CBU board comes with a USB to serial CH340 chip. After you click Run on the software, press the reset button on the board to restart it.
18 / 28
3 Flash firmware
:::
1  1. (Optional) If you failed to enter the production test, it might be because the
board has been connected to the network for more than 15 minutes and the testing channel has been shut down. For more information about this issue, see Failed to enter production test.
3.2 Sandwich Development Board
This method applies only when you flash the firmware to and authorize the Sandwich development board. For the products created based on the no-code development solution on the Tuya Developer Platform, they must be bound with the Sandwich SoC microcontroller board. This way, you can request licenses as the credentials (tokens) from the Tuya Sandwich Evaluation Kit. Otherwise, if your account is not bound with a Sandwich SoC microcontroller board, the network module cannot be granted a token for the product in the no-code development solution. Thus, flashing and authorization cannot be implemented for the module.
3.2.1 Sandwich development board Go to Tuya Developer Platform > Product > IoT Lab > Evaluation Kit, and click Add Development Board. In the dialog box that appears, enter the ID and password of the board.
19 / 28
3 Flash firmware
3.2.2 Get the token After the board is bound, click Request a new authorization code for the board, and in the dialog box that appears, select the target product to get the token.
20 / 28
3 Flash firmware
3.2.3 Flashing and Authorization 1. Copy the token from the Tuya Developer Platform and open the Cloud Module Burning Authorization Platform software.
21 / 28
3 Flash firmware
2. For more information, see Flash firmware and authorize module.
3.3 Beken Writer
This method applies to the development step. You can flash firmware to the module unlimited times with authorizing the module once. The module must be authorized before flashing. Select the correct flash partition to ensure writing to the right section. Otherwise, the program cannot run as expected.
During development, flashing and authorization is always required each time the Cloud Module Burning Authorization Platform software is used. To improve efficiency, you can use the flashing tool from the chip vendor to flash firmware to an authorized module unlimited times. 3.3.1 Beken Writer The Beken Writer tool is used only to flash the firmware to the application zone and is unable to authorize the module. You can use this tool to flash an authorized module. Therefore, you do not need to upload firmware to the Tuya Developer Platform for
22 / 28
3 Flash firmware flashing and authorization with the Cloud Module Burning Authorization Platform software each time the firmware is updated.
1. Select the chip model of the target module from the Flashing Object dropdown list. For more information, see Datasheets of Network Modules.
2. Click Browse and select the binary file with the suffix UA. 3. Set Start Address to 0x00011000 and set Operation Length to 0x00119000. 4. Select the correct serial port from COM Port and set Baud Rate to the maxi-
mum value to accelerate the flashing speed. 5. Click Run. Immediately power off the board and power on it again to start
flashing. The updated firmware will be flashed to the module. There is no need to authorize the module with the Cloud Module Burning Authorization Platform software again.
23 / 28
4 FAQs
4 FAQs
4.1 Failed to get token, no permissions for actions
When you enter the credential, an error message saying Failed to get token, no permissions for actions is returned. Troubleshooting Log in to the Smart PMS. Choose Production Manage > Work Order Management > Activation Code Verification. Enter your credential with issue and click OK. Go back to the software. Enter your credential again and you should be good to go.
4.2 Bus contention error
This error occurs possibly because other software occupies the required serial port for flashing.
24 / 28
4 FAQs
Troubleshooting Close all flashing tools, or plug off the USB to TTL converter and plug it into the computer.
4.3 Fail to get firmware fingerprint
In the authorization-only scenario, the failure to get the firmware fingerprint might occur. The possible cause is that the flashed firmware name or version number does not match the authorized firmware name or version number. Troubleshooting
1. Enter the token that matches the firmware fingerprint and then run authorization.
2. Try flashing and authorization again. This method does not apply to the production certificate of Authorization Only.
4.4 Fail to enter production test
If the module has been connected to the network for more than 15 minutes, the testing channel will be shut down. During flashing and authorization, if the failure of entering the production test occurs and a message saying have activated over 15 min, not enter mf_init is logged, this means the device has disabled the production test mode. Troubleshooting You need to erase the flashing data before the authorization is successful.
25 / 28
4 FAQs
4.4.1 Modify code (generic method) If the failure of entering the production test occurs, you can call the function mf_test_ignore_close_flag(); in the function pre_device_init() of the file tuya_device.c to ignore the flag that disables the production test. This avoids the authorization failure caused by the disabled production test.
26 / 28
4 FAQs
4.4.2 Erase data with chip manufacturer’s tool for Beken series Open the bk_writer tool provided by the chip vendor and change Flashing Object to the required chip. For more information, see Datasheets of Network Modules. Settings for development boards with Beken chips:
· WB3S: Select BK7231 from the Flashing Object drop-down list. · CBU: Select BK7231N from the Flashing Object drop-down list. · Enter 0x001EE000 in start address and 0x00012000 in operation length. Select the COM port, click Erase Flash, and then restart the module to start erasing the memory data.
27 / 28
4 FAQs 28 / 28
Documents / Resources
![]() | tuya Flash and Authorize CB Modules [pdf] User Guide Flash and Authorize CB Modules, Authorize CB Modules, CB Modules, Modules |