Last Updated on : 2024-07-26 04:30:49download
This topic describes the TuyaOS Gateway Development Kit directory, along with the compilation process, configuration files, and terminal login for the THP23-X-D development kit.
The directory structure of the TuyaOS Gateway Development Kit:
├── hardware # Hardware documentation.
├── pc
│ └── tools # Development tools.
├── software
│ ├── packages # SDK package.
│ ├── SDKInformation.json # SDK information file.
│ └── TuyaOS # SDK directory.
│ ├── apps # The sample applications, which can be modified as needed.
│ ├── build
│ ├── docs # API reference.
│ ├── include # SDK header files.
│ ├── libs # SDK libraries. You can link them as needed.
│ ├── scripts
│ ├── build_app.sh # The build script.
│ ├── CHANGELOG.md
│ ├── LICENSE # Tuya MIT License
│ ├── Makefile
│ ├── output # The build output.
│ ├── README.md
│ └── vendor # The toolchain. When you build a project, the toolchain is automatically downloaded to this directory.
└── tuya.json
The directory structure of the THP23-X-D Development Kit:
├── application_components # Open source components
├── application_drivers
├── build # Files packaged into the firmware
├── build.conf
├── build.sh
├── include # Application header file
├── libs # Application library file
├── local.mk
├── Makefile
├── output # Output directory
├── package.json
├── README.md
└── src # Application source file
Here is how to build firmware:
You have downloaded the THP23-X-D development kit to the TuyaOS/apps
directory. For more information, see Get Development Kit.
In Visual Studio Code, right-click the development kit directory and choose Build Project.
Enter the version number in the format x.x.x
(where x
is a number) and press Enter to start building.
The process output is shown in the Visual Studio Code Terminal window. After the process is completed, you can find the firmware file in the TuyaOS/output/tuyaos_core_board-tuyaos_gw_ssd202d/pack
directory.
Description of the generated files:
File name | Description |
---|---|
gateway.tar.gz |
The application package for debugging. |
tuyaos_core_board-tuyaos_gw_ssd202d_*_debug |
The application with a symbol table for debugging with GDB. |
tuyaos_core_board-tuyaos_gw_ssd202d_fw_PROD_*.tar.gz |
The full firmware for production. This archive contains firmware for three different programming options.
|
tuyaos_core_board-tuyaos_gw_ssd202d_fw_UG_*.bin |
The firmware update, used for OTA updates. |
The configuration file for the THP23-X-D application is located at build > image > tuya_user1 > config.json. You can edit the configuration file as needed. For example, change the default product ID.
Description of the fields in the configuration file:
Field | Required | Description |
---|---|---|
pid | Yes | The product ID of the device. |
user_cfg_file | Yes | The full path of this configuration file, used by the startup script. |
uuid | No | The authorization information, typically read from flash memory and written during the production phase. This field is used only when reading fails. |
authkey | No | The authorization information, typically read from flash memory and written during the production phase. This field is used only when reading fails. |
storage_path | Yes | The data storage path that must be readable, writable, and end with / . |
log_path | Yes | The log storage path that must be readable, writable, and end with / . |
cache_path | Yes | The cache storage path that must be readable, writable, and end with / . |
bin_path | Yes | The path of the executable file. |
backup_path | Yes | The backup storage path. If not specified, it defaults to the storage_path . |
sync_systime | No | Specifies whether to synchronize the system time. |
log_level | Yes | Set the log level. |
tuya | No | Service configuration. |
tuya.zigbee | No | Zigbee service. |
tuya.zigbee.dev_name | No | The serial port number. |
tuya.zigbee.cts | No | Specifies whether to enable hardware flow control.
Note: Hardware flow control must be enabled for all Zigbee modules. |
tuya.zigbee.thread_mode | No | The startup method of the Zigbee host.
|
tuya.bt | No | Bluetooth service |
tuya.bt.dev_name | No | The serial port number. |
tuya.bt.enable_hb | No | Specifies whether to enable the Bluetooth LE heartbeat check.
|
tuya.bt.scan_timeout | No | The scanning interval for Bluetooth LE, in seconds. |
tuya.bt.subdev_type | No | Set the supported sub-device types for Bluetooth. See BLE_SUBDEV_TYPE_E for the supported types. |
tuya.dp_engine | No | DP engine service. |
tuya.dp_engine.storage_path | No | The storage path for DP configuration files that must be readable, writable, and end with / . |
tuya.dp_engine.file_max_count | No | The maximum number of DP configuration files. |
tuya.dp_engine.pidTable_max_count | No | The maximum number of the pid_table elements in the DP configuration file. |
tuya.dp_engine.enable_zigbee_trans | No | Specifies whether the DP engine supports the Zigbee protocol.
|
tuya.dp_engine.enable_matter_trans | No | Specifies whether the DP engine supports the Matter protocol.
|
The THP23-X-D development board uses a one-device-one-key encryption scheme. You need the password before logging in. Submit a ticket to request the password by providing the SN of your THP23-X-D development board.
root
tygw@SSD20x
. To obtain the factory password, submit a ticket.Connect a USB to UART converter to the debugging port on the THP23-X-D development board. Refer to the table below for wire connections:
USB to UART converter | THP23-X-D development board |
---|---|
TX | RX |
RX | TX |
GND | GND |
The debugging port on the THP23-X-D development board:
Connect to the development board using a serial debugger such as PuTTY or SecureCRT, setting the baud rate to 115200
.
SSH listens on port 2333
, but it is disabled by default. You can log in via the serial port and then enable the SSH feature.
Run the following command to enable SSH.
root@SmartGateway:~# nvram set enable_ssh true
root@SmartGateway:~# nvram commit
root@SmartGateway:~# reboot
The processes for the gateway are as follows:
1100 root 2932 S /bin/sh ./app_detect.sh ./tyZ3Gw /tmp/tuya /tmp/tuya/config.json
1106 root 2932 S /bin/sh ./log_detect.sh /tmp/tuya.log 3
1114 root 2932 S /bin/sh ./process_monitor.sh /tmp/tuya /tmp/tuya/config.json
1121 root 324m S ./tyZ3Gw /tmp/tuya/tuya_user1 /tmp/tuya/config.json
Process | Description |
---|---|
app_detect.sh | Monitor the main process and restart it if it exits unexpectedly. |
log_detect.sh | The log backup script that compresses the backup when the log size exceeds 3 MB. |
process_monitor.sh | The software watchdog for the main process. |
tyZ3Gw | The main process. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback