Development Examples

[中文版]

Data Throughput Mode Application

What is Throughput Mode?

The FSC-BT836B Bluetooth dual-mode data transmission module operates with two data transmission modes: Throughput Mode and Command Mode.

The generic data throughput firmware for the FSC-BT836x series modules defaults to throughput mode. To switch modes, refer to the FSC-BT836B 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+LESEND.

Between Module and Phone Application

  1. Module: Upon power-up, the module continuously transmits advertisement packets.

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

  3. Connection Success: The status pin on the module side will be pulled HIGH, indicating a successful connection.

  4. Data Transmission: After a successful connection in Transparent Transmission Mode, data received by the module via UART is automatically transmitted over the air to the remote end (phone side).

../_images/throughput_pc_phone_200dpi.png

Between Modules Application

A demonstration of SPP communication and data transparent transmission between an FSC-BT836B and an FSC-BT986 Bluetooth module is as follows:

  1. Scan for nearby SPP devices

    The FSC-BT836B scans for nearby Bluetooth SPP devices. Operation is as follows:

    1Send: <<AT+SCAN=1                // Scan for nearby Bluetooth SPP devices
    2Response: >>OK
    3         >>+SCAN={                   // Scan started
    4         >>+SCAN=0,0,001D439A2001,-45,10,FSC-BT986
    5         >>+SCAN=1,1,DC0D3023CA1C,-71,14,0000-1007Z ggg
    6         >>+SCAN=2,0,DC0D30000015,-88,23,FSC-BT1038C-LE-AKM-0015
    7         >>+SCAN=3,0,DC0D300017A8,-85,11,FSC-BT3721V
    8         >>+SCAN=5,0,A4405B28A838,-89,10,AirGo AS01
    9         >>+SCAN=}                  // Scan ended
    
  2. Establish SPP connection request

    The FSC-BT836B establishes an SPP connection with the FSC-BT986 using the AT+SPPCONN command. Operation is as follows:

    1Send: <<AT+SPPCONN=001D439A2001      // Initiate SPP connection to remote FSC-BT986
    2Response: >>OK
    
  3. SPP connection established successfully

    In Transparent Transmission 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 10) on the FSC-BT836B, 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

    Transparent transmission mode is enabled by default in the generic data transmission firmware. After a successful SPP connection, data can be sent directly without using AT commands, as shown in the figure below:

../_images/throughput_836b_9101_200dpi.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 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: Modify device name to ABC

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

rnote over host, bt: Query device name

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

rnote over host, bt: Query 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 Acting 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. The following diagram illustrates the process of connecting to another device:

@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