FSC-BT909C programming user guide

Introduction

[中文]

Description

This design guide is suitable for engineers to develop FSC-BT909C series Bluetooth modules, also suitable for BT909 series modules

Module Default Settings

Name

FSC-BT909C-XXXX

LE-Name

FSC-BT909C-LE-XXXX

Pin Code

0000

Secure Simple Pairing Mode

ON

UART Baudrate

115200/8/N/1

Hardware Description

Pin Diagram

FSC-BT909C as an example:

_images/BT909C_pin_map.png

Pin Description

Pin

Pin Name

Type

Pin Descriptions

1

UART_TX

O

UART TX

2

UART_RX

I

UART RX

3

UART_CTS

I/O

UART CTS

4

UART_RTS

I/O

UART RTS

11

RESET

I

External reset input: active Low

12

VDD

VDD

Power supply for I/O ports, DC 3.3V

13

GND

GND

GND

32

LED

I/O

Output square wave in pairing mode,
output high level when bluetooth is connected

18

STATUS

I/O

bluetooth is not connected to output low level,
connected to output high level

51

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

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

Function Description

Profiles & Features

  • SPP (Serial Port Profile)

  • GATTS (Generic Attribute Profile LE-Peripheral role)

  • GATTC (Generic Attribute Profile LE-Central role)

  • HFP-HF (Hands-Free Profile)

  • HFP-AG (Hands-Free-AG Profile)

  • A2DP-Sink (Advanced Audio Distribution Profile)

  • A2DP-Source (Advanced Audio Distribution Profile)

  • AVRCP-Controller (Audio/Video remote controller Profile)

  • AVRCP-Target (Audio/Video remote controller Profile)

  • HID-DEVICE (Human Interface Profile)

  • PBAP (Phonebook Access Profile)

GATT Default service and characteristic

Type

UUID

Characteristic

Description

Service

0xFFF0

throughput services

Write

0xFFF2

Write,Write Without Response

app send to module

Notify

0xFFF1

Notify

module send to app

Command Description

Terms

  • Throughout this specification:

  • Content between { } is optional

  • Content behind << represents a COMMAND from Host

  • Content behind >> represents a RESPONSE/EVENT to Host

Command Format

AT+Command{=Param1{,Param2{,Param3…}}}<CR><LF>
  • 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

Error Code

Meaning

001

Failed

002

Invalid parameter

003

Invalid state

004

Command mismatch

005

Busy

006

Command not supported

007

Profile not turned on

008

No memory

Others

Reserved for future use

Example:Read module’s BR/EDR local name
<< AT+VER
>> +VER=FSC-BT1036-XXXX
>> OK

Event Format

<CR><LF>+Indication{=Param1{,Param2{,Param3…}}}<CR><LF>
  • 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 ‘,’

  • Use command AT+SEP to replace default separator for conflict prevention

Example: Received “1234567890” from mobile phone via SPP profile
>> +SPPDATA=10,1234567890

Commands Table

General Commands

AT+HELP - Firmware Function/Command Summary

Command

AT+HELP

Response

<FIRMWARE FUNCTION: appropriate working scenario >
<OTA PATH: latest suitable firmware path on server for upgrade On-The-Air>
<ENABLED PROFILES: LINKS: ON/OFF>
<COMMAND SUMMARY: DESCRIPTION: PROFILE CATEGORY>

Description

Using help command to get the basic summary information

AT+SEP - Get/Set Event/Response Separator

Command

AT+SEP{=Param}

Param

hex value 0x01~0xFF, default: ‘,’ , specially, using ‘0’ instead of ‘xFF’ for convenience

Response

+SEP=Param

Description

