FSC-BT631D Programming User Guide

[中文版]

Introduction

Description

This design guide is suitable for engineers to develop FSC-BT631D Bluetooth modules

Module Default Settings

Name

FSC-BT631D-XXXX

LE-Name

FSC-BT631D-LE-XXXX

Pin Code

0000

Secure Simple Pairing Mode

On

UART Baudrate

115200/8/N/1

Hardware Description

Pin Diagram

_images/BT631D_pin_map.png

Pin Description

Pin

Pin Name

Type

Pin Descriptions

14

I2S_OUT

O

I2S DATA OUT

15

I2S_CLK

I/O

I2S BCLK

16

I2S_IN

I

I2S DATA IN

17

I2S_WS

I/O

I2S SYNC

18

I2S_MCLK

I/O

I2S MCLK

21

LED0

I/O

LED0

22

LED1

I/O

LED1

23

RESET

I

External reset input: active Low

24

VBUS

VDD

3.3V power supply, recommended: use LDO power supply

25

GND

GND

GND

26

USB_DP

USB_DP

USB_DP

27

USB_DN

USB_DN

USB_DN

30

UART_RTS

I/O

UART RTS(default: PA mute pin)

31

UART_TX

O

UART TX

32

UART_RX

I

UART RX

33

UART_CTS

I/O

UART CTS(default: No connection required)

35

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/VDD_IO/VREG_IN/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

  • BT631D is a module that supports both classic Bluetooth and LE Audio. Currently, LE Audio supports BIS function, and more other functions will be developed in the future.

  • As the transmitter of BIS, the audio source can be the A2DP of the mobile phone, I2S input (for the development board, it is an analog input, currently only supports the external codec TLV320AIC3204), or USB.

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)

  • BIS (broadcast isochronous stream)

  • CIS (Connected Isochronous Stream)

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 “ERROR” 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-BT631D-XXXX
>> OK

Pick up an incoming call when no call incoming actually
<< AT+HFPANSW
>> ERR003

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 the command AT+SEP to replace the default separator to prevent conflicts

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

Call phone 10086
>> +HFPSTAT=4
>> +HFPAUDIO=1
>> +HFPSTAT=6,10086

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

Note

If you need to upgrade to the latest version, please refer to FSC-BT631D OTA User Guide

AT+SEP - Read/write Event delimiter

Command

AT+SEP{=Param}

Param

Setting range 0x01~0xFF, default: ‘,’, where ‘0’ means 0xFF

Response

Returns the current delimiter

Description

Parameters for events/responses, which may contain the same value as the default delimiter,
Use this command to replace the default delimiter to prevent conflicts.
(Usually the default delimiter “,” is replaced by the hexadecimal value “xFF”)
Example:Read the pairing record of the module
<< AT+PLIST
>> +PLIST=1,32808,1C5CF226D773, Tony, iPhone12
>> +PLIST=2,40, A0BC30075421, Samsung S8
>> +PLIST=E
>> OK
Example: Set the separator to ‘0xFF’
<< AT+SEP=0
>> OK
Example: Read the pairing record of the module 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

Production Date

Note

After upgrading the firmware, the production date will not change

Example:
<< AT+VER
>> +VER=BT631D,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

Returns all currently supported baud rates

Description

The module will switch the baud rate immediately after receiving this command.
BT631D and BT955 do not support 2400
Example:
Read module’s baudrate
<< AT+BAUD
>> +BAUD=2400,4800,9600,19200,38400,57600,115200,128000,230400,256000,
460800,512000,921600,1382400
>> OK

Set baud rate
<< AT+BAUD=9600
>> OK

AT+I2CREG - Read/write I2C registers

Command

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

Param1

i2c bus address, 2 byes hex string

Param2

i2c register address, 2/4 byes hex string

Param3

bytes to read/write (1~64)

Param4

value to write

Response

+I2CREG=Param

Param

Returns the current value read by I2C

Note

The current version of BT631D does not fully support this command, please do not use it.
Reserved for subsequent releases.
Example:Read external I2C slave device, address:0x34, register 0003, bytes:2; and modify 0xA13B
<< AT+I2CREG= 34,0003,2
>> +I2CREG=805F
>> OK
<< AT+I2CREG= 34,0003,2,A13B
>> OK

AT+I2SCFG - Get/Set I2S Settings

Command

AT+I2SCFG{=Param}

Param

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

BIT[0]

0:disable; 1:enable

BIT[1]

0:master; 1:slave

BIT[2]

0:FS=48000Hz;1:FS=44100Hz

BIT[3-4]

00: I2S standard format
10: PCM short frame format

BIT[5-6]

00: bit depth=16bits
10: bit depth=32bits (only 16bits of MSB effective)
11: bit depth=32bits (only used for PCM mode)

Response

+I2SCFG=Param

Note

The current version of BT631D does not fully support this command, please do not use it.
Reserved for subsequent releases.

Example:Usual configuration and description:

0

In simulation mode, the module will detect the internal/external codec through I2C at startup and report +CODEC=id

1

I2S Master; Sample rate=48000Hz; Resolution=16bits; Bit clock= 48000*16*2ch=1.536Mhz

3

I2S Slave; Sample rate=48000Hz; Resolution=16bits; Bit clock= 48000*16*2ch=1.536Mhz

65

I2S Master; Sample rate=48000Hz; Resolution=32bits; Bit clock= 48000*32*2ch=3.072Mhz

67

I2S Slave; Sample rate=48000Hz; Resolution=32bits; Bit clock= 48000*32*2ch=3.072Mhz

