Production Test and Example

Last Updated on : 2023-01-29 07:31:53download

The general purpose of production tests is to verify if the hardware and software functionality of an end product performs as expected.


  • PCBA test

    PCBA test refers to electrical conductivity and input/output value-based test of PCBA boards with electronic components mounted on them.

  • Final test

    Determine whether a device meets the requirements in terms of design, performance, and features, helping to find errors and correct them before delivery.

  • Aging test

    Determine the defect rate and measure the reliability of products under a controlled environment.

    New products require higher criteria for assessing the performance of components or for the final test.

    The aging test can expose defects in soldering, design, material, process, and more before products are introduced into the marketplace. It is an important process implemented to ensure the stability and durability of products.

Production test application

This topic describes how to use the Tuya IoT SDK to initiate tests on end products. The test items can vary depending on product features, so the implementation code should be implemented by you.

The production test process:

After power-on, the device under test (DUT) scans for Wi-Fi networks. If the DUT finds the Wi-Fi network designated for production testing, it enters the production test mode. Note that the production test mode will be turned off 15 minutes after the module is paired. The password of the designated Wi-Fi network is optional because the DUT will not connect to this Wi-Fi network.

Change Wi-Fi network name

Find the macro TEST_SSID in platforms/bk7231n/common/tuya_main.c. Modify this macro to change the name of the Wi-Fi network designated for production testing.

#define TEST_SSID "tuya_mdev_test1"

Production test configuration function

With the production test mode enabled, if the DUT finds the designated Wi-Fi network, it will enter the production test mode. You need to set the production test function that can be invoked when the condition is met. The function prototype:

VOID app_cfg_set(IN CONST GW_WF_CFG_MTHD_SEL mthd, APP_PROD_CB callback);


  • mthd: The working mode.
  • callback: The production test callback.


  • None

The code snippet shows that the callback is invoked in scan_test_ssid().

STATIC BOOL_T scan_test_ssid(VOID)
    if(app_prod_test) {
        app_prod_test(flag, ap->rssi);
    return TRUE;

scan_test_ssid() is executed before device_init(), so you cannot set the production test callback in device_init(). Set the production test function in app_init(); before scan_test_ssid().

Production Test and Example

Production test callback

This callback is invoked after the DUT enters the production test mode. The function prototype is as follows:

typedef VOID_T (*APP_PROD_CB)(BOOL_T flag, SCHAR_T rssi);


  • flag: Determines whether the module has been authorized.
  • rssi: Indicates the signal strength of the Wi-Fi network.


  • None

The end product test is implemented in this callback. Considerations for implementing end product tests:

  • Determine whether the DUT is authorized. Unauthorized devices cannot be connected to the Tuya IoT Development Platform. If the DUT is detected as unauthorized, it should not enter the production test mode and should give a prompt.
  • The DUT operates in an unstable network connection. It might be because the DUT is placed too far from the router, or the DUT’s hardware has an issue. In this case, the DUT should give a prompt. Identify and troubleshoot the problem.

Sample application

Turn on the designated router and power on the DUT. When the DUT finds the designated Wi-Fi network, it will enter the production test mode.

Check out the complete code on GitHub.

Production Test and Example