Telink white logo with Telink word in small size

We noticed you are using Internet Explorer.

We recommend using one of the below listed browsers to enjoy the best experience of our website.

Click here to download:

Chrome

Firefox

Safari

Edge

Telink white logo with Telink word
Rotate your device top arrow

PLEASE ROTATE ME

Rotate your device bottom arrow
Preloader image
loading...
Telink white logo with Telink word in small size

Telink Bluetooth® LE Single Connection SDK (2): B85m_sample Routine Demonstration

Telink Staff

August 22, 2022

Applications

Bluetooth screen close up

Telink’s Wiki website provides software SDKs of various application scenarios for customers to use. This series of articles focuses on the “Bluetooth® Low Energy (LE) Single Connection,” a SDK for single-connection applications where a Bluetooth chip makes a point-to-point connection with a host (usually a mobile phone) or a host makes a point-to-point connection with another host.

This article describes the uses of this SDK’s B85m_ble_sample routine in detail to help customers familiarize themselves with it quickly and speed up the development of projects.

1. Ble_sample Routine Description

B85m_ble_sample in the single-connection SDK is compatible with 825x chips and 827x chips, so the compilation options are divided into 825x_ble_sample and 827x_ble_sample (which, moving forward, will collectively be referred to as ble_sample).

The ble_sample routine is a simple slave demo with broadcast and connection capabilities. The BLE service has HID service, which, after a connection has been made, can be itemized as a HID device and can control volume, input numbers, and perform other functions.

2. Development Board Selection

Let’s look at the TLSR8258 chip as an example. There are two commonly used development boards. One is the TLSR8258 Development Board (model C1T139A30_V1.2), as shown in the following figure:

The other is the TLSR8258 Dongle board (model C1T139A3_V2.0A), as shown below:

Similarly, the TLSR8278 chip has these two types of development boards, which will not be described here.

3. Usage Demo

1. By default, the current test is enabled in the code (key presses are disabled). Disable the current test first. In the ble_sample/app_config.h file, the modifications are as follows:

#define TEST_CONN_CURRENT_ENABLE   0

2. Depending on the type of development board, the macro definitions enabled in the code are different. In the ble_sample/app_config.h file, the modified macro definitions are as follows:

  • If you are using the TLSR8258 Development Board:
    • #define BOARD_ SELECT       BOARD_ 825X_ EVK_ C1T139A30
    • At this time, the UI_KEYBOARD_ENABLE macro is enabled by default. It uses a key matrix of two rows and two columns, corresponding to the development board’s four keys SW2 ~ SW5.
  • If you are using the TLSR8258 Dongle:
    • #define BOARD_SELECT        BOARD_825X_DONGLE_C1T139A3
    • At this time, the UI_BUTTON_ENABLE macro is enabled by default. Two buttons correspond to the SW1 and SW2 buttons of the TLSR8258 Dongle.

3. Clean the project, rebuild, compile, and download the generated firmware to the development board. Power on again or reset it once.

4. On the phone → Settings → Bluetooth page. Scan to “VHID.” Click to establish a connection and select pairing.

5. Click the button on the development board and the corresponding display will appear on the mobile phone.

On the TLSR8258 Development Board:

  • Press the SW2 button to increase the volume of the phone
  • Press the SW4 button to decrease the volume of the phone
  • Press the SW3 button, enter the text “1” on the text input page of the mobile phone
  • Press the SW5 button, enter the text “2” on the text input page of the mobile phone

On the TLSR8258 Dongle Board:

  • Press the SW1 button to increase the volume of the phone
  • Press the SW2 button to decrease the volume of the phone

*Note: The ble_sample routine is an HID device and does not need to be used in the mobile app. If you use the mobile app to connect, you will not see the effects from the above buttons.

4. Current Test

By default, the ble_sample routine enables the current test function and disables the display of buttons and LEDs.

#define TEST_CONN_CURRENT_ENABLE 1

If the developer needs to test the low-power data of various broadcast intervals or connection intervals, the main parameters to modify are as follows:

1. Transmission power

The higher the transmission power, the higher the instantaneous current of RF transmission. The macros are defined as follows:

#define MY_RF_POWER_INDEX RF_POWER_P0dBm

2. Broadcast interval

The smaller the broadcast interval, the more frequently the RF sends data and the higher the power consumption. The macros are defined as follows:

#define MY_ADV_INTERVAL_MIN ADV_INTERVAL_1S

#define MY_ADV_INTERVAL_MAX ADV_INTERVAL_1S

It is recommended to set the maximum and minimum values as the same or to differ by 5ms. If the maximum value is much larger than the minimum value, the SDK will use the maximum value by default.

3. Broadcast channel

There are a total of three broadcast channels. When all three channels are selected, each broadcast is sent once in each channel. The macros are defined as follows:

#define MY_APP_ADV_CHANNEL BLT_ENABLE_ADV_ALL

4. Broadcast content

For broadcast data and scan response data, the larger the set data length (maximum 31 bytes), the longer each broadcast transmission will take, and the higher the power consumption will be. The tbl_advData[ ] array is the broadcast content data; the tbl_scanRsp[ ] array is the scan response data.

5. Connection interval

After the connection is established, the slave can actively change the connection parameters. The API functions used are:

bls_l2cap_requestConnParamUpdate();

For specific function descriptions, please refer to the documentation in the handbook.

After setting the above, you can recompile the ble_sample routine, download it to the development board, and use a current analyzer and other equipment to test power consumption.

*Note: When testing power consumption on the TLSR8258 Development Board, unplug the jumper caps J29 and J35. If you’re using the TLSR8258 Dongle Board, unplug the J8 jumper cap.

5. Notes on Low Power Consumption

1. The ble_sample routine enables the low-power function by default, and the macro is defined as:

#define BLE_APP_PM_ENABLE 1
#define PM_DEEPSLEEP_RETENTION_ENABLE 1

2. In the ble_sample routine, if the broadcast exceeds 60s, it will automatically enter deep sleep mode and stop broadcasting. If after a connection has been established and there are no keystrokes within 60s, it will disconnect and enter deep sleep mode. The code is shown in the figure below. In blt_pm_proc(), developers can make changes as needed.