Bluetooth LE-CC2340

Last Updated on : 2025-04-07 09:39:46download

This topic describes the basics of the chip platform used in TuyaOS development. For more information, visit Tuya Developer Forum.

Hardware environment

Datasheet

To get the latest version, visit the TI website.

Development board

Reuse the TI official development board. For the latest version instructions, refer to the official documentation.

Bluetooth LE-CC2340

Peripherals

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:

  • Press the key to wake up the device.
  • Press and hold the key for three seconds to factory reset the device.

Startup time detection pin

DIO15: Set this pin to high after entering the main function.

Software environment

The TI CC2340R5 chip is developed based on the Code Composer Studio (CCS) integrated development environment, and the firmware is flashed with UniFlash.

Download and install CCS

Download the CCS.

It is recommended to download the offline version, as shown below:

Bluetooth LE-CC2340

After downloading, install it using the default settings. Select the following component:

Bluetooth LE-CC2340

If you encounter issues during CCS installation, refer to Project Import and Build errors in CCS.

Download and install SDK

Download the SDK, and scroll down to select the version simplelink_lowpower_f3_sdk_8_40_00_61. 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.

Bluetooth LE-CC2340

Download and install the toolchain

Download the toolchain.

Bluetooth LE-CC2340

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.

Bluetooth LE-CC2340

Import project

After the above environment is installed, you can start software development. Follow the steps below to import the software project.

  1. Choose file > Import Project(s) to open an import window.
  2. Click Browse and select the project directory to import.
  3. Click Finish.

Bluetooth LE-CC2340

UniFlash

Go to the download page and click Download options.

Bluetooth LE-CC2340

Download the file as specified in the following figure. After downloading, install it using the default settings.

Bluetooth LE-CC2340

Flash firmware

Wire connection

If you use the official development board, just plug the USB into the computer.

Bluetooth LE-CC2340

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

Firmware description

TuyaOS_CC2340.bin is the application firmware, sometimes also called production firmware. For the CC2340 chip, the OTA firmware is the same as the production firmware.

Bluetooth LE-CC2340

  1. First, generate .hex from .out.
  2. Then, generate noheader_bin via .hex.
  3. noheader_bin adds a header to generate .bin. The header contains information such as the signature.

Flashing method

  1. Connect the XDS110 debugger correctly. Then, open UniFlash, enter CC2340, and select the device as shown in the figure.

    Bluetooth LE-CC2340

  2. Click Start and follow the steps below.

    1. Click Program to enter its interface.
    2. Add Bootloader (located in \vendor\cc2340_ble\sdk\bootloader\mcuboot.hex) and add application firmware.
    3. Enter the Load Addr of the application firmware, which is 0x3000.

    Bluetooth LE-CC2340

  3. Choose Settings & Utilities > Chip Erase (retain sectors specified in CCFG).

    Bluetooth LE-CC2340

  4. Go back to the Program interface and click Load Images to start flashing.

    Bluetooth LE-CC2340

  5. After firmware is flashed, reset the device to start running.

Features

Startup time

  • Use a logic analyzer to measure the signal time difference between the VCC (3V3) pin and the startup time detection pin.
  • Detection pin: DIO15.

Bluetooth LE-CC2340

Flash partition

Bluetooth LE-CC2340

Power consumption

Measure the average power consumption of typical one-second advertising. It is 16.06 μA at 0 dBm.

Bluetooth LE-CC2340