FSC-BT6038A programming user guide

Introduction

Release note

Index

Version

Date

Description

1
V1.0.0
2024/05/23
First edition
2
V1.0.1
2024/07/09
Add le audio description
Add GATT description
Fix known issues
3
V1.0.2
2025/01/07
Fix known issues
Add some command and event descriptions

Description

This design guide is suitable for engineers to develop FSC-BT6038A series bluetooth modules

Module default settings

BR/EDR Name

FSC-BT6038A

BLE Name

FSC-BT6038A-LE

UART configuration

115200/8/N/1

Hardware description

Pin diagram

FSC-BT6038A as an example:

_images/BT6038A_pin_map.png

Pin description

Pin

Name

Type

Descriptions

1
SYS_CTRL
I
Typically connected to an ON/OFF push button
Also usable as a digital input in normal operation
2
MIC_LP
A
Microphone differential 1 input, positive
Differential audio line input 1, positive
3
MIC_LN
A
Microphone differential 1 input, negative
Differential audio line input 1, negative
4
MIC_RN
A
Microphone differential 2 input, negative
Differential audio line input 2, negative
5
MIC_RP
A
Microphone differential 2 input, positive
Differential audio line input 2, positive
6
MIC_BIAS
A
Mic bias output
7
NC
N
Not connect
8
NC
N
Not connect
9
VDD_IO
P
I/O port supply
10
PIN34
I2C_SDA
I/O
Programmable I/O
Alternative funciton I2C_SDA
11
PIN35
I2S_SCL
I/O
Programmable I/O
Alternative funciton I2C_SCL
12
NC
N
Not connect
13
NC
N
Not connect
14
PIO18
I2S_DOUT
I/O
Programmable I/O
Alternative funciton I2S_DOUT
15
PIO16
I2S_BCLK
I/O
Programmable I/O
Alternative funciton I2S_BCLK
16
PIO19
I2S_DIN
I/O
Programmable I/O
Alternative funciton I2S_DIN
17
PIO17
I2S_WS
I/O
Programmable I/O
Alternative funciton I2S_WS
18
PIO15
I2S_MCLK
I/O
Programmable I/O
Alternative funciton I2S_MCLK
19
VDD
P
Power supply
20
GND
P
Power ground
21
AIO0
I/O
General-purpose analog/digital input or OD LED output
22
AIO1
I/O
General-purpose analog/digital input or OD LED output
23
RESET
I
External reset input
24
VBUS
P
USB power
25
GND
P
Power ground
26
USB_DP
I/O
USB data positive
27
USB_DN
I/O
USB data negative
28
PIN7
TRBI_MISO
I/O
Programmable I/O
TRBI_MISO
29
PIN6
TRBI_MOSI
I/O
Programmable I/O
TRBI_MOSI
30
PIN8
TRBI_CLK
I/O
Programmable I/O
TRBI_CLK
31
PIO5
UART_TX
I/O
Programmable I/O
Alternative funciton UART_TX
32
PIO4
UART_RX
I/O
Programmable I/O
Alternative funciton UART_RX
33
PIO3
UART_CTS
SPDIF_IN
I/O
Programmable I/O
Alternative funciton UART_CTS
SPDIF_IN
34
GND
P
Power ground
35
EXT_ANT
A
Antenna
36
GND
P
Power ground

Hardware design notes

  • The simple test of the module only needs to connect VDD/VDD_IO/VBUS/GND/UART_RX/UART_TX to use

  • After drawing, please send it to feasy.com for review so as not to have the best bluetooth distance

Function description