The parameter of events/responses may contain value same to the default separator,
using this command to replace default separator for conflict prevention
(replace the default separator ‘,’ to hex value ‘xFF’ typically)
Example:Read module’s paired record (device name contains ‘,’ already)
<< AT+PLIST
>> +PLIST=1,32808,1C5CF226D773, Tony, iPhone12
>> +PLIST=2,40, A0BC30075421, Samsung S8
>> +PLIST=E
>> OK
Example: Replace separator to ‘0xFF’
<< AT+SEP=0
>> OK
Example: Read module’s paired record again
<< AT+PLIST
>> +PLIST=1<FF>32808<FF>1C5CF226D773<FF>Tony, iPhone12
>> +PLIST=2<FF>40<FF> A0BC30075421<FF>Samsung S8
>> +PLIST=E
>> OK

AT+VER - Get Firmware Version

Command

AT+VER

Response

+VER=Param1,Param2,Param3

Param1

Module type

Param2

Firmware version

Param3

Data of production

Note

The date of production in response will not be changed after firmware upgrade

Example:
<< AT+VER
>> +VER=BT1036,V2.6.1,20220922
>> OK

AT+BAUD - Get/Set Uart Baudrate

Command

AT+BAUD{=Param}

Param

2400/4800/9600/19200/38400/57600/115200(default)/128000/
230400/256000/460800/512000/921600/1382400

Response

+BAUD=Param1,Param2,Param3

Param

All baudrates supported by current module

Description

Module will change baudrate to target value immediately or
after reboot depending on firmware,BT1036、BT955、BT909C not support 2400
Example:Query baudrates supported by current module then change baudrate from 115200 bps to 921600 bps
<< AT+BAUD
>> +BAUD=2400,4800,9600,19200,38400,57600,115200,128000,230400,256000,
460800,512000,921600,1382400
>> OK

<< AT+BAUD=921600
>> OK
Module switch baudrate to 921600 immediately, host change baudrate as well, query module’s name at new baudrate
<< AT+NAME
>> +NAME=FSC-BT91036-1F26
>> 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 - Bluetooth On/Off

Command

AT+BTEN{=Param}

Param

0-Power off 1-Power on

AT+PROFILE - Bluetooth Profile Selection

Command

AT+PROFILE{=Param}

Param

A base-10 representation of a bit field, for each bit:

BIT[0]

SPP (Serial Port Profile)

BIT[1]

GATT Server (Generic Attribute Profile)

BIT[2]

GATT Client (Generic Attribute Profile)

BIT[3]

HFP-HF (Hands-Free Profile Handsfree)

BIT[4]

HFP-AG (Hands-Free Profile Audio Gateway)

BIT[5]

A2DP Sink (Advanced Audio Distribution Profile)

BIT[6]

A2DP Source (Advanced Audio Distribution Profile)

BIT[7]

AVRCP Controller (Audio/Video remote controller Profile)

BIT[8]

AVRCP Target (Audio/Video remote controller Profile)

BIT[9]

HID Keyboard (Human Interface Profile)

BIT[10]

PBAP Server (Phonebook Access Profile)

BIT[15]

iAP2 (For iOS devices)

Response

+PROFILE=Param

Description

GATT Server and Client, HFP Sink and Source, A2DP Sink and Source, AVRCP Controller
and Target cannot be enabled simultaneously because of mutual exclusion.
Example:Read current profile selection
<< AT+PROFILE
>> +PROFILE=3
Example:Enable SPP profile, disable the others
<< AT+PROFILE=1
>> OK
Note: Only support spp、gatt、hid

AT+AUTOCONN - Power On Auto Reconnect Profile Selection

Command

AT+AUTOCONN{=Param}

Param

A base-10 representation of a bit field, format same with AT+PROFILE

Response

+AUTOCONN=Param

Description

Module will attempt to establish connection to devices in paired list after power on.

AT+STAT - Get All Profile State

Command

AT+STAT

Response

+STAT=Param1, Param2, Param3…

Description

Query all current enabled profile’s state

Example: Read current profile selection
<< AT+PROFILE
>> +PROFILE=83
Example:Read profile state
<< AT+STAT
+STAT=3,1,2,5
>> OK
_images/profile_state.png

AT+DEVSTAT - Read Device State

Command

AT+DEVSTAT

Response

+DEVSTAT=Param

Param

A base-10 representation of a bit field, for each bit:

BIT[0]

0: Power Off; 1: Power On