113

PCM Master; Sample rate=48000Hz; Resolution=16bits; Bit clock= 48000*16*2ch=1.536Mhz

AT+MICGAIN - Get/Set Analog Input Gain

Command

AT+MICGAIN{=Param1,Param2}

Param1

music gain (0~15, default:8)

Param2

call gain (0~15, default:8)

Description

Adjust Codec analog input volume

AT+SPKVOL - Get/Set Analog Output Volume

Command

AT+SPKVOL{=Param1,Param2}

Param1

A2DP Volume (0~15, default:10)

Param2

HFP Volume (0~15, default:10)

Description

Adjust Codec analog output volume

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[13]

BIS/CIS Gateway (LE AUDIO gateway)

BIT[14]

BIS/CIS Headset (LE AUDIO headset)

BIT[15]

*** (For iOS devices)

Response

+PROFILE=Param

Description

GATT Server and Client, HFP Sink and Source cannot be enabled at the same time,
A2DP Sink and Source,AVRCP Controller and Target.
BIS Headset can only be enabled individually.
The default Profile: 9387 can be connected by the mobile phone through A2DP,
and the audio will be broadcast through BIS.
Example:Read current profile selection
<< AT+PROFILE
>> +PROFILE=1195
Example:Only enable A2DP Sink, HFP Sink,disable the others
<< AT+PROFILE=160
>> OK
Example:Only enableA2DP Source,HFP Source,disable the others
<< AT+PROFILE=80
>> OK

AT+AUTOCONN - Turn On/Off Power On Auto Reconnect

Command

AT+AUTOCONN{=Param}

Param

Expressed in decimal bit field, format reference: AT+PROFILE

Response

+AUTOCONN=Param

Description

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

AT+STAT - Get All Profile State

Command

AT+STAT

Response

+STAT=Param1, Param2, Param3…

Description

Query the current status of all enabled Profiles

Example:Read the current Profile
<< AT+PROFILE
>> +PROFILE=83
Example:Read Profile status
<< AT+STAT
+STAT=3,1,2,5
>> OK
_images/profile_state.png

AT+DEVSTAT - Read Device State

Command

AT+DEVSTAT

Response

+DEVSTAT=Param

Param

Represented in decimal bit field,

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 configuration 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 - Read BR/EDR Bluetooth MAC address

Command

AT+ADDR

Response

+ADDR=Param

Param

Module’s BR/EDR Bluetooth 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 BLE Bluetooth 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

Param

+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-BT631D-XXXX
>> OK

Change module’s BR/EDR local name to “ABC”,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 - 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

Description

In BIS Headset mode, the module will actively search for and local
Bluetooth BIS Gateway device with the same name and actively establish synchronization.

AT+SSP - Read/write 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

Take effect after restart

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

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

AT+CFM - Accept/reject pairing requests from the remote end

Command

AT+CFM=Param1, Param2

Param1

MAC address of the remote device(12Bytes)

Param2

0-Reject the remote pairing request
1-Accept pairing requests from the remote end

Description

When +SSP=3, the CFM command is valid

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: Read/write BR/EDR connectable mode

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

If no device is connected, the module will always be in connectable mode,
If connected to a remote device, the module will not be connectable unless
this command is received

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 programs do not support)
3: Scan nearby BR/EDR/BLE devices(Some programs do not support)

Param2

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

Param3

(1~25 Bytes ASCII)filter name.

Description

Format description reference: +SCAN - Scan Result

AT+RSSI: Read BR/EDR signal strength

Command

AT+RSSI=Param

Param

MAC address of the currently connected device

Response

+PIN=Param

Param

RSSI value (-127 ~ 0)

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

In decimal digit field, device connection profile, refer to 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+AUDROUTE - Audio Route Manager

Command

AT+AUDROUTE{=Param}

Param

Note: HF1 & HF2 means peer Bluetooth headphones
0 Stop audio routing
1 Route music (a2dp streaming) from Module to HP1/HP2 simultaneously
2 Route voice call (hfp sco) between Module and HP1
3 Route voice call (hfp sco) between Module and HP2
4 Route voice call (hfp sco) between HP1 and HP2 (intercom mode)
5 Route voice call (hfp sco) from Module to HP1/HP2 simultaneously
6 Route music (a2dp streaming) from Module to HP1 only
7 Route music (a2dp streaming) from Module to HP2 only

Description

Some route mode require specify firmware version,
refer to application note for more description: Source mode connection

AT+AUXCFG - Audio Input Mode Configuration

Command

AT+AUXCFG{=Param}

Param

Mode (0~3, Default:2)
0: Audio input via USB
1: Audio input via I2S
2: Audio input via A2DP
3: Audio is input via A2DP but is no longer broadcast out via BIS

Response

+AUXCFG=Param

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+TXPOWER - tx power configuration

Command

AT+TXPOWER{=Param}

Param

(value:0-7, Default:7)

Description

Only valid for BT631D Classic Bluetooth part

Value

Power(dBm)

0

-24

1

-20

2

-16

3

-12

4

-8

5

-4

6

0

7

4

HFP Command

AT+HFPSTAT - Read HFP State

Command

AT+HFPSTAT

Response

+HFPSTAT=Param1{,Param2{,Param3}}

Description

Format description reference: +HFPSTAT - HFP State

AT+HFPSR - Read/Write HFP Sample rate

Command

AT+HFPSR{=Param}

Param

Sampling rate during HFP call, configurable: 0/8000/16000/48000 Default:0

