FSC-BT618 Programming User Guide
Introduction
Description
This design guide is suitable for engineers to develop FSC-BT618 series Bluetooth modules
Module Default Settings
Name |
FSC-BT618 |
Service UUID |
FFF0 |
Write UUID |
FFF2 |
Notify UUID |
FFF1 |
UART Baudrate |
115200/8/N/1 |
Hardware Description
Pin Diagram
Pin Description
Pin |
Pin Name |
Type |
Pin Descriptions |
|---|---|---|---|
1 |
UART_TX |
O |
UART TX |
2 |
UART_RX |
I |
UART RX |
3 |
UART_RTS |
I/O |
UART RTS |
4 |
UART_CTS |
I/O |
UART CTS |
9 |
RESTORE |
I |
Restore Factory Settings |
11 |
RESET |
I |
External reset input: active Low |
12 |
VDD |
Power |
Power supply for I/O ports, DC 3.3V |
13 |
GND |
GND |
GND |
16 |
SWCLK |
I/O |
SWD CLK line(Default) |
17 |
SWDIO |
I/O |
SWD DATA line(Default) |
32 |
LED |
O |
Output square wave in pairing mode,
output high level when bluetooth is connected
|
31 |
WAKE_MCU |
O |
Low power mode Bluetooth wakes the MCU |
33 |
STATUS |
O |
bluetooth is not connected to output low level,
connected to output high level
|
34 |
WAKE_BT |
I |
Low power mode MCU wakes the Bluetooth |
36 |
EXT_ANT |
ANT |
Change the 0 ohm resistance near the antenna,
you can connect an external Bluetooth antenna
|
Hardware Design Notes
The simple test of the module only needs to connect VDD/GND/UART_RX/UART_TX 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, so as to prevent the Bluetooth distance from not reaching the best effect
The module supports GOIP wake-up, If need low power consumption, please connect PIN31 and PIN34
VDD/GND/RESET/SWCLK/SWDIO is burner hole, you can reserve solder joints for testing
Function Description
GPIO state
LED PIN is PIN 32
State |
Description |
|---|---|
1Hz square wave |
disconnect state |
high level |
connected state |
Connection status PIN is PIN 33
State |
Description |
|---|---|
low level |
disconnect state |
high level |
connected state |
Mode
Throughput mode |
when disconnected, the data received by the serial port is analyzed according to the AT command;
when connected, all the data received by the serial port is sent to the remote Bluetooth as it is.
|
Command mode |
when disconnected, the data received by the serial port is analyzed according to the AT command;
when connected, The data received by the serial port is still parsed according to the AT command.
When it is necessary to send data to the remote end, send AT+LESEND command.
|
GATT Throughput Service
type |
UUID |
Permissions |
Description |
Service |
0xFFF0 |
GATT Throughput Service |
|
Write |
0xFFF2 |
Write,Write Without Response |
APP send data to module |
Notify |
0xFFF1 |
Notify |
Module send data to remote |
Performance parameters
type |
Min. |
Type. |
Max. |
Description |
power on |
230ms |
loading finished |
||
wake up |
200ms |
wake up from sleep |
Data transfer rate
Baudrate |
packet size |
interval |
conn interval |
BLE method |
rate |
230400 |
244 |
11ms |
15ms |
Notify |
23000 Byte/s |
Low Power description
The module supports two low-power modes, namely serial port wake-up mode and I/O port wake-up mode.
Mode |
command |
hardware linking |
sleep |
Description |
|---|---|---|---|---|
serial mode |
AT+LPM=1 |
There is no need to
connect WAKE-MCU
and WAKE-BT
|
The serial port automatically sleeps
if no data communication occurs
within 5 seconds
After the serial port receives the
first frame of data, the serial port
exits the sleep
|
The first frame of wake
up data will lost
Simple logic, save I/O
|
I/O mode |
AT+LPM=2 |
Need to connect
WAKE_MCU and WAKE_BT
|
WAKE_BT The Bluetooth module enter
sleep when receiving high level
WAKE_BT The Bluetooth module exits
sleep when receiving low level
WAKE_MCU Output a high level to
notify the MCU to exit sleep
WAKE_MCU Output a high level to
notify the MCU to enter sleep
|
Support wake up MCU
Two more I/OS need to be
connected on the circuit
|
AT command description
Command description
Throughout this specification:
Content between { } is optional
Content behind << represents a COMMAND from Host
Content behind >> represents a RESPONSE/EVENT to Host
Command
Command Format
All commands start with “AT”, end with <CR><LF>
<CR> means “carriage return”, corresponds to hex value 0x0D
<LF> means “line feed”, corresponds to hex value 0x0A
If Command has Parameter, Parameter follows behind ‘=’
If Command has multiple Parameters, Parameter must be separated by ‘,’
If Command has Response, Response starts with <CR><LF>, ends with <CR><LF>
Module will always report command’s execution result by using “OK” for success or
“ERR<code>” for failure
Event
Event Format
All Events start with <CR><LF>, end with <CR><LF>
If Event has Parameter, Parameter follow behind ‘=’
If Event has multiple Parameters, Parameter must be separated by ‘,’
Commands Table
AT - Serial communication test
Command |
AT |
Response |
OK |
Description |
When powering on or changing the baud rate, test the
UART communication between the host and the module
|
AT+VER - Get Firmware Version
Command |
AT+VER |
Response |
+VER=Param |
|
Firmware version |
Description |
Get Firmware Version |
AT+ADDR - Get MAC Address
Command |
AT+ADDR |
Response |
+ADDR=Param |
|
Module’s MAC address (12 Bytes ASCII) |
Description |
Get MAC Address |
AT+NAME - Get/Set Local Name
Command |
AT+NAME{=Param1{,Param2}} |
|
local name(1~29 Bytes ASCII) |
|
MAC address suffix(0/1,default:0)
0: Disable suffix
1: Enable suffix “XXXX” (lower 4 bytes of MAC address)
after local name
|
Response |
+NAME=Param |
|
local name |
Description |
Write local name if parameter exist, otherwise read
current local name
|
AT+BAUD - Get/Set Uart Baudrate
Command |
AT+BAUD{=Param} |
|
baudrate (1200/2400/4800/9600/19200/38400/57600/115200/
230400/460800/921600, default:115200)
|
Response |
+BAUD=Param |
|
baudrate |
Description |
Module will change baudrate to target value immediately |
AT+TXPOWER - Get/Set TX Power
Command |
AT+TXPOWER{=Param} |
|
tx power |
Response |
+TXPOWER=Param |
|
tx power |
Description |
Get/Set TX Power |
AT+LPM - Get/Set low power config
Command |
AT+LPM{=Param} |
|
low power mode (0/1/2, default: 0)
0: disable
1: enable low power and wake up by UART
2: enable low power and wake up by IO
|
Response |
+LPM=Param |
|
low power mode |
Description |
Get/Set low power config |
AT+ADVIN - Get/Set advertising interval
Command |
AT+ADVIN{=Param} |
|
advertising interval(20~10000 ms, default: 152ms) |
Response |
+ADVIN=Param |
|
advertising interval |
Description |
Get/Set advertising interval |
AT+LECHCNT - Get/Set the maximum number of connections
Command |
AT+LECHCNT{=Param} |
|
Maximum number of connections allowed (1~8, default:1) |
Response |
+LECHCNT=Param |
|
Maximum number of connections allowed |
Description |
A restart is required after setting the maximum number of connections |
AT+IDCFG - Get/Set 8 bytes ID
Command |
AT+IDCFG{=Param} |
|
8 bytes ID |
Response |
+IDCFG=Param |
|
8 bytes ID |
Description |
Get/Set 8 bytes ID. Help users save 8 bytes IDs. |
AT+LEDISC - Disconnect specified connection
Command |
AT+LEDISC{=Param} |
|
index |
Response |
OK |
Description |
Disconnect the bluetooth connection of the specified index |
AT+LECCONN - Initiate a connection to the specified address
Command |
AT+LECCONN{=Param1{,Param2{,Param3{,Param4}}}} |
|
12-byte device address + 1-byte address type |
|
Communication Service UUID |
|
Communication UUID with write/write without rsp permission |
|
Communication UUID with notification permission |
Response |
OK |
Description |
Initiate a connection to the specified device, the parameter consists of
12 bytes (device address) and 1 byte (address type), generally the addr
-ess type is “0” or “1”. How to get the address type:
Send AT+SCAN=1 command, get parameter2. example:
+SCAN=0,0,DC0D30001ED4,-65,10,FSC-BT946
Connection command:
AT+LECCONN=DC0D30001ED40
|
AT+FILTER - Get/Set scan filter
Command |
AT+FILTER{=Param1{,Param2}} |
|
scan filter(0~3)
0: delete all conditions
1: address filtering
2: advertising data filtering
3: RSSI filtering
|
|
The filter type is 1, and the parameter2 is the address
The filter type is 2, and the parameter2 is advertising data
he filter type is 3, and the parameter2 is RSSI
|
Response |
+FILTER=1,Param1
+FILTER=2,Param2
+FILTER=3,Param3
|
Description |
Filter commands will only affect AT+SCAN=2
When filtering advertising data, the parameter2 fields are: tag, offset, len, data
After the configuration is complete, start AT+SCAN=2 to filter the scanned devices
according to the set parameters
AT+FILTER=0, delete all filter conditions.
Filter parameters will not be saved to flash. Do not save when power off.
|
AT+SCAN - SCAN for nearby devices
Command |
AT+SCAN{=Param} |
|
scanning method (0~2)
0: stop scanning
1: Scan nearby devices, filter duplicate addresses, up to 8 devices can be found
2: Scan BLE advertising packets and output original advertising packets, which
can be filtered by AT+FILTER command
|
Response |
+SCAN=Param1,Param2,Param3,Param4,Param5,Param6 (AT+SCAN=1 event format)
+SCAN=Param21,Param22,Param23,Param24,Param25,Param26 (AT+SCAN=2 event format)
|
|
list number |
|
MAC Address type (1 byte) |
|
MAC address (12 bytes) |
|
RSSI |
|
Device name length |
|
Device name |
|
MAC Address type (1 byte) |
|
MAC address (12 bytes) |
|
RSSI |
|
advertising packet type |
|
advertising packet length |
|
advertising packet |
Description |
AT+SCAN=1 Commonly used for searching before connecting
AT+SCAN=2 Commonly used as a Bluetooth gateway to SCAN for nearby Beacon devices
|
AT+TPMODE - Get/Set throughput mode
Command |
AT+TPMODE{=Param} |
|
Throughput mode (0~1, default 1)
0: Command Mode
1: Throughput Mode
|
Response |
+TPMODE=Param |
|
Throughput mode |
Description |
When bluetooth connected and in throughput mode,the AT
command will be de-active,every byte received via
physical UART will be sent to remote.
|
AT+ADVEN - Get/Set advertising enable config
Command |
AT+ADVEN{=Param} |
|
enable (0~1, default 1)
0: disable advertising
1: enable advertising
|
Response |
+ADVEN=Param |
|
enable |
Description |
Trun on/off advertising |
AT+ADVDATA - Get/Set advertising manufacturer specific data
Command |
AT+ADVDATA{=Param} |
|
manufacturer specific data, tag 0xff |
Response |
+ADVDATA=Param |
|
manufacturer specific data, tag 0xff |
Description |
Get/Set advertising manufacturer specific data |
AT+LESEND - send data to remote device
Command |
AT+LESEND{=Param1{,Param2{,Param3}}} |
|
Connection index |
|
data len |
|
data |
Response |
OK |
Description |
send data to remote device in Command Mode |
AT+CHINFO - Get connection list infomation
Command |
AT+CHINFO |
Response |
+CHINFO=Param1,Param2,Param3,Param4 |
|
Connection index |
|
Connection state (1:not connected, 2: connecting, 3: connected) |
|
Connection role (0: peripheral, 1: central) |
|
peer mac address |
Description |
Get connection list infomation |
AT+REBOOT - Soft Reboot
Command |
AT+REBOOT |
Response |
OK |
Description |
Module release all Bluetooth connections then reboot |
AT+RESTORE - Restore Factory Settings
Command |
AT+RESTORE |
Response |
OK |
Description |
Module restore all factory settings then reboot |
AT+UARTCFG - Get/Set Uart config
Command |
AT+UARTCFG{=Param} |
|
uart config (0~5)
bit0:
0 - 1 stop bit
1 - 2 stop bit
bit2~bit3:
00 - None
01 - Odd
10 - Even
|
Response |
+UARTCFG=Param |
|
uart config (0~5) |
Description |
Get/Set Uart config |
AT+PIN - Get/Set Pin Code
Command |
AT+PIN{=Param} |
|
Pin Code (000000 ~ 999999, default 000000) |
Response |
+PIN=Param |
|
Pin Code |
Description |
Get/Set Pin Code |
AT+PLIST - Get/Delete Paired List
Command |
AT+PLIST{=Param1{,Param2{,Param3}}} |
|
index |
|
address type(If there is no pairing, the default is FF) |
|
Paired device’s MAC address(If there is no pairing, the default is FFFFFFFFFFFF) |
Response |
+PLIST=Param |
|
Clear all paired record |
Description |
Clear the paired record, then turn off the device Bluetooth to take effect |
AT+SMCFG - Set pairing mode
Command |
AT+SMCFG{=Param} |
|
mode(0~1,default 0)
0: Direct pairing mode
1: Pin matching mode
|
Response |
+SMCFG=Param |
|
mode |
Description |
Direct pairing mode:
No need to enter a pin code to pair
Pin matching mode:
Need to enter a pin code to pair
|
Event Table
+SCAN - AT+SCAN=1 Scan Result
Indication |
+SCAN=Param1,Param2,Param3,Param4,Param5,Param6 |
|
Index |
|
MAC address type (1 byte) |
|
MAC address (12 Bytes ASCII) |
|
RSSI |
|
remote device name len |
|
remote device name |
Description |
After the module receives AT+SCAN=1, it will continue to
scan, and report through +SCAN after finding the device
|
+SCAN - AT+SCAN=2 Scan Result
Indication |
+SCAN=Param1,Param2,Param3,Param4,Param5,Param6 |
|
MAC address type (1 byte) |
|
MAC address (12 Bytes ASCII) |
|
RSSI |
|
advertising packet type |
|
advertising packet size |
|
advertising packet |
Description |
After the module receives AT+SCAN=2, it will continue to
scan and report through +SCAN after finding the device
|
+GATTSTAT - GATT State
Indication |
+GATTSTAT=Param1,Param2 |
|
Connection Index |
|
GATT State (1~3)
1: Standby
2: Connecting
3: Connected
|
Description |
In the command mode, if the connection status of the module
changes, it will be actively reported through +GATTSTAT
|
+DATA - GATT Received Incoming Data
Indication |
+DATA=Param1,Param2,Param3 |
|
Index |
|
Payload length |
|
Payload |
Description |
In the throughput mode: report data without +DATA header
In the command mode: report data with +DATA header +DATA=1,5,12345
|
Application scenarios
Get/Set the default parameters of the module
When the module is disconnect state, it will parse the uart data according to the AT command. host can get and set the default parameters of the module, as shown in the figure below:
1.Set the device name to ABC 2.Get device name 3.Get MAC address
Process of sending data
The module acts as the central to connect to the remote device
FAQ
How does an IOS mobile phone scan the Bluetooth MAC address?
- (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) { // The parameter after tempByte is the Bluetooth address return true } }else if([key isEqualToString:@"kCBAdvDataLocalName"]) { //there is name //NSString *szName = [dict objectForKey: key]; } } return false; }