BIT[1]

0: BR/EDR Not Discoverable; 1: BR/EDR Discoverable

BIT[2]

0: BLE Not Advertising; 1: BLE Advertising

BIT[3]

0: BR/EDR Not Scanning; 1: BR/EDR Scanning

BIT[4]

0: BLE Not Scanning; 1: BLE Scanning

Example:usual combination and description

0

Device power off

1

Device power on

3

Device power on, BR/EDR Discoverable

5

Device power on, BR/EDR Not Discoverable, BLE Advertising

7

Device power on, BR/EDR Discoverable, BLE Advertising

13

Device power on, BR/EDR Not Discoverable, BLE Advertising, Scanning nearby BR/EDR devices

AT+ADDR - Get 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 - Get BLE MAC Address

Command

AT+LEADDR

Response

+LEADDR=Param

Param

Module’s LE MAC address (12 Bytes ASCII)

AT+NAME - Get/Set BR/EDR Local Name

Command

AT+NAME{=Param1{,Param2}}

Param1

BR/EDR local name(1~31 Bytes ASCII)

Param2

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

Response

+NAME=Param

Description

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

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

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

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

AT+LENAME - Get/Set BLE Local Name

Command

AT+LENAME{=Param1{,Param2}}

Param1

BLE local name(1~25 Bytes ASCII)

Param2

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

Response

+LENAME=Param

AT+SSP - Get/Set BR/EDR Pairing Mode

Command

AT+SSP{=Param}

Param

Pairing mode (0~3, default:2)
(0) Legacy pairing, use pin code for pairing
(1) Secure simple pairing, auto pairing
(2) Secure simple pairing, display yes/no in pairing
(3) Secure simple pairing, passkey compare,
user need to accept/reject pair request with command AT+CFM

Response

+SSP=Param

Note

need reboot

AT+PIN - Get/Set BR/EDR Pin Code

Command

AT+PIN{=Param}

Param

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

Response

+PIN=Param

Description

Pin code only work in legacy pairing mode, see AT+SSP

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

Example: Change module’s pin code to “1234”
<< AT+PIN=1234
>> OK

AT+CFM - Accept/Reject Remote Pairing Request

Command

AT+CFM=Param1, Param2

Param1

12 Bytes MAC address of remote device

Param2

0-Reject remote pairing request
1-Accept remote pairing request

Description

Only used for pairing request in pairing mode 3, see AT+SSP

AT+COD: Get/Set Device Class

Command

AT+COD=Param

Param

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

Response

+COD=Param

Related configuration reference: COD.

AT+PAIR: Get/Set BR/EDR/BLE Visibility

Command

AT+PAIR=Param

Param

Mode(0-3)
0: Leave BR/EDR/BLE discoverable mode (stop advertising/broadcasting)
1: Enter BR/EDR discoverable mode (start broadcasting)
2: Enter BLE discoverable mode (start advertising)
3: Enter BR/EDR/BLE discoverable mode (start advertising/broadcasting)

Description

Module will always be discoverable if no device connected (BR/EDR or BLE),
and be undiscoverable if connected with remote device, unless received this command

AT+PAGE: Get/Set BR/EDR Connectability

Command

AT+PAGE=Param

Param

Mode(0-1)
0: Leave BR/EDR connectable mode (stop paging)
1: Enter BR/EDR connectable mode (start paging)

Description

Module will always be connectable mode if no device connected,
and be unconnectable if connected with remote device, unless received this command

AT+SCAN - Scan Nearby Devices

Command

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

Param1

scan type(0~3)
0: Stop scan
1: Scan nearby BR/EDR devices
2: Scan nearby BLE devices
3: Scan nearby BR/EDR/BLE devices

Param2

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

Param3

(1~25 Bytes ASCII)Name filter. Filter scan results with name if set

Description

Format description reference: +SCAN - Scan Result

AT+PLIST - Get/Delete Paired List

Command

AT+PLIST{=Param}

Param

(0/1~8/12 Bytes MAC address)
(0) Clear all paired record
(1~8) Clear specific paired record with index
(MAC) Clear specific paired record with MAC address

