FSC-BT986 Programming User Guide

Introduction

Description

This instruction manual is provided for engineers to develop FSC-BT986 series Bluetooth modules, which are also suitable for BT982 and BT981 series modules

Module default configuration

Name

FSC-BT986

LE-Name

FSC-BT986-LE

Pin Code

0000

Secure Simple Pairing Mode

On

Service UUID

FFF0

Write UUID

FFF2

Notify UUID

FFF1

UART Baudrate

115200/8/N/1

Hardware Interface

Application Schematic

FSC-BT986 for example:

_images/BT986引脚.jpg

PIN Definition Descriptions

Pin

Pin Name

Type

Pin Descriptions

1

UART_TX

O

Serial Transmitter Data

2

UART_RX

I

Serial Receiver Data

3

UART_CTS

I/O

UART Clear to Send(no connection request)

4

UART_RTS

I/O

UART Request to Send(no connection request)

24

Tran/USB_DP/PIO1

I/O

UART mode control pin, H=command mode ,L=throughput mode

23

Disc/USB_DM/PIO0

I/O

Disconnect the connecting pin

11

RESET

I

Active-low reset input

12

VDD

Power

Power supply voltage 3.3V, LDO power supply preferred

13

GND

GND

GND

15

ICE

I/O

Writing firmware pin

32

LED

O

Bluetooth not connected to output square wave, Bluetooth connected to output high level

33

STATUS

O

Connection state, output. H=Connected , L=No connection

36

EXT_ANT

ANT

Changing the 0 ohm resistance near the antenna, it is possible to connect a Bluetooth antenna externally

Note

To use the 23 and 24 pin control modules AT+PIOCFG command is required to enable the function

Physical Interface

  • The module only needs to be connected to VDD/GND/UART_RX/UART_TX ready to use.

  • If the MCU needs to obtain the connection status of the Bluetooth module, it needs to be connected to the STATUS pin.

  • After drawing the schematic diagram, please send it to Feasycom for review to avoid Bluetooth distance not achieving the best effect.

Function Description

GPIO Indications

Connection status PIN 24

State

Description

Low level

Throughput mode

High level

AT command mode

Connection status PIN 23

State

Description

Low level

/

High level

disconnected

LED PIN 32

State

Description

1Hz square wave

disconnected

High level

connected

Connection status PIN 33

State

Description

Low level

disconnected

High level

connected

Working mode

Throughput mode

Bluetooth is not connected, and the data received by the serial port is parsed according to AT instructions;
After Bluetooth connection, all data received from the serial port is sent to the remote Bluetooth as is.

AT command mode

Bluetooth is not connected, and the data received by the serial port is parsed according to AT instructions; After Bluetooth connection,
the data received by the serial port is still parsed according to the AT command. When sending data to the remote end, send the AT+SPPSEND command.

GATT Throughput Service

Type

UUID

Service

Description

Service

0xFFF0

Transparent transmission service

Write

0xFFF2

Write,Write Without Response

APP sent to module

Notify

0xFFF1

Notify

Module sent to APP

AT Command Description

Specification Description

Applicable to the entire document

  • {} : Including content in {…} is optional

  • << : COMMAND sent by the host to the module

  • >> : Module responds to the host’s**RESPONSE**

Command

Command are control commands that the host actively sends to the module, and the module needs to reply <CR><LF>OK<CR><LF> as a response after receiving the instructions.

Command Format

AT+Command{=Param1{,Param2{,Param3…}}}<CR><LF>
  • All instructions start with**AT**,and end with**<CR><LF>**

  • <CR> represents carriage return, corresponding to HEX as 0x0D

  • <LF> represents a line break, corresponding to HEX as 0x0A

  • If the instruction contains parameters, the parameters should be separated by**=**

  • If the instruction contains multiple parameters, the parameters should be separated by**,**

  • If the instruction returns a response, the response starts with <CR><LF>, ends with**<CR><LF>**

  • The module should always return the result of instruction execution (success returns OK,failure returns ERROR)

Example:
Read module Bluetooth name
<< AT+VER
>> +VER=1.0.0,FSC-BT986
>> OK

Write unsupported baud rate
<< AT+BAUD=0
>> ERROR

Indication

Notification is the data that the module actively sends to the host. Generally used to indicate changes in status or received data.

Indication

<CR><LF>+Indication{=Param1{,Param2{,Param3…}}}<CR><LF>
  • All notifications start with<CR><LF>,and end with<CR><LF>

  • If the notification contains parameters, the parameters should be placed after ‘=’

  • If the notification contains multiple parameters, the parameters should be separated by ‘,’

Example:
Return to current connection status in command mode
>> +SPPSTAT=3

Command Table

General Commands

AT+HELP - Query firmware functions and command

Command

AT+HELP

Response

<MODULE DEFAULT PARAMETER>
<COMMAND SUMMARY: DESCRIPTION: PROFILE CATEGORY>

Description

Using the help command to obtain basic summary information

Note

If you need to upgrade to the latest version, please refer t OTA instructions

AT - UART Communication Test

Command

AT

Response

OK

Description

Test the UART communication between HOST and Module after power on, baudrate changed, etc.

Example:
<< AT
>> OK

AT+REBOOT - Soft Reboot

Command

AT+REBOOT

Response

OK

Description

Module release all Bluetooth connections with remote device then reboot.

Example:
<< AT+REBOOT
>> OK

AT+RESTORE - Restore Factory Settings

Command

AT+RESTORE

Response

OK

Description

Module restore all factory settings then reboot.

Example:
<< AT+RESTORE
>> OK

AT+BTEN - Disable/Enable Module

Command

AT+BTEN{=Param1}

Param

Disable/Enable Module(0/1,default:0)
0: Bluetooth disable
1: Bluetooth enable

Response

+BTEN=Param

Description

Disable/Enable Module

AT+NAME - Read/Write BR/EDR Local Name

Command

AT+NAME{=Param1{,Param2}}

Param1

BR/EDR Local Name(1~31 Bytes ASCII)

Param2

Enable MAC address suffix (0~2,default:0)
0: Disable suffix
1: Enable suffix“-XXXX”(lower 4 bytes of MAC address)
2: Enable suffix“-XXXX”(lower 6 bytes of MAC address)

Response

+NAME=Param

Param

BR/EDR local name

Description

Write local name if parameter existence, otherwise read current local name

Example:
Read current BR/EDR local name
<< AT+NAME
>> +NAME=FSC-BT986-XXXX
>> OK

Change module’s BR/EDR local name and disable suffix
<< AT+NAME=ABC,0
>> OK

Change module’s BR/EDR local name to “ABC” and enable suffix
<< AT+NAME=ABC,1
>> OK

AT+LENAME - Read/Write BLE Local Name

Command

AT+LENAME{=Param1{,Param2}}

Param1

BLE local name(1~31 Bytes ASCII)

Param2

MAC address suffix(0~2,default:0)
0: Disable suffix
1: Disable suffix“-XXXX”(lower 4 bytes of MAC address after local name)
2: Enable suffix“-XXXX”(lower 6 bytes of MAC address after local name)

Response

+LENAME=Param

Param

BLE local name

Description

Write local BLE local namename if parameter existence, otherwise read current local name

AT+PIN - Read/Write Pin Code

Command

AT+PIN{=Param}

Param

Pin code(4~15 Bytes ASCII, default:0000)

Response

+PIN=Param

Description

When+SSP=0, the pairing password is valid

Example:
Read module’s pin code
<< AT+PIN
>> +PIN=0000
>> OK

Change module’s pin code to ‘1234’
<< AT+PIN=1234
>> OK

AT+PLIST - Read/Clear Paired Record

Command

AT+PLIST{=Param}

Param

(0 / 1~8)
(0) Clear all paired record
(1~8) Clear specific paired record with index

Response1

+PLIST=Param1, Param2

Param1

(1~8) Paired device’s index

Param2

(MAC) Paired device’s MAC address

Response2

+PLIST= Pairing record query completed

Example:Read module’s paired record
<< AT+PLIST
>> +PLIST=1,1C5CF226D773
+PLIST=2,A0BC30075421
>> OK

Example:Clear module’s paired record
<< AT+PLIST=0
>> OK

AT+BAUD - Read/Write UART Baudrate

Command

AT+BAUD{=Param}

Param

Baudrate(4800/9600/19200/38400/57600/115200/
230400/460800/921600,256000,512000,1000000, default:115200)

Response

+BAUD=Param

Param

Baudrate

Description

Module’s baudrate will be changed immediately after received this command

Example:
Read UART Baudrate
<< AT+BAUD
>> +BAUD=115200
>> OK

Write UART Baudrate
<< AT+BAUD=9600
>> OK

AT+LPM - Turn On/Off Low Power Mode

Command

AT+LPM{=Param}

Param

Low Power Mode (0/1, default: 0)
0: Turn Off
1: Turn On

Response

+LPM=Param

Param

Low Power Mode

Description

Read and configure Low Power Mode

Example:
Read Low Power Mode
<< AT+LPM
>> +LPM=0
>> OK

Turn on Low Power Mode
<< AT+LPM=1
>> OK

AT+VER - Read Firmware Version

Command

AT+VER

Response

+VER=Param

Param

Firmware version

Description

Read module’s firmware version

Example:
<< AT+VER
>> +VER=1.0.0,FSC-BT986
>> OK

AT+ADDR - Read BR/EDR MAC Address

Command

AT+ADDR

Response

+ADDR=Param

Param

Module’s BR/EDR MAC address(12 Bytes ASCII)

Example:
<< AT+ADDR
>> +ADDR=DC0D30010203
>> OK

AT+LEADDR - Read BLE MAC Address

Command

AT+LEADDR

Response

+LEADDR=Param

Param

Module’s BLE MAC address(12 Bytes ASCII)

AT+COD: Read/Write Class Of Device

Command

AT+COD=Param

Param

Class of device(6 bytes ASCII, default:240404 Handsfree device)

Response

+COD=Param

Related configurations refer to COD.

AT+TPMODE - Turn On/Off Throughput Mode

Command

AT+TPMODE{=Param}

Param

Mode(0~1,default: 0) 0: AT command mode 1: Throughput mode

Response

+TPMODE=Param

Description

When SPP/HID/GATT profile connected and throughput mode is on, the AT command will be de-active,
every byte received via physical UART will be sent to air, vice visa.

AT+FLOWCTL - Turn On/Off Hardware Flow Control

Command

AT+FLOWCTL{=Param1}

Param1

Option(0~1,default0) 0: Turn Off 1: Turn On

Response

+FLOWCTL=Param

Description

Turn On/Off Hardware Flow Control

AT+SSP - Turn On/Off Secure Simple Pairing

Command

AT+SSP{=Param}

Param

PROFILE mode (0~1, default:0) 0: Turn off SSP 1: Turn on SSP

Response

+SSP=Param

Note

Pin code input will be bypassed if simple pairing is on in pairing procedure<need reboot>

AT+MODE - Read/Write Bluetooth Mode

Command

AT+MODE{=Param}

Param

Pairing mode (0~4, default:0)
(0) NONE PROFILE
(1) SPP PROFILE
(2) HID PROFILE
(3) BLE PROFILE
(4) ALL PROFILE

Response

+SSP=Param

AT+AUTOCONN - Turn On/Off Power On Auto Reconnect<need reboot>

Command

AT+AUTOCONN{=Param}

Param

0: Turn off
1: Turn on

Response

+AUTOCONN=Param

Description

Module will attempt to connect last device after power on if set

AT+PIOCFG - PIO Function Configuration

Command

AT+PIOCFG{=Param,Param1}

Param

0: Disable Command/Transmission mode switch function
1: Enable Command/Transmission mode switch function

Param1

0: Disable Bluetooth disconnect function
1: Enable Bluetooth disconnect function

Response

+PIOCFG=Param

Description

AT+DSCA - Release All Connections

Command

AT+DSCA

Description

Module release all Bluetooth connections with remote device

AT+SCAN - Scan Nearby Devices

Command

AT+SCAN=Param1{,Param2{,Param3}}

Param1

Scan type(0~2)
0: Stop scan
1: Scan nearby BR/EDR devices
2: Scan nearby BLE devices(some firmware do not support)
3: Scan nearby BR/EDR/BLE devices(some firmware do not support)

Param2

(1~48)Scan period. unit:1.28s, default:12.8s

Param3

(1~25 Bytes ASCII)Scan period.

Description

Format description refer to: +SCAN - Scan Result

AT+SECURITY - Turn on/off security verification

Command

AT+SECURITY{=Param1}

Param1

mode(0~1,default:0) 0: turn off 1: turn on

Response

+SECURITY=Param

Description

Turn on/off security verification

Example:
Turn on security verification
<< AT+SECURITY=1
>> OK

Read security verification mode
<< AT+SECURITY
>> +SECURITY=1
OK

AT+TXPOWER - Read/Write TX power

Command

AT+TXPOWER{=Param}

Param

TX power(0~2) | 0: 0db | 1: 3db | 2: 5db

Response

+TXPOWER=Param

Param

TX power

Description

Read/Write TX power

Example:
Read TX power
<< AT+TXPOWER
>> +TXPOWER=2
>> OK

Write TX power 0dbm
<< AT+TXPOWER=0
>> OK

AT+UARTCFG - Read/Write Serial Port Configuration

Command

AT+UARTCFG{=Param}

Param

mode (0~5)
bit0:
0 - 1-bit stop bit
1 - 2-bit stop bit
bit2~bit1:
00 - None
01 - Odd
10 - Even

Response

+UARTCFG=Param

Param

Mode (0~5)

Description

Modifying Serial Port Configuration(Stop bit and check bit)

Example:
Configure None 1-bit stop bit
<< AT+UARTCFG=0
>> OK

Configure Odd 1-bit stop bit
<< AT+UARTCFG=2
>> OK

AT+RSSICFG - Read/Write RSSI Configuration

Command

AT+RSSICFG{=Param,Param1}

Param

High RSSI signal strength

Param1

Low RSSI signal strength

Description

PIN34 pin pulled low when signal strength is greater than Param
PIN34 pin pulled up when signal strength is less than Param1
PIN34 level remains unchanged when the signal strength is between Param``~ ``Param1
Example:Configure PIN34 output a high level when the signal strength is less than -60, maintain the previous level between -30 and -60, and output a low level when the signal strength is greater than -30
<< AT+RSSICFG=30,60
>> OK

Bluetooth Serial Commands (BR/EDR SPP)

AT+SPPSTAT - Read SPP State

Command

AT+SPPSTAT

Response

+SPPATAT=Param

Description

Format description refer to:ref:REF107

AT+SPPCFG - Read/Write SPP Configuration

Command

AT+SPPCFG{=Param}

Param

mode(0,1)
0:Turn off spp dynamic registration
0:Turn on spp dynamic registration

Response

+SPPCFG=Param

Description

After enabling dynamic registration, the module will register the SPP service
when connecting,unregister SPP service when disconnected

AT+SPPCONN - Establish SPP Connection

Command

AT+SPPCONN{=Param}

Param

MAC address of target device(12 Bytes ASCII)

AT+SPPDISC - Release SPP Connection

Command

AT+SPPDISC

Description

Release current SPP connection with remote device

AT+SPPSEND - Send Data Via SPP

Command

AT+SPPSEND=Param1,Param2

Param1

Payload length (1~236)

Param2

Payload (1~236 Bytes UTF8)

Description

If throughput mode is on, this command is de-active

Example: Send data“1234567890” to remote device via SPP
<< AT+SPPSEND=10,1234567890
>> OK

Bluetooth Serial Commands (LE Peripheral)

AT+GATTSTAT - Read LE Peripheral State

Command

AT+GATTSTAT

Response

+GATTATAT=Param

Description

Format description refer to: +GATTSTAT - LE Peripheral State (as slave module)

AT+ADVADDR - Turn on/off broadcast address

Command

AT+ADVADDR{=ram}

Param

mode(0~1,default:1) 0: turn off broadcast address 1: turn on broadcast address

Response

+ADVADDR=Param

Description

Turn on/off broadcast address

AT+IBEACON - Turn on/off ibeacon broadcast

Command

AT+IBEACON{=Param}

Param

mode(0~1,default:0) 0: Turn off ibeacon broadcast 1:Turn on ibeacon broadcast

Response

+IBEACON=Param

Description

Turn on/off ibeacon broadcast

AT+ADVDATA - Read/Write BLE Broadcast 0xFF Data

Command

AT+ADVDATA{=Param}

Param

Manufacturer defined broadcast data (data length not exceeding 27)

Response

+ADVDATA=Param

Param

Tag is broadcast data of 0xFF

Description

The manufacturer’s custom broadcast data tag is 0xFF

Example:
Read the custom broadcast data content of the manufacturer, x is HEX data
<< AT+ADVDATA
>> +ADVDATA=\x03\x01\x02
>> OK

Write the custom broadcast data content of the manufacturer, x is HEX data
<< AT+ADVDATA=\x03\x01\x02
>> OK

AT+ADBLE - Turn on/off AndroidBLE

Command

AT+IBEACON{=Param}

Param

mode(0~1,default:1) 0: turn off AndroidBLE 1: turn on AndroidBLE

Response

+IBEACON=Param

Description

After turning on, the SPP and BLE addresses will be two different addresses | when turning off, the SPP and BLE addresses will be the same address

AT+UUIDCFG - Read/Write UUID

Command

AT+UUIDCFG{=Param1,Param2,Param3}

Param1

service UUID (defalut: 0000)

Param2

write UUID (defalut: 0000)

Param3

notify UUID (defalut: 0000)

Response

+UUIDCFG=Param1,Param2,Param3

Description

Customized data transfer reset UUID, supporting 32/128 bit UUID By default: | service UUID = 0xFFF0 | write UUID = 0XFFF2 | notify UUID = 0XFFF1

AT+GATTSEND - Send Data Via LE Peripheral

Command

AT+GATTSEND=Param1,Param2

Param1

Payload length (1~236)

Param2

Payload (1~236 Bytes UTF8)

Description

If throughput mode is on, this command is de-active

Example: Send data ‘1234567890’ to remote device via LE Peripheral
<< AT+GATTSEND=10,1234567890
>> OK

AT+LESTAT - Read LE Central State

Command

AT+LESTAT

Response

+LEATAT=Param

Description

Format description refer to: +LESTAT - LE Central State (as master module)

AT+LECCONN - Establish LE Central Connection

Command

AT+LECCONN{=Param1{,Param2{,Param3{,Param4}}}}

Param1

MAC address of target device (12 Bytes ASCII) + MAC address type (1 Bytes ASCII)

Param2

Service UUID

Param3

Write UUID

Param4

Notify UUID

Response

OK

Description

Initiate a connection to the specified device, with parameters consisting of target device (12 Bytes ASCII) + MAC address type
(1 Bytes ASCII) composition, usually the address type is “0” or “1”.
Type acquisition method:
Scan the second parameter returned using AT+SCAN, for example:
+SCAN=0,0,DC0D30001ED4,-65,10,FSC-BT946
Establish LE Central Connection AT command
AT+LECCONN=DC0D30001ED40
Example:
Connect to the specified device, 0 is the address type
<< AT+LECCONN=DC0D3000039E0
>> OK

Initiate a connection to the specified address and communicate using FFF0, FFF2, and FFF1
<< AT+LECCONN=DC0D3000039E0,FFF0,FFF2,FFF1
>> OK

AT+LESEND - Send Data Via LE Central

Command

AT+LESEND=Param1,Param2

Param1

Data length

Param2

Data

Response

OK

Description

If throughput mode is on, this command is de-active

Example:
Sending data to devices with connection index 1
<< AT+LESEND=1,4,2022
>> OK

Bluetooth Serial Commands (HID)

AT+HIDSTAT - Read HID State

Command

AT+HIDSTAT

Response

+HIDATAT=Param

Description

Format description refer to: +HIDSTAT - HID State

AT+HIDCONN - Establish HID Connection

Command

AT+HIDCONN{=Param}

Param

MAC address of target device(12 Bytes ASCII)

AT+HIDDISC - Release HID Connection

Command

AT+HIDDISC

Description

Release current HID connection with remote device

AT+HIDOSK - IOS Device Eject Keyboard Toggle

Command

AT+HIDOSK

Description

This instruction applies only to the IOS Device

AT+HIDMODE - Read/Write HID Transfer Mode

Command

AT+HIDMODE{=Param}

Param

HID mode(0~1), default:1
(0) Hex key code
(1) Ascii key code (English)

Note

The module can support various keyboard languages through specific firmware, such as:
TURKEY SPAIN PORTUGAL FRANCE GERMANY ITALY CZECH JAPAN

AT+HIDDLY - Read/Write HID Send Delay

Command

AT+HIDDLY{=Param}

Param

HID report period in millisecond, default 10 ms

AT+HIDSEND - Send Data Via HID

Command

AT+HIDSEND=Param1,Param2

Param1

Report length

Param2

Report payload

Note

For special key code:
0x0D -> ENTER
0x08 -> BACKSPACE
0x09 -> TAB
0x20 -> SPACE

Description

If throughput mode is on, this command is de-active

Example: Send data ‘A’ to remote device (on AT+HIDMODE=1)
>> AT+HIDSEND=1,A
<< OK
Example: Send data ‘A’ to remote device (on AT+HIDMODE=0)
<< AT+HIDSEND=4, xA1 x01 x00 x04
>> OK
Note: HEX data, the corresponding actual data is as follows:
41 54 2B 48 49 44 53 45 4E 44 3D 34 2C A1 01 00 04 0d 0a
Where:
A1 : report start
01 : page id 1
00 : modifier
04 : key code
The module will automatically send pop-up keys

Bluetooth Serial Indications

+SPPSTAT - SPP State

Format

+SPPSTAT=Param

Param

(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected

+SCAN - Scan Result

Format1

+SCAN={ : start scanning

Format2

+SCAN =Param1,Param2,Param3, Param4,Param5,Param6

Param1

Index

Param2

Device address type(1 Bytes ASCII)

Param3

MAC address (12 Bytes ASCII)

Param4

RSSI

Param5

Size of Param6 if exist

Param6

Device Name

Format3

+SCAN=} : cease scanning

Example:
Scan nearby devices
<< AT+SCAN=1
>> +SCAN={
>> +SCAN=0,1,70CFC9A98840,-43,24,LE-Bose QuietControl 30
>> +SCAN=1,1,DC0D30001ED4,-65,10,FSC-BT946
>> +SCAN=}

+GATTSTAT - LE Peripheral State (as slave module)

Indication

+GATTSTAT=Param

Param

(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected

Description

In instruction mode, when connection status of the module changes,module will actively report it through +GATTSTAT

Example:
Connected
>> +GATTSTAT=3

+LESTAT - LE Central State (as master module)

Indication

+LESTAT=Param

Param

(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected

Description

In instruction mode, when connection status of the module changes,module will actively report it through +LESTAT

Example:
Connected
>> +LESTAT=3

+HIDSTAT - HID State

Format

+HIDSTAT=Param

Param

(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected

+DATA - Received Bluetooth data report

Indication

+DATA=Param1,Param2,Param3

Param1

Index

Param2

Data length

Param2

Data

Description

Throughput mode:Report data without +DATA prefix +DATA=12345
AT command mode:Report data without+DATA prefix +DATA=1,5,12345
Example:
Received data=1234567890
>> +DATA=1,10,1234567890

Application Scenario

Read/Write Module Default Parameters

When the module is not connected to Bluetooth, it will parse the serial port data according to AT command. The host can query and modify the default parameters of the module, as shown in the following figure:

  1. Change the device name to ABC

  2. Query device name

  3. Query 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: 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 MAC address

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

@enduml

The process of sending data

The module will continuously send broadcast data to the outside when powered on, and the remote Bluetooth (mobile phone) can obtain the broadcast packet through search and initiate a connection request to the module. After successful connection, the module will pull up the connection status pin to notify the host that the Bluetooth connection is successful. The host can send data to the remote Bluetooth through the Bluetooth module, and the remote Bluetooth 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: start connection

        bt --> remote: broadcast data
        bt <-  remote: scan
        bt --> remote: broadcast data
        bt <-  remote: request for connection

rnote over host, remote: connected

host <- bt: pull up connection status pin

rnote over host, remote: send data

host -> bt: serial port send ABC
        bt ->  remote: bluetooth send ABC
        bt <-  remote: bluetooth send DEF
host <- bt: serial poert send DEF

        bt <-  remote: disconnected

host <- bt: disconnected

host <- bt: pull down connection status pin
        bt --> remote: broadcast data

@enduml

The module used as a master module to connect to remote devices

The module can serve as the master module to connect to the slave module and the master module can send instructions to control the module for scanning, connecting, and disconnecting. The following figure 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=2\\r\\n
host <- bt: \\r\\nOK\\r\\n
        bt ->  remote: scan
        bt <-- remote: broadcast data
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 connect

rnote over host, remote: connected

host <- bt: pull up connection status pin

rnote over host, remote: send data

host -> bt: serial port send ABC
        bt ->  remote: bluetooth send ABC
        bt <-  remote: bluetooth send DEF
host <- bt: serial port send DEF

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

rnote over host, remote: disconnected

host <- bt: pull down connection status pin
        bt --> remote: broadcast data

@enduml

FAQ

How can IOS phones obtain Bluetooth MAC addresses?

For security reasons, the IOS system converts the Bluetooth MAC address into UUID at the bottom layer

and sends it to the upper layer application. So the app cannot obtain the MAC address of the device.

FSC-BT986 will place the MAC address in the broadcast by default, and the APP can obtain the MAC address from the broadcast packet using the following method.

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
    if(![self describeDictonary:advertisementData])
    {
        NSLog(@"is not fsc module");
        return;
    }
}

- (Boolean)describeDictonary: (NSDictionary *) dict
{
    NSArray *keys;
    id key;
    keys = [dict allKeys];
    for(int i = 0; i < [keys count]; i++)
    {
        key = [keys objectAtIndex:i];
        if([key isEqualToString:@"kCBAdvDataManufacturerData"])
        {
            NSData *tempValue = [dict objectForKey:key];
            const Byte *tempByte = [tempValue bytes];
            if([tempValue length] == 6)
            {
                // tempByte MAC address
                return true
            }
        }else if([key isEqualToString:@"kCBAdvDataLocalName"])
        {
            //there is name
            //NSString *szName = [dict objectForKey: key];
        }
    }
    return false;
}

Appendix

Download PDF version

Download PDF