Bluetooth LE-BG24

Last Updated on : 2025-05-14 02:03:49download

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

Hardware environment

Datasheet

  • Method 1: After integrating the Bluetooth Sub-Device Development Framework, you can get the datasheet and reference manual in the vendor\bg24_ble\documents\ path.
  • Method 2: Visit the official website of Silicon Labs and get the latest information in the Documentation Center.

Development board

Peripherals

Peripherals and corresponding GPIOs

  • As the module does not require all pins to be exposed, GPIO multiplexing occurs within the SDK.
  • You can customize pin assignments in board_gpio.h according to your specific application requirements.

GPIO

The SDK defaults to using the EFR32BG24A020IM40 chip model. All peripheral descriptions below are based on this chip. To change to a 48-pin package, define BOARD_GPIO_MAX to 48 in the app_config.h file.

To operate a specific I/O in TuyaOS, you need to specify its pin number in the input parameter. For the BG24 series chip platform, the table below shows the mapping between GPIO numbers and physical I/O pins:

QFN40
GPIO No. Pin GPIO No. Pin
TUYA_GPIO_NUM_1 PC00 TUYA_GPIO_NUM_2 PC01
TUYA_GPIO_NUM_3 PC02 TUYA_GPIO_NUM_4 PC03
TUYA_GPIO_NUM_5 PC04 TUYA_GPIO_NUM_6 PC05
TUYA_GPIO_NUM_7 PC06 TUYA_GPIO_NUM_8 PC07
TUYA_GPIO_NUM_16 PB04 TUYA_GPIO_NUM_17 PB03
TUYA_GPIO_NUM_18 PB02 TUYA_GPIO_NUM_19 PB01
TUYA_GPIO_NUM_20 PB00 TUYA_GPIO_NUM_21 PA00
TUYA_GPIO_NUM_24 PA03 TUYA_GPIO_NUM_25 PA04
TUYA_GPIO_NUM_26 PA05 TUYA_GPIO_NUM_27 PA06
TUYA_GPIO_NUM_28 PA07 TUYA_GPIO_NUM_29 PA08
TUYA_GPIO_NUM_37 PD03 TUYA_GPIO_NUM_38 PD02
TUYA_GPIO_NUM_39 PD01 TUYA_GPIO_NUM_40 PD00
QFN48
GPIO No. Pin GPIO No. Pin
TUYA_GPIO_NUM_1 PC00 TUYA_GPIO_NUM_2 PC01
TUYA_GPIO_NUM_3 PC02 TUYA_GPIO_NUM_4 PC03
TUYA_GPIO_NUM_5 PC04 TUYA_GPIO_NUM_6 PC05
TUYA_GPIO_NUM_7 PC06 TUYA_GPIO_NUM_8 PC07
TUYA_GPIO_NUM_9 PC08 TUYA_GPIO_NUM_10 PC09
TUYA_GPIO_NUM_18 PB05 TUYA_GPIO_NUM_19 PB04
TUYA_GPIO_NUM_20 PB03 TUYA_GPIO_NUM_21 PB02
TUYA_GPIO_NUM_22 PB01 TUYA_GPIO_NUM_23 PB00
TUYA_GPIO_NUM_26 PA00 TUYA_GPIO_NUM_27 PA01
TUYA_GPIO_NUM_28 PA02 TUYA_GPIO_NUM_29 PA03
TUYA_GPIO_NUM_30 PA04 TUYA_GPIO_NUM_31 PA05
TUYA_GPIO_NUM_32 PA06 TUYA_GPIO_NUM_33 PA07
TUYA_GPIO_NUM_34 PA08 TUYA_GPIO_NUM_35 PA09
TUYA_GPIO_NUM_43 PD05 TUYA_GPIO_NUM_44 PD04
TUYA_GPIO_NUM_45 PD03 TUYA_GPIO_NUM_46 PD02
TUYA_GPIO_NUM_47 PD01 TUYA_GPIO_NUM_48 PD00

PWM

By default, there are five PWM channels, occupying three channels of Timer0 and two of Timer1. Both Timer0 and Timer1 are 32-bit timers.

Channel Pin
0 PC01
1 PC02
2 PA04
3 PA05
4 PA06

UART

The system defaults to using two UART groups, with UART0 mapped to USART0 and UART1 mapped to EUSART0. The EUSART (only two groups available) can be multiplexed as SPI, UART, or card reader interfaces. Here, only its UART functionality is utilized.

UART Feature Pin Remarks
UART0 TX PD03 Authorization and testing
UART0 RX PD02 -
UART1 TX PA00 Demo not used
UART1 RX PB00 -

SPI

SPI Feature Pin
SPI0 CS PC00
SPI0 CLK PC03
SPI0 SDI PA00
SPI0 SDO PB00

ADC

The chip supports 16 input channels, each of which can be configured as positive input (posInput) and negative input (negInput) modes. By default, negInput is connected to ground (GND, suitable for single-ended sampling). All I/Os of PAx, PBx, PCx, and PDx can be mapped to the input ports of IADC. They can be configured as single-channel sampling or multi-channel auto-scanning sampling mode.

By default, the SDK only supports one ADC to optimize resource usage. For additional channels, you can configure them by yourself.

Channel Pin
0 PB02

I2C

I2C Feature Pin
IIC0 SCL PB01
IIC0 SDA PB02

Key control

PB04:

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

Power LED

PA08: Used for power-on time detection. It is set to high level after entering the main function.

Power consumption description

  • Broadcasting at 100 ms intervals results in approximately 2.5 mA typical power consumption.

  • Low-power broadcasting at 100 ms intervals consumes approximately 320 μA in EM2 mode.

  • By default, 1-second interval broadcasting consumes approximately 35 μA.

  • Without broadcasting, the EM2 power consumption is approximately 3.2 μA.

For more information, see vendor\bg24_ble\documents\bg24_QA.md.

Software environment

  • Make sure the make command line tool has been installed in the environment, or search and install make, configure the environment variables, and compile again.

  • The SDK includes the pre-packaged Commander CLI tool (for flashing and log output), located at vendor/bg24_ble/toolchain/software/commander.

  • The toolchain is integrated into the SDK, so you do not need to download the toolchain again.

Flashing environment

  1. Flash and erase: Click in the order shown below to perform the flash and erase operations.

    Bluetooth LE-BG24
  2. Logging system (RTT): Click in the order shown below to view the software running log and get debugging information.

    Bluetooth LE-BG24

Bluetooth LE-BG24 SDK

  • Flash memory allocation

    The allocated application region is 352 KB, with approximately 270 KB actually utilized.

    Bluetooth LE-BG24

  • SDK configuration

    For more information on setting up the onboard GPIOs, be sure to refer to the documentation.

  • Flash memory allocation configuration

    For flash memory allocation settings, refer to the document bg24_flash.md located at vendor/bg24_ble/documents.