Response1

+PLIST=Param1, Param2, Param3{,Param4}

Param1

(1~8) Paired device’s index

Param2

A base-10 representation of a bit field, support profiles of device, see AT+PROFILE

Param3

(MAC) Paired device’s MAC address

Param4

(UTF8) Paired device’s name

Response2

+PLIST=E End of the paired record

Example:Read module’s paired record
<< AT+PLIST
>> +PLIST=1,32808,1C5CF226D773, iPhone12
+PLIST=2,40, A0BC30075421, Samsung S8
+PLIST=E
>> OK

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

AT+DSCA - Release All Connections

Command

AT+DSCA

Description

Module release all Bluetooth connections with remote device

AT+TPMODE - Turn On/Off Throughput Mode

Command

AT+TPMODE{=Param}

Param

Throughput mode(0~1,default:0) 0: Turn Off 1: Turn On

Response

+TPMODE=Param

Description

When SPP/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+SECCFG: Get/Set Security Level

Command

AT+PAIR=Param

Param

Mode(0-1),default:0
0: Level 0
1: Level 2

SPP Commands

AT+SPPSTAT - Read SPP State

Command

AT+SPPSTAT

Response

+SPPATAT=Param

Description

Format description reference: +SPPSTAT - SPP State

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~492)

Param2