Response

+HFPSR=Param

Description

This parameter will override the voice call settings in AT+I2SCFG,
and use this parameter to set the sampling rate of HFP I2S

AT+HFPCFG - Read/Write HFP configuration

Command

AT+HFPCFG{=Param}

Param

Expressed in decimal bit field, default: 2

BIT[0]

0-When HFP is disconnected abnormally, the link to the last disconnected device will not be restored.
1-When HFP is disconnected abnormally, the link to the last disconnected device will not be restored.

BIT[1]

0-Turn off the echo cancellation function;
1-turn on the echo cancellation function

BIT[2]

0-turn off the three-way calling function,
1-turn on the three-way calling function (the firmware needs to support the three-party calling function)

AT+HFPCONN - Establish HFP Connection

Command

AT+HFPCONN{=Param}

Param

MAC address of target device(12 Bytes ASCII)

Description

Reconnect to last HFP device if parameter not exist

Example:Connect to last HFP device
<< AT+HFPCONN
>> OK
Example:Connect to specific HFP device with MAC address
<< AT+HFPCONN=1C5CF226D773
>> OK

AT+HFPDISC - Release HFP Connection

Command

AT+HFPDISC

Description

Release current HFP connection with remote device

AT+HFPDIAL - Redial/Dial phone number

Command

AT+HFPDIAL{=Param}

Param

Phone number (1~25 Bytes ASCII)

Description

Dial specific number if parameter exist, otherwise redial

Example:Redial
<< AT+HFPDIAL
>> OK
Example:Dial “075527924639”
<< AT+HFPDIAL=075527924639
>> OK

AT+HFPDTMF - Send DTMF

Command

AT+HFPDTMF{=Param}

Param

