Development Examples

[中文版]

Data Throughput Mode Application

What is Throughput Mode?

FSC-BT630x series Bluetooth BLE data modules have two work modes: Throughput Mode and Command Mode .

The generic data throughput firmware for the FSC-BT630x series modules defaults to throughput mode. To switch modes, refer to FSC-BT630x General Data AT Command Set and use AT+TPMODE command. The differences between the two work 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+LESEND.

Module to Phone Application

1.Module Side: After being powered on, the module will continuously send broadcast packet data.

2.Mobile Phone Side: Open the [FeasyBlue App] , scan for broadcast packets of nearby Bluetooth BLE devices, locate the target Bluetooth module, and establish a connection.

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

4.After successful connection, in throughput mode, the module side will automatically transmit the data transparently through the air to the remote end (mobile phone side) after receiving serial port data.

../_images/bt630x-data-bt-app.png

Module to Module Application

This is a demonstration of BLE communication data throughput transmission between FSC-BT630(Module1) and FSC-BT630(Module2) Bluetooth modules, as follows:

1.Scan for nearby BLE devices

FSC-BT630x scans for nearby Bluetooth BLE devices, with the operation as follows:

 1Send:<<AT+SCAN=1                                          //Scan for nearby Bluetooth BLE devices
 2Response:>>OK
 3     >>+SCAN={                                            //Scan started
 4     >>+SCAN=0,0,E0798DB74BD5,-82,9,FSC-WY001
 5     >>+SCAN=1,0,E0798DB74B93,-88,9,FSC-WY001
 6     >>+SCAN=2,1,DD0D30500762,-89,13,FSC-BW256B-LE
 7     >>+SCAN=3,0,E0798DB39B34,-86,9,FSC-WY001
 8     >>+SCAN=4,0,DC0D30000A09,-52,12,FSC-BT630        //Module2's MAC address and address type 1 are identified.
 9     >>+SCAN=5,1,FCB7E6A1E72C,-89,10,LE_WI-C100
10     >>+SCAN=6,1,DD0D30001885,-80,18,FSC-BT909C-LE-1885
11     >>+SCAN=7,0,E0798DB74BA9,-75,9,FSC-WY001
12     >>+SCAN=8,0,E0798DB74BD3,-81,9,FSC-WY001
13     >>+SCAN=E}                                         //Scan ended

2.Send BLE Connection Establishment Request

FSC-BT630(Module1) establishes a BLE protocol connection with FSC-BT630(Module2) via the AT+LECCONN command, with the operation as follows:

1Send:<<AT+LECCONN=DC0D30000A090       //Establish BLE connection request
2Response:>>OK

Warning

AT+LECCONN=Target Bluetooth MAC address + 1-bit address type. Generally, the address type is “0” or “1”.

How to obtain the address type:

Use AT+SCAN=1 to scan, the second parameter in the returned result is the address type, as shown in the example below:

1 //The address type is the second parameter, which is "0".
2
3 Response:>>+SCAN=4,0,DC0D30000A09,-52,12,FSC-BT630

3.BLE Connection Established Successfully

In transparent transmission mode, when the Bluetooth connection is successful, the serial port will not receive an event response indication (in command mode, a connection success event response indication will be received). The current connection status can be determined by the level state of the Pin18 status indicator pin of FSC-BT630x, as follows:

  • High level (H): Indicates that the Bluetooth is successfully connected;

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

4.Send Data

The transparent transmission mode of the general data transmission firmware is enabled by default. After the BLE connection is successfully established, you can send data directly without sending data via AT commands.

../_images/bt630x-data-bt-bt.png

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. The following example demonstrates:

  1. Write Device Name : ABC

  2. Read Device Name

  3. Read 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

1.When the module is powered on, it continuously sends broadcast data outward. A remote Bluetooth device (e.g., a mobile phone) can obtain the broadcast packet by searching and initiate a connection request to the module.

2.After the connection is successfully established, the module will pull high the connection status pin to notify the host that the Bluetooth connection has been successfully established.

3.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: Broadcast Packet
        bt <-- remote: Scan
        bt --> remote: Broadcast Packet
        bt <-- remote: Request Connection Establishment

rnote over host, remote: Connection Successful

host <- bt: Pull High the Connection Status Pin

rnote over host, remote: Send Data

host -> bt: Serial Port Transmission ABC
        bt --> remote: Send Data ABC
        bt <-- remote: Bluetooth Sending DEF
host <- bt: Serial Port Output DEF

        bt <-- remote: Bluetooth Disconnection

host <- bt: Connection Disconnected

host <- bt: Pull Low the Connection Status Pin
        bt --> remote: Broadcast Packet

@enduml

Module Acts as Master to Connect to Remote Device

The module can act as master device to connect to remote slave devices.

The host can send AT commands to control the module to perform scanning, connection, and disconnection operations. The following shows the process of connecting to other devices:

@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=1\\r\\n
host <- bt: \\r\\nOK\\r\\n
        bt --> remote: SCAN
        bt <-- remote: Broadcast 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 to establish an LE connection

rnote over host, remote: Connection Successful

host <- bt: Pull High the Connection Status Pin

rnote over host, remote: Send Data

host -> bt: Serial Port Transmission ABC
        bt --> remote: Send ABC via Bluetooth
        bt <-- remote: send DEF via Bluetooth

host <- bt: UART Output DEF

host -> bt: AT+LEDISC\\r\\n
host <- bt: \\r\\nOK\\r\\n
        bt --> remote: Request to disconnect LE connection

rnote over host, remote: Connection Disconnected

host <- bt: Pull Low the Connection Status Pin
        bt <-- remote: Broadcast Packet

@enduml