Payload (1~492 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

GATT Commands

AT+GATTSTAT - Read GATT State

Command

AT+GATTSTAT

Response

+GATTATAT=Param

Description

Format description reference: +GATTSTAT - GATT State

AT+GATTDISC - Release GATT Connection

Command

AT+GATTDISC

Description

Release current GATT connection with remote device

AT+GATTSEND - Send Data Via GATT

Command

AT+GATTSEND=Param1,Param2

Param1

Payload length (1~492)

Param2

Payload (1~492 Bytes UTF8)

Description

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

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

HID Commands

AT+HIDSTAT - Read HID State

Command

AT+HIDSTAT

Response

+HIDATAT=Param

Description

Format description reference: +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+HIDMODE - Get/Set HID Input Mode

Command

AT+HIDMODE{=Param}

Param

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

Note

Module can support various keyboard language with specify firmware,
such as:TURKEY SPAIN PORTUGAL FRANCE GERMANY ITALY CZECH JAPAN

AT+HIDDLY - Get/Set HID Report Period

Command

AT+HIDDLY{=Param}

Param

HID report period in millisecond, default 10 ms

AT+HIDSEND - Send HID Keyboard Report

Command

AT+HIDSEND=Param1,Param2

Param1

Report length

Param2

Report payload

Note

For special key code:
0x0D -> ENTER
0x08 -> BACKSPACE
0x09 -> TAB
0x20 -> SPACE
Example: Send key code ‘A’ to remote device (on AT+HIDMODE=1)
>> AT+HIDSEND=1,A
<< OK
Example: Send key code ‘A’ to remote device (on AT+HIDMODE=0)
<< AT+HIDSEND=2, x00 x04
>> OK
Note: As payload is hex value, hence actual command is:
41 54 2B 48 49 44 53 45 4E 44 3D 32 2C 00 04 0d 0a
Where:
00 : modifier
04 : key code
Module will auto send debounce key code by itself

AT+HIDCMD - Send HID User Report

Command

AT+HIDCMD=Param

Param

2 bytes hid user report
e.g., for iPhone:
Play/Pause: 00 CD
Stop: 00 B7
Forward: 00 B5
Backward: 00 B6
Fast Forward: 00 B3
Rewind:00 B4
Record:00 B2
VolumpUp:00 E9
VolumpDn:00 EA
Mute:00 E2
On screen keyboard Toggle:01 AE
Example: Send Volume Up to iPhone
<< AT+HIDCMD= x00 xE9
>> OK
Note: As the payload is hex value, hence actual command is:
41 54 2B 48 49 44 43 4D 44 3D 00 E9 0D 0A

Events Table

General Events

+PWRSTAT - Powering State

Format

+PWRSTAT=Param

Param

0-Powering off 1-Powering on(booting)

Description

AT Command is not recommended to be used while powering on/off state

+SCAN - Scan Result

Format1

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

Param1

Index

Param2

RSSI (-127 ~ -1)

Param3

Device address type (0~3)
(0) BR/EDR address
(1) LE public address
(2) LE random address
(3) iOS device with Carplay support

Param4

MAC address (12 Bytes ASCII)

Param5

Device Name for BR/EDR devices or advertising data for LE devices

Param6

Class of device(6 Bytes ASCII)

Format2

+SCAN=E: Scan stopped

Example: Scan BR/EDR nearby devices
<< AT+SCAN=1
>> OK
>> +SCAN=1,-32,3,B019C66209FA,wt-iphone,7A020C
>> +SCAN=2,-74,0,DC0D30000053,BW226,040680
>> +SCAN=3,-43,0,00158354F994,LAPTOP-3L,120104
>> +SCAN=E

+PAIRREQ - Pair Request

Format

+PAIRREQ=Param1,Param2{,Param3}

Param1

Passkey (000000~999999)

Param2

MAC address (12 Bytes ASCII) of current pairing device

Param3

Name of current pairing device

+PAIRED - Pair Result

Format

+PAIRED=Param1,Param2

Param1

Pair result (0)-Success (1~255)-Failed reason

Param2

MAC address (12 Bytes ASCII) of current pairing device

SPP Events

Note

Events for iAP2 (Apple Accessory Protocol) and AAP (Android Auto Protocol) are almost the same with SPP, which are:

  • +IAPSTAT, +IAPDATA for iAP2 profile

  • +AAPSTAT, +AAPDATA for AAP profile

Document will omit these events.

+SPPSTAT - SPP State

Format

+SPPSTAT=Param

Param

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

+SPPDATA - SPP Received Incoming Data

Format

+SPPDATA=Param1,Param2

Param1

Payload length

Param2

Payload

Example: Received data “1234567890” from remote device via SPP
<< +SPPDATA=10,1234567890

GATT Events

+GATTSTAT - GATT State

Format

+GATTSTAT=Param

Param

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

+GATTDATA - GATT Received Incoming Data

Format

+SPPDATA=Param1,Param2

Param1

Payload length

Param2

Payload

Example: Received data “1234567890” from remote device via GATT
<< +GATTDATA=10,1234567890

HID Events

+HIDSTAT - HID State

Format

+HIDSTAT=Param

Param

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

Application scenarios

Read/Write Parameters

_images/read_write.png

MCU change device name CARKIT reference code:

 1void change_name(void)
 2{
 3    uart_send("AT+NAME\r\n");
 4    if(uart_read("+NAME",name_buf))
 5    {
 6        if(memcmp(name_buf,"CARKIT",6))
 7        {
 8            uart_send("AT+NAME=CARKIT,0\r\n");      //defalut disable MAC address suffix
 9            uart_send("AT+NAME\r\n"); // read bt name
10            if(uart_read("+NAME",name_buf))
11            {
12                if(memcmp(name_buf,"CARKIT",6))
13                {
14                    //change name fail
15                }
16                else
17                {
18                    //change name success
19                }
20            }
21        }
22    }
23}

Note

modify any parameters, it is recommended to query first and then modify the final verification

Data Throughput

  • Typical SPP Slave Data Throughput Interaction:

_images/throughput.png

SPP Master-Slave

  • One of the standard firmwares of the module simultaneously supports SPP master and SPP slave features, when the user use the AT commands for the SPP master feature, the module will act as master role, otherwise, it acts as slave role.

  • The list of AT commands for the SPP master feature:

Commands

Description

AT+SCAN

Scan nearby devices

AT+SPPCONN

Establish SPP connection

AT+SPPSTAT

Read SPP state

AT+SPPDISC

Release SPP connection

AT+SPPSEND

Send data via SPP

  • Typical AT-Command Mode SPP Master Interaction:

_images/SPP.png

Appendix

Download PDF Document

Download PDF Document