Development Examples

[中文版]

Data Throughput Mode Application

What is Throughput Mode?

FSC-BT2064x series dual-mode Bluetooth data transmission modules have two data transmission modes: Throughput Mode and Command Mode.

The generic data throughput firmware for the FSC-BT2064x series modules default to throughput mode. To switch modes, refer to the FSC-BT2064x General Dual-Mode Data AT Command Set and use the AT+TPMODE command.

The operation and differences between the two modes are as follows:

  • Throughput Mode:

Bluetooth Not Connected: Data received via UART is parsed as AT commands.

Bluetooth Connected: All data received via UART is sent as-is to the remote Bluetooth device. It does not contain any data headers or framing and does not require AT commands to send data.

  • Command Mode:

Bluetooth Not Connected: Data received via UART is parsed as AT commands.

Bluetooth Connected: Data received via UART is still parsed as AT commands. It will contain specific response indication headers and framing. Data must be sent to the remote device using AT commands, such as AT+SPPSEND or AT+LESEND .

Module to Phone Application

  1. Module : After power-on, the module will continuously send broadcast packet data.

  2. Phone : Open the FeasyBlue APP , scan for nearby Bluetooth device advertisements, find the target Bluetooth module, and establish a connection.

  3. Connection Success : After successful connection, the status pin of the module will pull up the level, indicating that the connection has been established.

  4. Data Transmission : After successful connection, in the througput mode, the module will automatically transmit the serial port data it receives to the remote end (mobile phone side) via air.

../_images/bt2064x-phone-tp.png

Module to Module Application

Demonstration of SPP communication and data throughput transmission between an FSC-BT2064x and an FSC-BT9101AI Bluetooth module, as follows:

1.Scan for nearby SPP devices

FSC-BT2064x scans for nearby Bluetooth SPP devices, as follows:

 1Send:     <<AT+SCAN=1                //Scan for nearby Bluetooth SPP devices
 2Response: >>OK
 3Response: >>+SCAN={                   // Scan started
 4Response: >>+SCAN=1,2,DC0D30500762,-62,10,FSC-BW256B
 5Response: >>+SCAN=2,2,DC0D3000012F,-45,10,FSC-BT9101
 6Response: >>+SCAN=3,2,DC0D30402073,-48,16,iMin TF2-34 2073
 7Response: >>+SCAN=4,2,A0B339DB5208,-66,10,QUZHENGWEI
 8Response: >>+SCAN=5,2,DC0D300000CC,-79,17,a12234567890-00CC
 9Response: >>+SCAN=6,2,DC0D304029E0,-63,10,FSC-BT9104
10Response: >>+SCAN=7,2,C02E25D07080,-62,7,OPPO K3
11Response: >>+SCAN=8,2,1418C3B28AC1,-58,15,DESKTOP-U13VRNN
12Response: >>+SCAN=}                  // Scan ended

2.Establish SPP connection request

FSC-BT2064x establishes an SPP connection with the FSC-BT9101AI using the AT+SPPCONN command, as follows:

1Send:     <<AT+SPPCONN=DC0D3000044F      //Initiate an SPP connection request to the remote FSC-BT9101
2Response: >>OK

3.SPP Connected

In throughput mode, after a successful Bluetooth connection, the UART will not receive event response indicators. The connection status can be determined by the level state of the status pin (e.g., Pin 22) on the FSC-BT2064x, as follows:

High Level (H): Indicates Bluetooth is successfully connected.

Low Level (L): Indicates Bluetooth is not connected or the connection has been disconnected.

4.Send data

Throughput mode is enabled by default in the generic data transmission firmware. After SPP connected, data can be sent directly without using AT commands

Read/Write Module Default Parameters

When Bluetooth is not connected, the module parses UART data as AT commands. The host can query and modify the module’s default parameters. As follow:

  1. Write the device name to ABC

  2. Read the device name

  3. Read the Bluetooth address

@startuml
hide footbox
skinparam sequenceMessageAlign center

box "local" #LightBlue
participant Host as host
participant Module as bt
end box


rnote over host, bt: Write device name to ABC

host -> bt: AT+NAME=ABC\\r\\n
bt -> host: \\r\\nOK\\r\\n"

rnote over host, bt: Read device name

host -> bt: AT+NAME\\r\\n
bt -> host: \\r\\n+NAME=ABC\\r\\n\\r\\nOK\\r\\n"

rnote over host, bt: Read Bluetooth address

host -> bt: AT+ADDR\\r\\n
bt -> host: \\r\\n+ADDR=DC0D30010203\\r\\n\\r\\nOK\\r\\n

@enduml

Data Transmission Flow

Upon power-up, the module continuously transmits advertisement data. A remote Bluetooth device (e.g., phone) can discover these advertisement packets via scanning and initiate a connection request to the module.

Upon successful connection, the module pulls its connection status pin HIGH to notify the host of the successful Bluetooth connection.

The host can send data to the remote Bluetooth device via the Bluetooth module, and the remote Bluetooth device can also send data to the host.

@startuml
hide footbox
skinparam sequenceMessageAlign center

box "local" #LightBlue
participant Host as host
participant Module as bt
end box

box "remote" #LightBlue
participant "Remote BT" as remote
end box

rnote over host, remote: Establish Connection

        bt --> remote: Advertisement Packet
        bt <--  remote: Scan
        bt --> remote: Advertisement Packet
        bt <--  remote: Request Connection

rnote over host, remote: Connection Successful

host <- bt: Pull Connection Status Pin HIGH

rnote over host, remote: Send Data

host -> bt: UART Send: ABC
        bt -->  remote: BT Send: ABC
        bt <--  remote: BT Send: DEF
host <- bt: UART Output: DEF

        bt <--  remote: Disconnect BT

host <- bt: Connection Disconnected

host <- bt: Pull Connection Status Pin LOW
        bt --> remote: Advertisement Packet

@enduml

Module Acts as Master to Connect to Remote Device

The module can act as a master device to connect to a slave device. The host can send commands to control the module to perform scanning, connection, and disconnection.

@startuml

hide footbox
skinparam sequenceMessageAlign center

box "local" #LightBlue
participant Host as host
participant Module as bt
end box

box "remote" #LightBlue
participant "Remote BT" as remote
end box

host -> bt: AT+SCAN=2\\r\\n
host <- bt: \\r\\nOK\\r\\n
        bt -->  remote: Scan
        bt <-- remote: Advertisement Packet
host <- bt: \\r\\n+SCAN=0,1,DC0D30001ED4,-65,10,FSC-BT946\\r\\n
host -> bt: AT+LECCONN=DC0D30001ED41\\r\\n
host <- bt: \\r\\nOK\\r\\n
        bt -->  remote: Request Connection

rnote over host, remote: Connection Successful

host <- bt: Pull Connection Status Pin HIGH

rnote over host, remote: Send Data

host -> bt: UART Send: ABC
        bt -->  remote: BT Send: ABC
        bt <--  remote: BT Send: DEF
host <- bt: UART Output: DEF

host -> bt: AT+LEDISC\\r\\n
host <- bt: \\r\\nOK\\r\\n
        bt -->  remote: Disconnect BT

rnote over host, remote: Connection Disconnected

host <- bt: Pull Connection Status Pin LOW
        bt --> remote: Advertisement Packet

@enduml