DTMF (0~9/#/*)

Example:During call,send DTMF “#”
<< AT+HFPDTMF=#
>> OK

AT+HFPANSW - Pick up Incoming Call

Command

AT+HFPANSW

Description

Pick up an incoming call

AT+HFPCHUP - Reject/hang up incoming and outgoing calls

Command

AT+HFPCHUP

Description

Reject an incoming call or hang up an outgoing call/conversation

AT+HFPMCAL - Three-way call control

Command

AT+HFPMCAL=Param

Param

0: Release held call or reject waiting call
1: Release active call and accept another call
2: Hold active call and accept another call

Description

See application scenarios: HFP three-way call operation

AT+HFPADTS - Voice Switching

Command

AT+HFPADTS=Param

Param

1: Stream voice audio from module to remote device
2: Transfer voice audio from remote device to module

Description

If the parameter is empty, alternate switching

AT+HFPVR - Start/Stop speech recognition on remote device

Command

AT+HFPVR=Param

Param

0-Stop 1-Start

Description

Start/stop speech recognition for remote devices (e.g. Siri for iOS devices)

AT+HFPINFO - Read HFP current information

Command

AT+HFPINFO

Description

Returns the current HFP status, signal strength, battery, device name and other information

AT+MICMUTE - Mute Microphone

Command

AT+MICMUTE=Param

Param

0-unmute 1-mute

Description

Mute local microphone during calls

A2DP/AVRCP Commands

AT+A2DPSTAT - Read A2DP State

Command

AT+A2DPSTAT

Response

+A2DPSTAT=Param

Description

Format description reference: +A2DPSTAT - A2DP State

AT+A2DPCONN - Establish A2DP Connection

Command

AT+A2DPCONN{=Param}

Param

MAC address of target device(12 Bytes ASCII)

Description

Reconnect to last A2DP device if parameter not exist

AT+A2DPDISC - Release A2DP Connection

Command

AT+A2DPDISC

Description

Release current A2DP connection with remote device

AT+A2DPINFO - Read A2DP Current Information

Command

AT+A2DPINFO

Description

Returns the current A2DP status, remote device name and other information

AT+A2DPSR - Write A2DP Sample rate

Command

AT+A2DPSR=Param

Param

Sample rate:48000/44100

Description

The setting is valid in A2DP Source mode

AT+AVRCPSTAT - Read AVRCP State

Command

AT+AVRCPSTAT

Response

+AVRCPSTAT=Param

Description

Format description reference: +AVRCPSTAT - AVRCP State

AT+AVRCPCFG - Read/Write AVRCP Configuration

Command

AT+AVRCPCFG{=Param}

Param

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

BIT[0]

Auto get track ID3 information (title, artist, album) on track changed.default:1

BIT[1-3]

Auto get track play progress if value > 0. 默认:1(second)

BIT[4]

Player browsing function enable/disable

BIT[5]

Specify a folder to automatically pull media cover images

Example: Read AVRCP Configuration
<< AT+AVRCPCFG
>> +AVRCPCFG=1
OK
Example: Set to 5 seconds to report playback progress
<< AT+AVRCPCFG=9
>> OK

AT+PLAYPAUSE - Track Play/Pause

Command

AT+PLAYPAUSE

Description

Send play or pause command to remote media player according to current play status

AT+PLAY - Track Play

Command

AT+PLAY

Description

Send play command to remote media player

AT+PAUSE - Track Pause

Command

AT+PAUSE

Description

Send pause command to remote media player

AT+STOP - Track Stop

Command

AT+STOP

Description

Send stop command to remote media player

AT+FORWARD - Track Forward

Command

AT+FORWARD

Description

Send forward command to remote media player

AT+BACKWARD - Track Backward

Command

AT+BACKWARD

Description

Send backward command to remote media player

AT+REPEAT - Set media player repeat mode

Command

AT+REPEAT{=Param}

Param

Repeat mode (0/1) 0-Turn Off 1-Turn On

Response

+PLAYMODE=Param1,Param2

Param

Format description reference: +PLAYMODE - Media Player Repeat/Shuffle Mode

AT+SHUFFLE - Set media player shuffle mode

Command

AT+SHUFFLE{=Param}

Param

Shuffle mode (0/1) 0-Turn Off 1-Turn On

Response

+PLAYMODE=Param1,Param2

Param

Format description reference: +PLAYMODE - Media Player Repeat/Shuffle Mode

AT+GETMP - Get the media player of the remote device

Command

AT+GETMP

Response

+BROWDATA=Param1,Param2,Param3,Param4

Param

Format description reference: +BROWDATA - Media Player File System Browsing Data

Description

Get the media player of the remote device. Only players with the browsable flag set support browsing.
For some mobile phones (such as iOS devices), users may need to start the player on the mobile phone for the first time
Please see application scenarios: AVRCP file system browsing

AT+SETMP - Select media player

Command

AT+SETMP=Param

Param

Media player index

Response

+BROWDATA=Param1,Param2

Param

Format description reference: +BROWDATA - Media Player File System Browsing Data

Description

To select a media player to browse, the player’s browsable flag must be set.
After selecting the player we will enter the root directory, please refer to the application scenario: AVRCP file system browsing

AT+GETFD - List Subfolders/Tracks of Selected Folder

Command

AT+GETFD=Param1,Param2

Param1

Starting position, (1~65535)

Param2

End position, (1~65535), Param2 >= Param1

Description

List subfolders or media items in the current folder. Please see application scenarios: AVRCP file system browsing

AT+SETFD - Select And Enter The Folder

Command

AT+SETFD=Param

Param

0:Enter up level folder other:Enter selected folder

Description

Select and enter the folder to browse. Please see application scenarios: AVRCP file system browsing

AT+GETNP - List tracks in the “Now Playing” list

Command

AT+GETNP=Param1,Param2

Param1

(1~65535),Start position

Param2

(1~65535),End position, Param2 >= Param1

Response

+BROWDATA=M,Param1,Param2,Param3

Param

Format description reference: +BROWDATA - Media Player File System Browsing Data

AT+ADDMP - Add tracks to media player

Command

AT+ADDMP=Param

Param

Track ID

Description

Add selected tracks to media player and start playing

PBAP指令

AT+PBSTAT - Read PBAP state

Command

AT+PBSTAT

Response

+PBATAT=Param

Description

Format description reference: +PBSTAT - PBAP State

AT+PBCONN - Establish PBAP Connection

Command

AT+PBCONN{=Param}

Param

MAC address of target device(12 Bytes ASCII)

Description

Module will use current HFP device’ MAC address if parameter not exist
For some firmware release, module will establish PBAP connection automatically on received command AT+PBDOWN

AT+PBDISC - Release PBAP Connection

Command

AT+PBDISC

Description

Release current PBAP connection with remote device

AT+PBDOWN - Download Phonebook

Command

AT+PBDOWN=Param1{,Param2}

Param1

Phonebook type(0-5)
(0) Phonebook (SIM Storage)
(1) Phonebook (Phone Storage)
(2) Received call log
(3) Dialed call log
(4) Missed call log
(5) All call log

Param2

Max items (1~65535, default:3000 for phonebook; 50 for call log)

Description

For some phones (e.g. iPhone), the contact download permission must be turned on in phone’s Bluetooth settting
refer to application note for more description: Phonebook/Contact photo download

AT+PBABORT - Cancel Phonebook Download

Command

AT+PBABORT

Description

Cancel phonebook download

BIS Command

AT+BISCONN - Connecting to the BIS Gateway device

Command

AT+BISCONN{=Param}

Param

Target device Bluetooth name. If no parameters are provided, it will automatically search and connect to the BIS Gateway device.

CIS Command

AT+CISCONN - Connecting to the CIS Headset device

Command

AT+CISCONN{=Param}

Param

Target device Bluetooth name. Automatically connects to the right earpiece after connecting to the left earpiece. If no parameters are provided, it will reconnect to the previously connected device.

AT+AUDIOMODE - Turn On/Off CIS Mode

Command

AT+AUDIOMODE=Param

Param1

(0) Turn off CIS mode,Turn on BIS mode
(1) Turn on CIS mode,Turn off BIS mode

AT+AUDIOCH - Select audio channel

Command

AT+AUDIOCH=Param

Param1

(0) Left audio channel
(1) Right audio channel

AT+TALK - Turn On/Off CIS Intercom Communication

Command

AT+TALK=Param

Param1

(0) Turn off Intercom
(1) Turn on Intercom

Description

The intercom feature requires establishing a CIS connection first, and the audio source of CIS cannot be A2DP.
The intercom function is established between the transmitter and receiver (left audio channel) of CIS.

SPP Command

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 Server Command

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

GATT Client Command

AT+LECONN - GATT Server Connection

Format

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

Param1

12-byte device address + 1-byte address type(0:public,1:random)

Param2

ServiceUUID (16 or 128 bit)

Param3

WriteUUID (16 or 128 bit)

Param4

NotifyUUID (16 or 128 bit)

Description

Initiates a connection to the specified device. The parameter consists of 12 bytes (device address) and 1 byte (address type).
Generally, the address type is 0 or 1.
The address type is obtained by using the AT+SCAN=2 command to scan the third parameter returned :ref: ‘REF100’
Example :+SCAN=0,-74,2,DD0D30037591 indicates that the LE device broadcasts data
Example: Connect the GATT Server with DD0D30037591. The ServiceUUID is 0xFFF0, WriteUUID is 0xFFF2, and NotifyUUID is 0xFFF1
<< AT+LECONN=DD0D300375911,FFF0,FFF2,FFF1
<< OK

AT+LEDISC - Release GATT Connection

Command

AT+LEDISC

Description

Disconnect the current GATT connection from the remote device

AT+LESEND - Send Data Via GATT

Format

+LESEND=Param1,Param2

Param1

Payload length

Param2

Payload

Description

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

Example: Send data to remote device through GATT Client “1234567890”
<< AT+LESEND=10,1234567890
>> OK

HID Command

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

Description

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

Example: Send key code ‘A’ to remote device (on AT+HIDMODE=1)
>> AT+HIDSEND=1,A
<< OK
Example: Send key code ‘4’ to remote device (on AT+HIDMODE=0)
<< AT+HIDSEND=4, xA1 x01 x00 x04
>> OK
Note: As payload is hex value, hence actual command is:
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
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

Description

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

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 - Power on status

Format

+PWRSTAT=Param

Param

0-Powering off 1-Powering on(booting)

Description

It is not recommended to use AT commands during power on and off.

+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

BR/EDR device name or LE device broadcast data

Param6

Device type(6 Bytes ASCII)

Format2

+SCAN=E: Stop scan

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 - Pairing Request

Format

+PAIRREQ=Param1,Param2{,Param3}

Param1

Passkey (000000~999999)

Param2

The MAC address of the currently paired device (12 Bytes ASCII)

Param3

The name of the currently paired device

+PAIRED - Pair Result

Format

+PAIRED=Param1,Param2

Param1

Pair Result (0)-Success (1~255)-Failure reason

Param2

The MAC address of the currently paired device (12 Bytes ASCII)

+CODEC - Codec ID

Format

+CODEC=Param

Param

Code id

Description

This command is currently invalid, please ignore it

HFP Events

+HFPSTAT - HFP State

Format

+HFPSTAT=Param1{,Param2{,Param3}}

Param1

(0~10)
(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
(4) Outgoing call
(5) Incoming call
(6) Active call
(7) Active held (3-way-calling)
(8) First call active, second call waiting (3-way-calling)
(9) First call active, second call held (3-way-calling)
(10) First call outgoing, second call held (3-way-calling)

Param2

Phone number, When status>3

Param3

Phone number (three-way call)

Example: Call 10086
<< AT+HFPDIAL=10086
>> +HFPSTAT=3
>> +HFPSTAT=4,10086
>> +HFPAUDIO=1
Example: The call is coming and the number is 13265463800
>> +HFPSTAT=5, 13265463800
>> +HFPAUDIO=1

+HFPDEV - HFP Remote Device Information

Format

+HFPDEV=Param1{,Param2}

Param1

(12 Bytes ASCII), 当前HFP连接远端设备的MAC地址

Param2

(UTF8), 当前HFP连接远端设备的名称

Example: HFP connect success with device
>> +HFPDEV=1C5CF226D774, iPhone

+HFPAUDIO - HFP Voice Audio State

Format

+HFPAUDIO=Param

Param

(0) HFP voice audio disconnected, audio input/output routed to remote device
(1) HFP voice audio connected, audio input/output routed to module

+HFPSIG - HFP Remote Device Network Signal Strength

Format

+HFPSIG=Param

Param

(0~5) Network signal strength of remote device

+HFPROAM - HFP Remote Device Roaming State

Format

+HFPROAM=Param

Param

(0/1) Roaming state of remote device

+HFPBATT - HFP Remote Device Battery Level

Format

+HFPBATT=Param

Param

(0~5) Battery level of remote device

+HFPNET - HFP Remote Device Network Operator Selection

Format

+HFPNET=Param

Param

(UTF8) Network operator selection of remote device

+HFPMANU - HFP Remote Device Manufacture

Format

+HFPMANU=Param

Param

(UTF8) Manufacture name of remote device

+HFPNUM - HFP Remote Device Phone Subscriber Number

Format

+HFPNUM=Param

Param

(ASCII) Phone subscriber number of remote device

+HFPIBR - HFP Remote Device In-band-ring Support

Format

+HFPIBR=Param

Param

0-No support 1-support

Description

Report whether the current connected phone support in-band-ring

+HFPRING - HFP Remote Device n-band-ring Indication

Format

+HFPRING=Param

Param

0-No support in-bang-ring 1-support in-band-ring

Description

The mobile phone is ringing when the call comes. If the remote mobile phone does not support in-band-ring, the module plays the local ringtone.

A2DP/AVRCP Events

+A2DPSTAT - A2DP State

Format

+A2DPSTAT=Param

Param

(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
(4) Paused
(5) Streaming

+A2DPDEV - A2DP Remote Device Information

Format

+A2DPDEV=Param1{,Param2}

Param1

(12 Bytes ASCII), Remote device’s MAC address of current A2DP connection

Param2

(UTF8), Remote device’s name of current A2DP connection

+AVRCPSTAT - AVRCP State

Format

+AVRCPSTAT=Param

Param

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

+PLAYSTAT - Media Player State

Format

+PLAYSTAT=Param

Param

(0) Stopped
(1) Playing
(2) Paused
(3) Fast Forwarding
(4) Fast Rewinding

+PLAYMODE - Media Player Repeat/Shuffle Mode

Format

+PLAYMODE=Param1,Param2

Param1

Repeat Mode (1~4)
(1) Off
(2) Single Track
(3) All Tracks
(4) Group

Param2

Shuffle Mode (1~3)
(1) Off
(2) All Tracks
(3) Group

+TRACKSTAT - Media Player Play Progress

Format

+TRACKSTAT=Param1,Param2,Param3

Param1

(0~4), Media Player State, see +PLAYSTAT

Param2

(Decimal ASCII),Elapsed time of current track in millisecond

Param3

(Decimal ASCII),Total time of current track in millisecond

Example: Read media player play progress every 1s
>> +TRACKSTAT=1,54000,322000
>> +TRACKSTAT=1,55000,322000
>> +TRACKSTAT=1,56000,322000

+TRACKINFO - Media Track Information

Format

+TRACKINFO=Param1,Param2,Param3

Param1

title

Param2

artist

Param3

album

Example: Phone playing song “Creep-Radio Head”
>> +TRACKINFO=Creep,Radiohead,Pablo Honey

+BROWSTAT - Media Browsing Status

Format

+BROWSTAT=Param

Param

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

+BROWDATA - Media Player File System Browsing Data

Format

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

Param1

Browsing type, for each type, the following data represents:

P

Parame1: media player information
Parame2: 0 – support browsing; 1- not support browsing
Parame3: media player id
Parame4: media player name

R

Parame1: root dictionary name
Parame2: root dictionary name

F

Parame1: folder ID and name
Parame2: folder ID
Parame3: folder name

M

Parame1: media track ID and name
Parame2: media track ID
Parame3: media track name

E

Parame1: browsing operation result code
Parame2: 0 - browsing success; other - browsing error code

Description

Please see application scenarios: AVRCP file system browsing

+BIPSTAT - BIP State

Format

+BIPSTAT=Param

Param

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

Description

BIP configuration files are now only used for media player cover image downloads, please see application scenarios: AVRCP album image download

+COVERART - Media Track Cover Downloaded Successfully

Format

+COVERART=Param

Param

Image ID

Description

The cover image is placed in the specified folder named ImageID.jpg. Please refer to the application scenario: AVRCP album image download

Phonebook Access Events

+PBSTAT - PBAP State

Format

+PBSTAT=Param

Param

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

+PBCNT - Phonebook Entries of Remote Device

Format

+PBCNT=Param

Param

Phonebook entries of remote device

+PBDATA - Phonebook Data

Format1

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

Param1

Type
(0) Phonebook (SIM Storage)
(1) Phonebook (Phone Storage)
(2) Received call log
(3) Dialed call log
(4) Missed call log

Param2

Name

Param3

Number

Param4

(15 Bytes ASCII), Call time if current download type is call log
Format:
Year(4Bytes) Month(2Bytes) Day(2Bytes) T(1Byte) Hour(2Bytes)
Minute(2Bytes) Second(2Bytes). e.g. 20161012T152826 represents
2016/10/12/15/28/26

Format2

+PBDATA=E Download complete

Description

Call time may not exist for some mobile phones

Example: Download all phonebook
<< AT+PBDOWN=1
>> +PBCNT=234
+PBDATA=1 , Jack , 18219146201
+PBDATA=1 , kenan , 8613771972680
……
+PBDATA=E

Example: Download 10 dialed call log
<< AT+PBDOWN=3,10
>> +PBDATA=3 , China Mobile , 10086 , 20171013T103516
+PBDATA=3 , Jerry , 18688967507 , 20171012T152826
……
+PBDATA=E

SPP Events

Note

Because the instructions of AAP (Android Auto Protocol) are almost the same as SPP, they are:

+AAPSTAT, +AAPDATA for AAP profile

The documentation will ignore these instructions, and the default BT631D does not support this instruction.

+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

Profiles initializing and change parameter

The following figure shows Profile initialization and name modification

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Profile初始化

bt -> host: +DEVSTAT=0
bt -> host: +PWRSTAT=1
bt -> host: +VER=BT631D,V2.0.1,20210922
bt -> host: +PROFILE=1195
bt -> host: +SPPSTAT=1
bt -> host: +GATTSTAT=1
bt -> host: +A2DPSTAT=1
bt -> host: +AVRCPSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +PBSTAT=1
bt -> host: +DEVSTAT=1
bt -> host: +DEVSTAT=7 (be discovered and opened. The mobile phone can find bt and can connect to it.)

rnote over host, bt: change name to "CARKIT",disable suffix. and verify readback
host -> bt: AT+NAME
bt -> host: AT+NAME=FSC-BT631D-1E49
host -> bt: AT+NAME=CARKIT,0
bt -> host: OK
host -> bt: AT+NAME
bt -> host: +NAME=CARKIT

@enduml

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}

Sink mode connection

Note

BT631D default: AUXCFG=2,PROFILE=9387

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Profile初始化

bt -> host: +PROFILE=9387
bt -> host: ...
bt -> host: +DEVSTAT=7

rnote over host, bt: Mobile phone search and connect to us
bt -> host: +A2DPSTAT=2
bt -> host: +A2DPSTAT=3 (A2DP connected)
bt -> host: +A2DPDEV=8C861E94A09E,Navy
bt -> host: +AVRCPSTAT=3 (AVRCP connected)
bt -> host: +HFPSTAT=3 (HFP connected)
bt -> host: +HFPDEV=8C861E94A09E,Navy
bt -> host: +HFPSIG=3
bt -> host: +HFPBATT=4
bt -> host: +HFPROAM=0
bt -> host: +HFPNUM=8618620277271
bt -> host: +HFPMANU=AppleInc.

host -> bt: +HFPDIAL=10086 (dial number"10086")
bt -> host: OK
bt -> host: +HFPSTAT=4,10086
bt -> host: +HFPAUDIO=1 (audio established)
bt -> host: +HFPSTAT=6,10086 (call active)
host -> bt: AT+HFPCHUP(hung up)
bt -> host: +HFPSTAT=3
bt -> host: +HFPAUDIO=0 (audio release)

host -> bt: AT+PLAY(media streaming)
bt -> host: +A2DPSTAT=5
bt -> host: +PLAYSTAT=1(player playing)
bt -> host: +TRACKINFO=song,artist,album(track id3 info)
bt -> host: +TRACKSTAT=1,1,240
bt -> host: +TRACKSTAT=1,2,240
host -> bt: AT+PAUSE(pause media player)
bt -> host: +PLAYSTAT=2
bt -> host: +A2DPSTAT=4

@enduml

Source mode connection

Note

The transmission(source) mode connection needs to configure the module to A2DP Source, HFP Source By default, the program will not actively enter audio transmission mode or call (intercom) mode after connecting to headphones or speakers. You need to send instructions: Start audio transmission (AT+AUDROUTE=1) Start call (AT+AUDROUTE=2)

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Profile initialization

bt -> host: +PROFILE=339
bt -> host: ...
bt -> host: +DEVSTAT=7

rnote over host, bt: Scan nearby headphones and audio devices and connect them
host -> bt: AT+SCAN=1
bt -> host: +SCAN=1,-87,0,DC0D30001E49,FSC-BT631D-1E49,5A020C
bt -> host: +SCAN=2,-78,0,7C9A1DA36B41,AirPods,240404
bt -> host: +SCAN=E

host -> bt: AT+A2DPCONN=7C9A1DA36B41
bt -> host: +A2DPSTAT=2
bt -> host: +A2DPSTAT=3 (A2DP connected)
bt -> host: +A2DPDEV=7C9A1DA36B41,AirPods
bt -> host: +HFPSTAT=2
bt -> host: +HFPSTAT=3 (HFP connected)
bt -> host: +HFPDEV=7C9A1DA36B41,AirPods
bt -> host: +AVRCPSTAT=3 (AVRCP connected)


rnote over host, bt: Start audio transmit mode
host -> bt: AT+AUDROUTE=1
bt -> host: +PLAYSTAT=1
bt -> host: +A2DPSTAT=5
bt -> host: +AUDMODE=1 (Returns the current audio routing mode)

rnote over host, bt: Release audio transmit mode
host -> bt: AT+AUDROUTE=0
bt -> host: +PLAYSTAT=2
bt -> host: +A2DPSTAT=4
bt -> host: +AUDMODE=0

rnote over host, bt: Start call and intercom mode
host -> bt: AT+AUDROUTE=2
bt -> host: +HFPAUDIO=1 (audio establish)
bt -> host: +HFPSTAT=4
bt -> host: +AUDMODE=2
bt -> host: +HFPSTAT=6

rnote over host, bt: Release call and intercom mode
host -> bt: AT+AUDROUTE=0
bt -> host: +HFPAUDIO=0 (audio release)
bt -> host: +HFPSTAT=3
bt -> host: +AUDMODE=0

@enduml

MCU connects AirPods and starts audio transmission. Reference code:

 1#define PROFILE_HFP_HF              (uint16)(BIT3)
 2#define PROFILE_HFP_AG              (uint16)(BIT4)
 3#define PROFILE_A2DP_SINK           (uint16)(BIT5)
 4#define PROFILE_A2DP_SOURCE         (uint16)(BIT6)
 5
 6void bt_connect(void)
 7{
 8    //enable hfp source,a2dp source,avrcp tg,spp,gatt
 9    uart_send("AT+PROFILE=339\r\n"); //if profile changes,module will auto reboot,
10    wait_ms(500);
11    uart_send("AT+PROFILE\r\n");
12    uint32 profiles = uart_read("+PROFILE",profiles);
13    if(profiles & (PROFILE_A2DP_SOURCE|PROFILE_HFP_AG))
14    {
15        uint8 addr[6];
16        uint8 buf[30]={0};
17        uint8 a2dp_state=0
18        uart_send("AT+SCAN=1\r\n");
19        uart_read_scan_addr("+SCAN",addr);
20        sprintf(buf,"AT+A2DPCONN=%s\r\n",addr);
21        uart_send(buf); //send a2dp connect
22
23        uart_read("+A2DPSTAT",a2dp_state);
24        if(a2dp_state == 3) //a2dp connected
25        {
26            uart_send("AT+AUDROUTE=1"); // start a2dp audio
27        }
28        uart_read("+A2DPSTAT",a2dp_state);
29        if(a2dp_state == 5)
30        {
31            //a2dp streaming
32        }
33    }
34    else
35    {/*not support master*/}
36}

HFP three-way call operation

Note

BT631D and other modules do not turn on the three-way calling function. If you need to test this function, please contact Feiyitong.

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: HFP connected

bt -> host: ...
bt -> host: +HFPSTAT=3

rnote over host, bt: Dial "10086"
host -> bt: AT+HFPDIAL=10086
bt -> host: OK
bt -> host: +HFPSTAT=4,10086 (phone dialing)
bt -> host: +HFPAUDIO=1
bt -> host: +HFPSTAT=6,10086 (call active)

rnote over host, bt: Three-way call
bt -> host: +HFPSTAT=8,10086,18620277271
host -> bt: AT+HFPMCAL=2 (Hold active call and accept another call)
bt -> host: +HFPSTAT=9,18620277271,10086 (18620277271 active,10086 hold)
host -> bt: AT+HFPMCAL=2 (Hold active call and accept another call)
bt -> host: +HFPSTAT=9,10086,18620277271 (10086 active,18620277271 hold)

host -> bt: AT+HFPMCAL=1 (Release active call and accept another call)
bt -> host: +HFPSTAT=6,18620277271 (one call active now)

rnote over host, bt: hang up the phone
host -> bt: AT+HFPCHUP
bt -> host: +HFPAUDIO=0
bt -> host: +HFPSTAT=3

@enduml

AVRCP file system browsing

Note

The BT631D module does not open this function. If you need to test this function, please contact Feitong.

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: A2DP/AVRCP connected

bt -> host: ...
bt -> host: +AVRCPSTAT=3

rnote over host, bt: Operating file browsing function
bt -> host: +BROWSTAT=3 (browsing channel connected)
host -> bt: AT+GETMP (retrieve media players)
bt -> host: +BROWSTAT=4
bt -> host: +BROWDATA=P,1,1,Music (found browsable media player)
bt -> host: +BROWDATA=E,0
bt -> host: +BROWSTAT=3

host -> bt: AT+SETMP=1 (select player)
bt -> host: +BROWSTAT=4
bt -> host: +BROWDATA=R,iPhone (filesystem root:iPhone)
bt -> host: +BROWDATA=E,0
bt -> host: +BROWSTAT=3

host -> bt: AT+GETFD=1,5 (list folders under root dir)
bt -> host: +BROWSTAT=4
bt -> host: +BROWDATA=F,0100000000000000,music (/iPhone/music)
bt -> host: +BROWDATA=F,0200000000000000,playlist (/iPhone/playlist)
bt -> host: +BROWDATA=E,0
bt -> host: +BROWSTAT=3

host -> bt: AT+SETFD=0200000000000000 (list folders under playlist)
bt -> host: +BROWSTAT=4
bt -> host: +BROWDATA=E,0
bt -> host: +BROWSTAT=3

host -> bt: AT+GETFD=1,5
bt -> host: +BROWSTAT=4
bt -> host: +BROWDATA=F,0100000000000000,Recently added
bt -> host: +BROWDATA=F,524A57F5E4594DE6,Play history
bt -> host: +BROWDATA=E,0
bt -> host: +BROWSTAT=3

bt <--> host: (continue list sub dir until find audio tracks:AT+SETFD=folder id,AT+GETFD=x,y)
bt -> host: +BROWDATA=M,285E9813C3AB900E,New Soul
bt -> host: +BROWDATA=F,C15E9813C3AB900E,BLUE
bt -> host: +BROWDATA=E,0
bt -> host: +BROWSTAT=3

host -> bt: AT+ADDMP=C15E9813C3AB900E (select audio track and add to media player)
bt -> host: OK
bt --> host: media player playing BLUE now

@enduml

AVRCP album image download

Note

Album image downloading is only supported by the vehicle protocol stack module, BT631D module does not support.

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: A2DP/AVRCP connected

bt -> host: ...
bt -> host: +AVRCPSTAT=3

rnote over host, bt: Download album image
bt -> host: +BIPSTAT=3 (basic image profile connected)
bt <--> host: music start streaming
bt -> host: +TRACKINFO=song,artist,album
bt -> host: +BIPSTAT=4 (blueware auto pulling coverart jpeg image background)
bt -> host: +COVERART=1000090 (download complete)
bt -> host: +BIPSTAT=3

@enduml

Phonebook/Contact photo download

Note

Contact photo Only supported by vehicle protocol stack module, not supported by BT631D module

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: HFP connected

bt -> host: ...
bt -> host: +HFPSTAT=3

rnote over host, bt: download all phonebook
host -> bt: AT+PBDOWN=1
bt -> host: +PBSTAT=2
bt -> host: +PBSTAT=3 (PBAP connected)
bt -> host: +PBSTAT=4 (PBAP is downloading)
bt -> host: +PBDATA=1,Local number,+8618620277272
bt -> host: +PBDATA=1,zhang,0571-85592192
bt -> host: ...
bt -> host: +PBDATA=1,jerry,18909731215
bt -> host: +PBDATA=E (Download completed)
bt -> host: +PBSTAT=3

rnote over host, bt: Download all phonebooks and request avatars
host -> bt: AT+PBDOWN=1,,,1
bt <--> host: (if item's photo flag set,photo image number.jpg should be placed in spcecify folder)
bt -> host: +PBDATA=1,Local number,+8618620277272,1
bt -> host: +PBDATA=1,zhang,0571-85592192
bt -> host: +PBDATA=1,jerry,18909731215,1
bt -> host: +PBDATA=E
bt -> host: +PBSTAT=3

rnote over host, bt: download 50 contacts in recent call history
host -> bt: AT+PBWODN=5,50
bt -> host: +PBDATA=3,yidong,+10086,20200213T114247
bt -> host: ...
bt -> host: +PBDATA=2,andy,85592192,20200212T104202
bt -> host: +PBDATA=E
bt -> host: +PBSTAT=3

@enduml

Appendix

Download PDF Document

Download PDF Document