Profiles

  • SPP (Serial Port Profile)

  • GATTS (Generic Attribute Profile LE-Peripheral)

  • GATTC (Generic Attribute Profile LE-Central)

  • 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)

  • LEA (Le Audio 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 “ERROR” for failure

Example: Get module’s BR/EDR name
<< AT+NAME
>> +NAME=FSC-BT6038A
>> OK
Example: Pick up an incoming call when no call incoming actually
<< AT+HFPANSW
>> ERROR

Event format

<CR><LF>+Event{=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 ‘,’

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

Commands table

General commands

AT+HELP - List firmware information and all support command

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>

AT+VER - Get firmware version information

Command

AT+VER

Response

+VER=Param1,Param2,Param3

Description

+VER - Frmware version information

AT+BAUD - Get/Set uart baudrate

Command

AT+BAUD{=Param}

Param
9600/ 19200/ 38400/ 57600/ 115200/ 230400/ 460800
500000/ 921600/ 1000000/ 1382400/ 1500000/ 2000000

Response

+BAUD=Param

Param

Current baudrate

Description

It takes effect immediately and does not need to be restarted

AT+I2SCFG - Get/Set I2S configuration

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: 48000Hz
1: 44100Hz
BIT[3]
0: left justified
1: right justified
BIT[4]
0: data 1 bit delay
1: data no delay
BIT[5:6]
00: bit depth=16bits
01: bit depth=24bits
10: bit depth=32bits

Response

+I2SCFG=Param

Param

Current I2S configuration

Description

It takes effect after the restart

AT+MICGAIN - Get/Set input gain

Command

AT+MICGAIN{=Param}

Param
0 ~ 10: Set target value
+: Increase
-: Decrease

Response

+MICGAIN=Param

Param

Current input gain

Description
In usb input mode, the parameter only be +/-, and get the parameter is invalid
In I2S/SPDIF input mode, the command is invalid

AT+REBOOT - Soft reboot

Command

AT+REBOOT

Description

Module will disconnect all profiles then reboot

AT+RESTORE - Restore factory settings

Command

AT+RESTORE

Description

Module restore all factory settings then reboot

AT+BTEN - Get/Set bluetooth state

Command

AT+BTEN{=Param}

Param
0: Disable
1: Enable

Response

+BTEN=Param

Param

Current bluetooth state

AT+LECFG - Get/Set random BLE address state

Command

AT+LECFG{=Param}

Param
0: Disable
1: Enable

Response

+LECFG=Param

Param

Current state

AT+PROFILE - Get/Set bluetooth profile

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

LE Audio (LE Audio Profile)

Response

+PROFILE=Param

Param

Current profile selection

Description
If modify profile, the module will reboot
BT6038A only support SPP, HFP-AG, A2DP Source, AVRCP Target, LEA, GATT Server
LEA, GATT Server cannot be uesd together

AT+AUTOCONN - Get/Set poweron auto reconnect

Command

AT+AUTOCONN{=Param}

Param
0: Disable
1 ~ 15: Reconnect times

Response

+AUTOCONN=Param

Param

Current auto reconnect configuration

Description

In Le Audio, the setting will be invalidated

AT+STAT - Get all state

Command

AT+STAT

Response

+STAT=Param1,Param2,Param3,Param4,Param5,Param6,Param7

Param1

+DEVSTAT - Device state

Param2

+SPPSTAT - SPP state

Param3

+GATTSTAT - GATT state

Param4

+HFPSTAT - HFP state

Param5

+A2DPSTAT - A2DP state

Param6

+AVRCPSTAT - AVRCP state

Param7

+LEASTAT - LE Audio state

AT+DEVSTAT - Get device state

Command

AT+DEVSTAT

Response

+DEVSTAT=Param

Param

+DEVSTAT - Device state

AT+ADDR - Get BR/EDR MAC address

Command

AT+ADDR

Response

+ADDR=Param

Param

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

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 name

Command

AT+NAME{=Param1{,Param2}}

Param1

BR/EDR name

Param2
0: Disable suffix
1: Enable suffix“XXXX”(lower 4 bytes of MAC address) after name

Response

+NAME=Param

Param

BR/EDR name

Description

The name contains a maximum of 31 bytes

AT+LENAME - Get/Set BLE name

Command

AT+LENAME{=Param1{,Param2}}

Param1

BLE name

Param2
0: Disable suffix
1: Enable suffix“XXXX”(lower 4 bytes of MAC address) after name

Response

+LENAME=Param

Param

BLE name

Description

The name contains a maximum of 31 bytes

AT+ADVDATA - Get/Set BLE advertising data

Command

AT+ADVDATA{=Param}

Param

advertising data

Response

+ADVDATA=Param

Param

advertising data

Description
This parameter must be a hexadecimal string
Must br an even length and a maximum of 62 bytes hexadecimal string

AT+COD - Get/Set class of device

Command

AT+COD=Param

Param

Class of device(6 bytes ASCII)

Response

+COD=Param

Param

Current class of device

Description

Class of device reference COD

AT+PAIR - Get/Set BR/EDR visibility

Command

AT+PAIR=Param

Param
0: Exit BR/EDR discoverable mode
1: Enter BR/EDR discoverable mode

Response

+PAIR=Param

Param

Current BR/EDR visibility

AT+SCAN - Scan nearby devices

Command

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

Param1
0: Stop scan
1: Scan nearby BR/EDR devices
2: Scan nearby BLE devices

Param2

Scan time less than 255 (Unit: s)

Param3
0: BLE report like BR/EDR
1: BLE report advertising data
2: Only report support le audio device

Description

+SCAN - Scan result

AT+PLIST - Get/Delete paired list

Command

AT+PLIST{=Param}

Param
0: Clear all paired record
1 ~ 8: Clear specific paired record with index
MAC(12 bytes ASCII): Clear specific paired record with MAC address

Response1

+PLIST=Param1, Param2{,Param3}

Param1

Paired device’s index

Param2

Paired device’s MAC address

Param3

Paired device’s name(UTF8)

Response2

+PLIST=E

Description

If parameter not exist then list all paired devices

AT+DSCA - Release all connections

Command

AT+DSCA

Description
This command only initiates a disconnect request
The actual status depends on the query

AT+TPMODE - Get/Set throughput mode

Command

AT+TPMODE{=Param}

Param
0: Disable
1: Enable

Response

+TPMODE=Param

Param

Current throughput mode

Description
When SPP/GATT profile connected and throughput mode is on
The command will be de-active, every byte received via physical UART will be sent to air

AT+AUXCFG - Get/Set audio input mode

Command

AT+AUXCFG{=Param}

Param
0: USB
1: Analog
2: SPDIF
3: I2S

Response

+AUXCFG=Param

Param

Current audio input mode

Description
It takes effect after the restart
In le audio only support usb and analog

AT+RSSI - Get remote device rssi

Command

AT+RSSI=Param

Param

MAC address of target device(12 bytes ASCII)

Response

+RSSI=Param1,Param2

Param1

MAC address of target device(12 bytes ASCII)

Param2

Target device’s RSSI

Description

If 0 is returned, the acquisition failed

AT+LINKCFG - Get/Set auto scan and connect

Command

AT+LINKCFG{=Param1{,Param2}}

Param1
0: Disable
1: Enable
Param2
0: Scan all devices
1: Only scan major service class is rendering or audio

AT+AUDMODE - Get/Set audio mode

Command

AT+AUDMODE{=Param1}

Param1
0: BR/EDR mode
1: LE audio broadcast mode
2: LE audio unicast mode

Description

Change this setting module will reboot

AT+PRINT - Get/Set report mode

Command

AT+PRINT{=Param1}

Param1
0: Disable
1: Enable

Description

On/Off module actively report a message

HFP commands

AT+HFPSTAT - Get HFP state

Command

AT+HFPSTAT

Response

+HFPSTAT=Param

Param

+HFPSTAT - HFP state

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

AT+HFPDISC - Release HFP connection

Command

AT+HFPDISC

Description
This command only initiates a disconnect request
The actual status depends on the query

AT+HFPRING - Simulate incoming call

Command

AT+HFPRING{=Param}

Param

Phone number(ASCII)

Description
The phone number contains a maximum of 15 bytes
Dial specific number if parameter exist, otherwise redial

AT+HFPANSW - Pick up incoming call

Command

AT+HFPANSW

AT+HFPCHUP - Reject/Hung up call

Command

AT+HFPCHUP

AT+HFPAUDIO - Establish/Release voice audio

Command

AT+HFPAUDIO=Param

Param
0: Release voice audio connection with remote hfp sink device
1: Establish voice audio connection with remote hfp sink device

AT+HFPWBS - Get/Set hfp codec negotiation

Command

AT+HFPWBS{=Param}

Param
0: Disable hfp codec negotiation
1: Enable hfp codec negotiation

Response

+HFPWBS=Param

Param

Current state

AT+HFPNREC - Get/Set hfp cvc

Command

AT+HFPNREC{=Param}

Param
0: Disable hfp cvc
1: Enable hfp cvc

Response

+HFPNREC=Param

Param

Current state

A2DP/AVRCP commands

AT+A2DPSTAT - Get A2DP state

Command

AT+A2DPSTAT

Response

+A2DPSTAT=Param

Param

+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
This command only initiates a disconnect request
The actual status depends on the query

AT+A2DPCFG - Get/Set A2DP configuration

Command

AT+A2DPCFG{=Param}

Param

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

BIT[0]
0: Disable AAC
1: Enable AAC
BIT[1]
0: Disable APTX
1: Enable APTX
BIT[2]
0: Disable APTX-LL
1: Enable APTX-LL
BIT[3]
0: Disable APTX-HD
1: Enable APTX-HD
BIT[4]
0: Disable APTX-AD
1: Enable APTX-AD
BIT[5]
0: Disable LDAC
1: Enable LDAC

Response

Current A2DP configuration

Description

BT6038A only support APTX, APTX-AD, APTX-HD

AT+A2DPENC - Get A2DP encoder

Command

AT+A2DPENC

Response

+A2DPENC=Param

Param

+A2DPENC - A2DP encoder

AT+A2DPAUDIO - Establish/Release A2DP audio connection

Command

AT+A2DPAUDIO=Param

Param
0: Release A2DP audio connection with remote a2dp sink device
1: Establish A2DP audio connection with remote a2dp sink device

AT+AVRCPSTAT - Get AVRCP state

Command

AT+AVRCPSTAT

Response

+AVRCPSTAT=Param

Param

+AVRCPSTAT - AVRCP state

AT+AVRCPCONN - Establish AVRCP connection

Command

AT+AVRCPCONN{=Param}

Param

MAC address of target device(12 bytes ASCII)

Description

Reconnect to last device if parameter not exist

AT+AVRCPDISC - Release AVRCP connection

Command

AT+AVRCPDISC

Description
This command only initiates a disconnect request
The actual status depends on the query

AT+AVRCPSPKVOL - Get/Set remote volume

Command

AT+AVRCPSPKVOL{=Param}

Param

Volume value(0 - 15)

Description
Set remote volume
The command must be sent after AVRCP connection is established
And the remote device must support volume control

GATT commands

AT+GATTSTAT - Get GATT state

Command

AT+GATTSTAT

Response

+GATTSTAT=Param

Param

+GATTSTAT - GATT state

AT+GATTSEND - Send data via GATT

Command

AT+GATTSEND=Param1,Param2

Param1

Payload length(1 ~ 236)

Param2

Payload(1~236 bytes)

Description

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

SPP commands

AT+SPPSTAT - Get SPP state

Command

AT+SPPSTAT

Response

+SPPSTAT=Param

Param

+SPPSTAT - SPP state

AT+SPPDISC - Release SPP connection

Command

AT+SPPDISC

Description
This command only initiates a disconnect request
The actual status depends on the query

AT+SPPSEND - Send data via SPP

Command

AT+SPPSEND=Param1,Param2

Param1

Payload length(1 ~ 236)

Param2

Payload(1~236 bytes)

Description

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

LE Audio commands

AT+LEASTAT - Get Le Audio state

Command

AT+LEASTAT

Response

+LEASTAT=Param

Param

+LEASTAT - LE Audio state

AT+LEADISC - Release Le Audio connection

Command

AT+LEADISC

Description
This command only initiates a disconnect request
The actual status depends on the query
Only In le audio unicast mode support

AT+LEACONN - Establish le audio connection

Command

AT+LEACONN=Param1

Param1

MAC address of target device(12 bytes ASCII)

Description

Only In le audio unicast mode support

Events table

General events

+VER - Frmware version information

Event

+VER=Param1,Param2,Param3

Param1

Module type

Param2

Firmware version

Param3

Firmware compile time

+DEVSTAT - Device state

Event

+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

+SCAN - Scan result

Event1

+SCAN =Param1,Param2,Param3, Param4,Param5{,Param6{,Param7}}

Param1

Index

Param2
0: LE public address
1: LE random address
2: BR/EDR address

Param3

MAC address(12 bytes ASCII)

Param4

RSSI(-127 ~ -1)

Param5

Size of Param6 if exist

Param6

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

Param7

Class of device

Event2

+SCAN=E

Description

Scan finsh

+PAIRED - Pair result

Event

+PAIRED=Param

Param

MAC address(12 bytes ASCII) of current pairing device

+I2SSR - I2S sample rate

Event

+I2SSR=Param

Param

I2S sample rate

HFP events

+HFPSTAT - HFP state

Event

+HFPSTAT=Param

Param1
0: Unsupported
1: Standby
2: Connecting
3: Connected
4: Outgoing call
5: Incoming call
6: Active call

+HFPDEV - HFP remote device information

Event

+HFPDEV=Param1{,Param2}

Param1

Remote MAC address(12 bytes ASCII) of current HFP connection

Param2

Remote device name(UTF8) of current HFP connection

+HFPCONN - HFP connecting

Event

+HFCONN=Param

Param

Remote MAC address(12 bytes ASCII) of current HFP connecting

+HFPAUDIO - HFP voice audio State

Event

+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

+HFPCID - HFP call phone number

Event

+HFPCID=Param

Param

Phone number(ASCII)

+HFPSR - HFP sample rate

Event

+HFPSR=Param

Param

Sample rate

+HFPHUNG - HFP remote device reject an incoming call or end an ongoing call

Event

+HFPHUNG

+HFPVGS - HFP remote device spker gian

Event

+HFPVGS=Param

Param

Remote device spker gain

+HFPVGM - HFP remote device microphone gian

Event

+HFPVGM=Param

Param

Remote device microphone gain

A2DP/AVRCP events

+A2DPSTAT - A2DP state

Event

+A2DPSTAT=Param

Param
0: Unsupported
1: Standby
2: Connecting
3: Connected
4: Streaming
5: Paused

+A2DPENC - A2DP encoder

Event

+A2DPENC=Param

Param
1:SBC
2:APTX
3:APTX-HD
4:APTX-AD

+A2DPDEV - A2DP remote device information

Event

+A2DPDEV=Param1{,Param2}

Param1

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

Param2

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

+A2DPCONN - A2DP connecting

Event

+A2DPCONN=Param

Param

Remote MAC address(12 bytes ASCII) of current A2DP connecting

+A2DPSR - A2DP codec sample rate

Event

+A2DPSR=Param

Param

A2DP codec sample rate

+AVRCPSTAT - AVRCP state

Event

+AVRCPSTAT=Param

Param
0: Unsupported
1: Standby
2: Connecting
3: Connected

+AVRCPCONN - AVRCP connecting

Event

+AVRCPCONN=Param

Param

Remote MAC address(12 bytes ASCII) of current AVRCP connecting

+SPKVOL - Remote spker volume change

Event

+SPKVOL=Param

Param

Remote spker volume

+CTVOLUP - volume up

Event

+CTVOLUP

Description

Receive volume up command

+CTVOLDN - volume down

Event

+CTVOLDN

Description

Receive volume down command

+CTPLAY - Track play

Event

+CTPLAY

Description

Receive play command

+CTPAUSE - Track pause

Event

+CTPAUSE

Description

Receive pause command

+CTSTOP - Track stop

Event

+CTSTOP

Description

Receive stop command

+CTFWD - Track forward

Event

+CTFWD

Description

Receive forward command

+CTBACK - Track backward

Event

+CTBACK

Description

Receive backward command

LE Audio events

+LEASTAT - LE Audio state

Format

+LEASTAT=Param

Param
0: Unsupported
1: Standby
2: Connecting
3: Connected
4: Streaming
5: Pause

+LEASR - LE Audio sample rate

Format

+LEASR=Param

Param

Sample rate

GATT events

+GATTSTAT - GATT state

Format

+GATTSTAT=Param

Param
0: Unsupported
1: Standby
2: Connecting
3: Connected

+GATTDATA - GATT received incoming data

Format

+GATTDATA=Param1,Param2

Param1

Payload length

Param2

Payload

SPP 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

+SPPDEV - SPP remote device information

Event

+SPPDEV=Param1

Param1

Remote device’s MAC address(12 bytes ASCII) of current SPP connection

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 initialization
bt -> host: +SPPSTAT=1
bt -> host: +GATTSTAT=1
bt -> host: +A2DPSTAT=1
bt -> host: +AVRCPSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +VER=FSC-BT6038A,V1.0.1,20240524
bt -> host: +DEVSTAT=1

rnote over host, bt: send AT+PAIR=1, enter discoverable
host -> bt: AT+PAIR=1
bt -> host: +DEVSTAT=7 (enter discoverable,phone can find and spp/gatt connect to us)

rnote over host, bt: change name to "CARKIT",disable suffix. and verify readback
host -> bt: AT+NAME
bt -> host: AT+NAME=FSC-BT6038A
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}

Note

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

Source mode connection

@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: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: scan nearby devices
host -> bt: AT+SCAN=1
bt -> host: +SCAN=1,2,DC0D30000057,-42,11,FSC-BT1026C,240408
bt -> host: +SCAN=2,2,DC0D30000012,-70,16,FSC-BT1006A-0012,240404
bt -> host: +SCAN=E

host -> bt: AT+A2DPCONN=DC0D30000057 (connect FSC-BT1026C)
bt -> host: OK
bt -> host: +A2DPSTAT=2
bt -> host: +A2DPSTAT=3 (A2DP connected)
bt -> host: +A2DPDEV=DC0D30000057,FSC-BT1026C
bt -> host: +HFPSTAT=3 (HFP connected)
bt -> host: +AVRCPSTAT=3 (AVRCP connected)
bt -> host: +A2DPENC=1 (sbc encoder)
bt -> host: +A2DPSTAT=4 (auto enter A2DP Streaming)

rnote over host, bt: stop Streaming
host -> bt: AT+A2DPAUDIO=0
bt -> host: +A2DPSTAT=5 (A2DP pause)

rnote over host, bt: Establish hfp audio
host -> bt: AT+HFPAUDIO=1
bt -> host: +HFPSTAT=4
bt -> host: +HFPAUDIO=1
bt -> host: +HFPSTAT=6
bt -> host: +HFPSR=16000 (Sample rate : 16000)

rnote over host, bt: Release hfp audio
host -> bt: AT+HFPAUDIO=0
bt -> host: +HFPSTAT=3
bt -> host: +HFPAUDIO=0

@enduml

Le Audio broadcast mode

@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: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: change profile
host -> bt: AT+PROFILE=2385
bt -> host: OK
bt -> host: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: change Audio mode
host -> bt: AT+AUDMODE=1
bt -> host: OK
bt -> host: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1
bt -> host: +LEASTAT=4 (auto enter Le Aduio Streaming)
bt -> host: +LEASR=48000 (Sample rate : 48000)

@enduml

Note

Now scan broadcast data using other sink devices that support le audio

Le Audio unicast mode

@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: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: change profile
host -> bt: AT+PROFILE=2385
bt -> host: OK
bt -> host: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: change Audio mode
host -> bt: AT+AUDMODE=2
bt -> host: OK
bt -> host: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: scan nearby devices
host -> bt: AT+SCAN=2,10,2 (only scan le audio)
bt -> host: +SCAN=1,0,00025B00FF02,-52,23,FSC-BT1038A-LE-FF02
bt -> host: +SCAN=E
bt -> host: +DEVSTAT=1

host -> bt: AT+LEACONN=00025B00FF02 (connect FSC-BT1038A-LE-FF02)
bt -> host: OK
bt -> host: +LEASTAT=3
bt -> host: +LEASTAT=4 (auto enter Le Audio Streaming)
bt -> host: +LEASR=48000 (Sample rate : 48000)

@enduml

SPP data transfer

@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: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: enter discoverable
host -> bt: AT+PAIR=1
bt -> host: OK
bt -> host: +DEVSTAT=7

rnote over host, bt: phone connect module
bt -> host: +PAIRED=594171484D07
bt -> host: +SPPDEV=594171484D07
bt -> host: +SPPSTAT=3
bt -> host: +DEVSTAT=5

rnote over host, bt: send data to phone
host -> bt: AT+SPPSEND=10,0123456789
bt -> host: OK

rnote over host, bt: received data from phone
bt -> host: +SPPDATA=10,0123456789

rnote over host, bt: disconnect
host -> bt: AT+SPPDISC
bt -> host: OK
bt -> host: +SPPSTAT=1
bt -> host: +DEVSTAT=7

@enduml

Note

SPP connect is not supported iphone

GATT data transfer

@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: +SPPSTAT=1
bt -> host: ...
bt -> host: +DEVSTAT=1

rnote over host, bt: enter discoverable
host -> bt: AT+PAIR=1
bt -> host: OK
bt -> host: +DEVSTAT=7

rnote over host, bt: phone connect module
bt -> host: +GATTSTAT=3
bt -> host: +GATTDEV=594171484D07

rnote over host, bt: send data to phone
host -> bt: AT+GATTSEND=10,0123456789
bt -> host: OK

rnote over host, bt: received data from phone
bt -> host: +GATTDATA=10,0123456789

rnote over host, bt: disconnect
host -> bt: AT+GATTDISC
bt -> host: OK
bt -> host: +GATTSTAT=1

@enduml

Appendix

Download PDF Document

Download PDF Document