Last Updated on : 2025-06-03 09:27:25download
This topic describes the basics of the chip platform used in TuyaOS development. For more information, visit Tuya Developer Forum.
To get the latest version, visit the TI website.
Reuse the TI official development board. For the latest version instructions, refer to the official documentation.
To enable newly added peripherals, you must first configure them in the TuyaOS_CC340.syscfg
interface and then add the relevant code.
UART
This platform has one UART, used for authorization, debugging, and log output.
UART | Feature | Pin |
---|---|---|
UART 0 | TX | DIO20 |
UART 0 | RX | DIO22 |
You can configure it in the TuyaOS_CC2340.syscfg
file. The corresponding code is CONFIG_GPIO_UART2_0_TX_CONST
.
SPI
SPI | Feature | Pin |
---|---|---|
SPI0 | CS | / |
SPI0 | CLK | DIO24 |
SPI0 | SDI | DIO21 |
SPI0 | SDO | DIO19 |
I2C
I2C | Feature | Pin |
---|---|---|
I2C0 | SCL | DIO25 |
I2C0 | SDA | DIO0 |
PWM
By default, the SDK only supports Channel 0 to optimize resource usage. For additional channels, you can configure them by yourself.
Channel | Pin |
---|---|
0 | DIO24 |
ADC
By default, the SDK only supports Channel 0 to optimize resource usage. For additional channels, you can configure them by yourself.
Channel | Pin |
---|---|
0 | DIO7 |
1 | DIO6 |
2 | DIO5 |
3 | DIO2 |
4 | DIO1 |
5 | DIO0 |
6 | DIO25 |
7 | DIO24 |
8 | DIO23 |
9 | DIO22 |
10 | DIO21 |
11 | DIO20 |
Key control
DIO10:
Startup time detection pin
DIO15: Set this pin to high after entering the main
function.
The TI CC2340R5 chip is developed based on the Code Composer Studio (CCS) integrated development environment, and the firmware is flashed with UniFlash.
Please use the default path during the installation of the following software. If you encounter any issues, please reinstall using the default path and try again.
It is recommended to download the offline version, as shown below:
After downloading, install it using the default settings. Select the following component:
If you encounter issues during CCS installation, refer to Project import and build errors in CCS.
Download the SDK, and scroll down to select the version simplelink_lowpower_f3_sdk_8_40_00_61
. Make sure to select the correct version. You can install it using the default settings. It is recommended not to change the installation path.
If your SDK version is simplelink_lowpower_f3_sdk_8_40_00_61
, replace the file in the directory C:\ti\simplelink_lowpower_f3_sdk_8_40_00_61\source\ti\ble5stack_flash\lib_projects\CC2340R5\OneLib\lib\ticlang\m0p
with: OneLib.a.
Download the toolchain. Please install the toolchain and SDK under the same path, which is C:\ti\
path.
After the installation is complete and the project is imported, you can see this toolchain in CCS.
If the toolchain is not recognized when you open the CCS after installation, follow the path in the figure below and click the Refresh button.
After the above environment is installed, you can start software development. Follow the steps below to import the software project.
TuyaOS_CC2340_V3.11.0
.software\TuyaOS\.log\app_project
.Go to the download page and click Download options.
Download the file as specified in the following figure. After downloading, install it using the default settings.
Starting from TuyaOS v3.11.1
Production firmware: TuyaOS_CC2340_merge.hex
(located in software\TuyaOS\.log\app_project\Release
).
OTA firmware: TuyaOS_CC2340.bin
(located in software\TuyaOS\.log\app_project\Release
).
Starting from TuyaOS v3.11.1, the application firmware (OTA firmware) and bootloader firmware are merged into a single production firmware image.
TuyaOS v3.11.0
TuyaOS_CC2340.bin
is the application firmware, sometimes also called production firmware. For CC2340 chips, the OTA firmware and production firmware are identical (located in the Release
folder).
.hex
from .out
.noheader_bin
via .hex
.noheader_bin
adds a header
to generate .bin
. The header
contains information such as the signature.You can flash the firmware in two ways:
If you use the official development board, connect the USB interface to your computer as shown in the following figure. The development board is on the left, and XDS110 is on the right.
To connect your own development board using XDS110, the minimum wiring is as follows:
XDS110 | Device |
---|---|
VCC | VCC |
GND | GND |
SWDIO | DIO16_SWDIO |
SWDCK | DIO17_SWDCK |
nRST | RSTN |
When you use the XDS debug probe, two serial ports will appear on the computer. The serial port used for communication is indicated by the red box in the figure below.
UART | Device |
---|---|
VCC | VCC |
GND | GND |
TX | RX (DIO22) |
RX | TX (DIO20) |
/ | DIO7 |
Connect the XDS110 debugger correctly. Then, open UniFlash, enter CC2340R53, and then select the device as shown in the figure.
Click Start and follow the steps below.
Starting from TuyaOS v3.11.1, perform the following steps.
Click Program to enter its interface.
Add the production firmware.
For TuyaOS v3.11.0, perform the following steps.
Click Program to enter its interface.
Add Bootloader (located in \vendor\cc2340_ble\sdk\bootloader\mcuboot.hex
) and add application firmware.
Enter the Load Addr of the application firmware, which is 0x3000
.
Choose Settings & Utilities > Chip Erase (retain sectors specified in CCFG).
Go back to the Program interface and click Load Image to start flashing.
After successful flashing, reset the device to start running. Due to UniFlash compatibility issues, the firmware might take several seconds to run after a reset. Please wait patiently. This delay does not occur with the script-based flashing method described below.
Fundamentally, this still utilizes UniFlash, but bypasses the GUI configuration by employing a script-based approach. Therefore, UniFlash must be installed first.
How-to: Double-click the cc2340_burning.bat
script located in the software\TuyaOS\vendor\cc2340_ble\sdk\burn
directory.
For more information, refer to the README.md
file in the same directory and review the script contents.
Flashing method:
cc2340_burning_with_uart.sh
script in the software\TuyaOS\vendor\cc2340_ble\sdk\burn
directory and modify the COM port number.If you use the virtual serial port created by the XDS110 debug probe, the transfer rate will be slower due to hardware limitations. For significantly faster speeds, switch to a dedicated serial port.
For more information, refer to the README.md
file in the same directory and review the script contents.
Measure the average power consumption of a typical one-second advertisement. It is 16.06 μA at 0 dBm.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback