FSC-BT986_HC05 Instruction manual
Introduce
Description
This design guide is intended for engineers developing FSC-BT986_HC05 series Bluetooth modules, as well as BT982 and BT981 series modules
Default configuration for the module
Name |
FSC-HC05 |
LE-Name |
FSC-HC05-LE |
Pin Code |
1234 |
Secure Simple Pairing Mode |
On |
UART Baudrate |
9600/8/N/1 |
Hardware description
Pin diagram
Take FSC-BT986 as an example:
Pin description
Pin |
Pin Name |
Type |
Pin Descriptions |
|---|---|---|---|
1 |
UART_TX |
O |
Serial pin |
2 |
UART_RX |
I |
Serial pin |
3 |
UART_CTS |
I/O |
Serial port flow controller pin/No connection required |
4 |
UART_RTS |
I/O |
Serial port flow controllerrt flow controller pin/No connection required |
9 |
Disc/USB_DM/PIO0 |
I/O |
Disconnect pin |
11 |
RESET |
I |
Low level reset |
12 |
VDD |
Power |
3.3V power supply, LDO power supply is recommended |
13 |
GND |
GND |
GND |
15 |
ICE |
I/O |
Burn foot |
32 |
LED |
O |
Bluetooth is not connected to the output square wave, Bluetooth is connected to the output high level |
33 |
STATUS |
O |
Bluetooth unconnected output low, Bluetooth connected output high |
34 |
Tran/USB_DP/PIO1 |
I/O |
பSUART mode control foot ·H·=· Command mode ·L·=· transparent mode |
36 |
EXT_ANT |
ANT |
Change the 0 ohm resistance near the antenna, you can connect the Bluetooth antenna |
Hardware design specification
The module only needs to be connected to VDD/GND/UART_RX/UART_TX
If the MCU needs to obtain the connection STATUS of the Bluetooth module, it needs to connect the STATUS pin
After drawing the schematic, please send it to Feiyi Tong for review to avoid the Bluetooth distance can not achieve the best effect
Function description
GPIO indication
Connection status PIN24
status |
Description |
|---|---|
Low level |
Transparent mode |
High level |
Instruction mode |
Connection status PIN 23
status |
Description |
|---|---|
Low level |
/ |
High level |
Instruction mode |
LED PIN 32
status |
Description |
|---|---|
1Hz square wave |
Bluetooth not connected |
High level |
Bluetooth connection |
连接状态引脚 PIN 33
status |
Description |
|---|---|
Low level |
Bluetooth not connected |
High level |
Bluetooth connection |
Working mode
Transparent mode |
Bluetooth is not connected, the data received by the serial port is
analyzed according to the AT command;
After the Bluetooth connection, all data received by the serial port
is sent to the remote Bluetooth.
|
Instruction mode |
Bluetooth is not connected, the data received by the serial port is
analyzed according to the AT command;
After the Bluetooth connection, the data received by the serial port is
still analyzed according to the AT command.
To send data to the remote end, send the AT+SPPSEND command.
|
AT instruction specification
specification
Applies to the entire document
{} : Including with {… .. The content in} is optional
<< : The host sent it to the module COMMAND
>> : The module replies to the host RESPONSE
Instruction
Instruction format
All instructions begin with AT and end with <CR><LF>
<CR> Indicates the carriage return character, corresponding to HEX is OxOD
<LF> Represents a newline character, corresponding to HEX is OxOA
If the instruction contains parameters, the parameters should be separated by =
If the instruction contains multiple parameters, the parameters should be separated by ,
If a response is returned, the response begins with <CR><LF> and ends with <CR><LF>
Modules should always return the result of instruction execution (OK on success, ERROR on failure)
Notification
Notification format
All notifications begin with <CR><LF> and end with <CR><LF>
If the notification contains parameters, they should be placed after “=”
If the notification contains multiple parameters, the parameters should be separated by “,”
Instruction list
General instruction
AT - Serial communication test
Command |
AT |
Response |
OK |
Description |
Test UART communication between the host and module
when powering on or changing the baud rate
|
AT+REBOOT - Software reset
Command |
AT+REBOOT |
Response |
OK |
Description |
Software reset |
AT+RESTORE - factory data reset
Command |
AT+RESTORE |
Response |
OK |
Description |
The module will be restored to factory Settings |
AT+NAME - Read/write BR/EDR Bluetooth name
Command |
AT+NAME{=Param1{,Param2}} |
|
BR/EDR Bluetooth Name (1~31 Bytes ASCII) |
|
Enable MAC address suffixes (0~2,default:0).
0: Close suffix
1: Enable the suffix “-XXXX” (4 bytes after the MAC address)
2: Enable the suffix “-XXXX “(6 bytes after the MAC address)
|
Response |
+NAME:Param |
|
Bluetooth name |
Description |
Set the Bluetooth name if there is a parameter, otherwise just read |
AT+RNAME - Get the remote Bluetooth device name
Command |
AT+RNAME {=Param} |
|
The address of the remote Bluetooth device |
Response |
+RNAME:Param |
|
Name of the remote Bluetooth device |
Description |
Obtain the remote Bluetooth device name using
the remote Bluetooth device address
|
AT+ROLE - Example Query/set module roles
Command |
AT+ROLE=<Param> |
|
Setting module roles
0: Slave role Default
1: Main role (Master)
2: Loop role(Slave-Loop)
|
Response |
ROLE:Param |
|
Query module role |
Description |
Slave (slave role) : passive connection;
Slave-Loop: Passive connection, receiving data from the remote Bluetooth
master device and returning the data to the remote Bluetooth master device as is;
Master(Master role) : Queries the surrounding SPP Bluetooth slave device
and initiates a connection to establish a transparent data transmission
channel between the master and slave Bluetooth devices.
|
AT+IAC - Set/query the access code
Command |
AT+IAC=<Param> |
|
Access code |
Response |
IAC:Param |
|
The access code is queried |
Description |
The Access Code is set to GIAC (General Inquire Access Code:0x9e8b33),
which can be used to show or be found around all Bluetooth devices.
In order to efficiently quickly query or be queried a custom Bluetooth
device among the many surrounding Bluetooth devices, users can set the module
query access code to a number other than GIAC and LIACSuch as9 e8b3f
|
AT+INQM - Set/query the access mode
Command |
AT+INQM=<Param>,<Param2>,<Param3> |
|
0: Standard query mode
1: Query mode with RSSI signal strength indication
|
|
Maximum number of Bluetooth device responses |
|
Maximum query timeout Timeout range: 1 to 48
(Converted to 1.28 to 61.44 seconds) Default value: 1,1,48
|
Response |
INQM:Param,Param2,Param3 |
|
0: Standard query mode
1: Query mode with RSSI signal strength indication
|
|
Maximum number of Bluetooth device responses |
|
Maximum query timeout Timeout range: 1 to 48
(Converted to 1.28 to 61.44 seconds) Default value: 1,1,48
|
Description |
Set Bluetooth access mode if parameter exists, otherwise just read |
AT+CMODE - Query/set the connection mode
Command |
AT+CMODE=<Param> |
|
Connection mode, default:1
0: Specify Bluetooth address connection mode
(Specify Bluetooth address set by binding command)
1: Any Bluetooth address connection mode
(not subject to binding instruction set address)
2: Loop role(Slave-Loop)
|
Response |
+CMODE:Param |
|
Connection mode |
AT+BIND - Example Query/set the binding Bluetooth address
Command |
AT+BIND=<Param> |
|
Bind Bluetooth address (Default :00:00:00:00:00) |
Response |
+BIND:Param |
|
Bluetooth address |
Description |
Bluetooth address representation: NAP:UAP:LAP(hexadecimal) binding
instruction only in the specified Bluetooth address that mode is valid!
|
AT+POLAR- Query/set LED indicator driver and connection status output polarity
Command |
AT+POLAR=<Param1>,<Param2> |
|
0:Output low level light LED
1:Output high level light LED:
|
|
0:Low level indicates successful connection
1:Output high level indicates successful connection
|
Response |
+POLAR=Param1,Parm2 |
|
LED status |
AT+PIO - Set PIO single-port output
Command |
AT+PIO=<Param1>,<Param2> |
|
PIO port number(decimal) |
|
PIO port output status |
Response |
OK |
Description |
PI02 to PI07, users can expand the input and output ports. |
AT+MPIO - Set PIO multiport output
Command |
AT+MPIO=<Param> |
|
PIO Port number Mask Combination (decimal) |
Response |
OK |
Description |
PI00-PI07 and PI010, users can expand the input and output ports.
PIO Port number mask = (1<< Port number)
PIO port ID mask combination =(PIO port ID mask 1.PIO port ID mask 2 …..)
|
AT+IPSCAN - Settings/Queries - Paging scan, query scan parameters
Command |
AT+PIO=<Param1>,<Param2>,<Param3>,<Param4> |
|
Query interval |
|
Query duration |
|
Paging interval |
|
Paging duration |
Response |
AT+PIO:<Param1>,<Param2>,<Param3>,<Param4> |
Description |
The preceding parameters are in decimal. Default value: 1024,512,1024,512 |
AT+SNIFF - Set/query -SHIFF energy saving parameters
Command |
AT+SNIFF=<Param1>,<Param2>,<Param3>,<Param4> |
|
Maximum time |
|
Minimum time |
|
Try time |
|
Timeout period |
Response |
A+SNIFF: <Param1>,<Param2>,<Param3>,<Param4> |
Description |
The preceding parameters are in decimal. Default value: p,0,0,0 |
AT+SENM - Set or query the security and encryption modes
Command |
AT+SENM=<Param>,<Param2>, |
|
0——sec_mode0+off
1——sec_mode1+non_secure
2——sec_mode2_service
3——sec_mode3_link
4——sec_mode_unknown
|
|
0——hci_enc_mode_off
1——hci_enc_mode_pt_to_pt
2——hci_enc_mode_pt_to_pt_and_bcast
Default value: 0,0
|
Response |
A+ SENM:<Param>,<Param2>, |
AT+RMSAD - Removes all authenticated devices from the Bluetooth pairing list
Command |
AT+RMSAD=<Param> |
|
Bluetooth device address |
Response |
OK or FAIL |
AT+FSAD - Finds the specified authentication device from the Bluetooth pairing list
Command |
AT+FSAD=<Param> |
Response |
OK or FAIL |
AT+LINK - Connecting device
Command |
AT+LINK=<Param> |
|
Remote device Bluetooth address |
Response |
OK or FAIL |
AT+ENSNIFF - Enter energy saving mode
Command |
AT+ENSNIFF=<Param> |
|
Device Bluetooth address |
Response |
OK |
AT+EXSNIFF - Exit Energy saving mode
Command |
AT+EXSNIFF=<Param> |
|
Device Bluetooth address |
Response |
OK |
AT+MRADK - Obtain the address of the recently used Bluetooth authentication device
Command |
AT+MRAD |
|
Address of the most recently used Bluetooth device |
Response |
+MRAD:<Param> OK |
AT+STATE - Obtain the working status of the Bluetooth module
Command |
AT+STATE |
|
“INITIALIZED” ——Initialization state
“READY” ——readiness
“PAIRABLE” ——Pairable state
“PAIRED” ——Pairing status
“INQUIRING” ——Query status
“CONNECTING” ——Connecting state
“CONNECTED” ——Connection state
“DISCONNECTED” ——Disconnected state
“NUKNOW” ——Unknown state
|
Response |
+ STATE:<Param> |
|
Bluetooth working status |
AT+INIT - Initializes the SPP specification library
Command |
AT+INIT |
Response |
OK |
AT+INQC - Example Cancel querying Bluetooth devices
Command |
AT+INQC |
Response |
OK |
AT+INQ - Querying Bluetooth devices
Command |
AT+INQ |
Response |
**+INQ:<Param1> , <Param2> , <Param3> ** |
|
Bluetooth address |
|
Device type |
|
RSSI signal strength |
AT+PAIR - - Device pairing
Command |
AT+PAIR=<Param1> , <Param2> |
|
Remote device Bluetooth address |
|
Connection timeout (seconds) |
Response |
OK or FAIL |
AT+RESET - Module reset (restart) :
Command |
AT+RESET |
Response |
OK |
AT+ORGL - Restore the default state:
Command |
AT+ORGL |
Response |
OK |
Description |
The module will be restored to factory Settings and restarted |
AT+FSAD - Finds the specified authentication device from the Bluetooth pairing list
Command |
AT |
Response |
OK or FAIL |
AT+PSWD - Read/write pairing password
Command |
AT+PIN{=Param} |
|
Pairing password (4 to 15 Bytes ASCII, default:0000) |
Response |
+PIN:Param |
Description |
When +SSP=0, the pairing password is valid |
AT+PLIST - Read/clear pairing records
Command |
AT+PLIST{=Param} |
|
(0 / 1~8)
(0) Clear all pairing records
(1~8) Clears the pairing record for the specified index
|
Response1 |
+PLIST:Param1, Param2 |
|
(1~8) Paired device serial number |
|
(MAC) The MAC address of the matching device |
Response2 |
+PLIST= The matching record query is complete |
AT+VERSION - Read firmware version
Command |
AT+VER |
Response |
+VER=Param |
|
Firmware version |
Description |
Read version number |
AT+ADDR - Read the BR/EDR Bluetooth MAC address
Command |
AT+ADDR |
Response |
+ADDR:Param |
|
Module’s BR/EDR Bluetooth MAC address (12 Bytes ASCII) |
AT+CLASS: Read/write device type
Command |
AT+CLASS=Param |
|
device type (6 bytes ASCII, default:240404 Handsfree device) |
Response |
+CLASS:Param |
Description |
In order to effectively filter many Bluetooth devices and quickly
query custom Bluetooth devices, users can set the module to a non-standard
Bluetooth device class, such as: ex1f1f(hexadecimal class)
|
Related configuration Reference COD.
AT+SSP - Read/write BR/EDR pairing mode
Command |
AT+SSP{=Param} |
|
PROFILE mode (0~1, default:0)
0: Disabling the SSP
1: Enabling the SSP
|
Response |
+SSP:Param |
Note |
Restart to take effect |
AT+MODE - - Read/write Bluetooth profiles
Command |
AT+MODE{=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+PIOCFG - Enable or disable the 10-port control module
Command |
AT+PIOCFG{=Param,Param1} |
|
0: The command/transfer mode switchover function is disabled
1: The command/transmission mode switchover function is enabled
|
|
0: The Bluetooth disconnect function is disabled
1: Enable the Bluetooth disconnect function
|
Response |
+PIOCFG:Param |
Description |
AT+PIOCFG=1Turn on the serial flow control and connect the PIN34 to the high level entry command mode. |
AT+DISC - Disconnect all connections
Command |
AT+DSCA |
Response |
+DISC:SUCCESS——The disconnect succeeds
+DISC:LINK_LOSS——Connection loss
+DISC:NO_SLC——There is no SLC connection
+DISC:TIMEOUT——Disconnect timeout
+DISC:ERROR——Disconnect error
|
AT+SECURITY - Turn on/off security verification
Command |
AT+SECURITY{=Param1} |
|
Mode (0~1, default e) | 0: Security authentication is not enabled | 1: Enable security verification |
Response |
+SECURITY:Param |
Description |
Enable or disable serial port flow control |
AT+TXPOWER - Read/write transmit power
Command |
AT+TXPOWER{=Param} |
|
Transmit power (0~2) | 0: 0db | 1: 3db | 2: 5db |
Response |
+TXPOWER:Param |
|
Transmitting power |
Description |
Modified transmit power |
AT+UART - Read/write serial port configuration
Command |
AT+UART{=Param} |
|
disposition
bit0:
0 - 1Bit stop bit 2
1 - 2Bit stop bit 1
bit2~bit1:
00 - None
01 - Odd
10 - Even
|
Response |
+UART=Param |
|
Configuration (0 to 5) |
Description |
Modifying serial port configurations (stop bit and check bit) |
Application scenario
Example Query or modify default module parameters
- When the module is not connected to the Bluetooth, the serial port data will be parsed according to the AT command. The host can query and modify the default parameters of the module, as shown in the following figure:
Example Change the device name to ABC
Querying the Device name
Querying Bluetooth address
Process for sending data
The module is powered on in a discoverable (visible) state by default, and the module is set to the state that needs to be paired, and the remote Bluetooth (mobile phone) can find and connect it, and initiate a connection request to the module. After the connection is successful, the module will raise 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.
FAQ
IOS How does my phone get a Bluetooth MAC address?
For security reasons, the IOS system turns the Bluetooth MAC address into a UUID at the bottom layer and sends it to the upper-layer application. Therefore, the APP cannot obtain the MAC address of the device.
FSC-BT986_HC05 By default, the MAC address is placed in the broadcast. The APP can obtain the MAC address from the broadcast packet in the following way.
- (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 后面参数是蓝牙地址 return true } }else if([key isEqualToString:@"kCBAdvDataLocalName"]) { //there is name //NSString *szName = [dict objectForKey: key]; } } return false; }