Development Examples

[中文版]

Profile Initialization

Module Profile initialization, response event examples are as follows:

@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: +PWRSTAT=1
bt -> host: +SPPSTAT=1
bt -> host: +GATTSTAT=1
bt -> host: +VER=BT1036,V2.8.7,20250306
bt -> host: +PROFILE=339
bt -> host: +A2DPSTAT=1
bt -> host: +AVRCPSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +DEVSTAT=1
bt -> host: +DEVSTAT=7

@enduml

Parameter Modification

Modify Bluetooth Name

@startuml
hide footbox
skinparam sequenceMessageAlign center

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

rnote over host, bt: Change Bluetooth name
host -> bt: AT+NAME
bt -> host: AT+NAME=FSC-BT1036-188A
bt -> host: OK
host -> bt: AT+NAME=CARKIT,0
bt -> host: OK
host -> bt: AT+NAME
bt -> host: +NAME=CARKIT

@enduml

Before the MCU modifies any parameters, it is recommended to first query, then modify, and finally verify. For the MCU to modify the device name to CARKIT, the reference code example is as follows:

void change_name(void)
{

    uart_send("AT+NAME\r\n");
    if(uart_read("+NAME",name_buf))
    {
        if(memcmp(name_buf,"CARKIT",6))
        {
            uart_send("AT+NAME=CARKIT,0\r\n");  //defalut disable MAC address suffix
            uart_send("AT+NAME\r\n"); // read bt name
            if(uart_read("+NAME",name_buf))
            {
                if(memcmp(name_buf,"CARKIT",6))
                {
                    //change name fail
                }
                else
                {
                    //change name success
                }
            }
        }
    }
}

Auido Sink Mode Application

Application Scenarios

../_images/db200-bt1036-audio-rx-200dpi.png

Application Examples

Note

If the factory firmware of the module is transceiver-in-one program, the default +PROFILE=339. You need to send the AT command AT+PROFILE=1195 to configure it to audio sink mode (enabling SPP, GATT Server, HFP Sink, A2DP Sink, AVRCP-Controller, and PBAP).

Profile connect, take and Hang up Call

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

rnote over host, bt: Mobile phone scan and connect to Module
bt -> host: +PAIRREQ=797353,5C873026D673,Yui
bt -> host: +PAIRED=0,5C873026D673,Yui
bt -> host: +AVRCPSTAT=3
bt -> host: +A2DPSTAT=2
bt -> host: +HFPIBR=1
bt -> host: +A2DPSTAT=3 (A2DP connected)
bt -> host: +A2DPDEV=5C873026D673,Yui
bt -> host: +DEVSTAT=1
bt -> host: +HFPSTAT=3 (HFP connected)
bt -> host: +HFPDEV=5C873026D673,Yui
bt -> host: +HFPSIG=5
bt -> host: +HFPBATT=4
bt -> host: +HFPROAM=1
bt -> host: +HFPNUM=86188xxxx9792
bt -> host: +HFPMANU=AppleInc.

host -> bt: AT+HFPDIAL=10086 (take call 10086)
bt -> host: OK
bt -> host: +HFPSTAT=4 (Calling...)
bt -> host: +HFPSTAT=4,10086,China Mobile
bt -> host: +HFPAUDIO=1 (HFP link has been established)
bt -> host: +HFPSR=16000
bt -> host: +HFPSTAT=6 (Active call)
bt -> host: +HFPSTAT=6,10086,China Mobile

host -> bt: AT+HFPCHUP (Hang up)
bt -> host: OK
bt -> host: +HFPAUDIO=0 (HFP audio link has been disconnected)
bt -> host: +HFPSTAT=3

Music Play, Stop, and Track Switching

@startuml
hide footbox
skinparam sequenceMessageAlign center

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

rnote over host, bt: Phone start playing music.
bt -> host: +A2DPSTAT=5
bt -> host: +PLAYSTAT=1
bt -> host: +TRACKINFO=Paris,Caro Emerald,The Shocking Miss Emerald
bt -> host: +TRACKSTAT=1,9,287
bt -> host: +TRACKSTAT=1,10,287
bt -> host: +TRACKSTAT=1,11,287
bt -> host: +TRACKINFO=I live deep in symmetry,Paris — Caro Emerald,The Shocking Miss Emerald
bt -> host: +TRACKSTAT=1,16,287
bt -> host: +TRACKSTAT=1,17,287
bt -> host: +TRACKSTAT=1,18,287

host -> bt: AT+PAUSE (Pause music)
bt -> host: OK
bt -> host: +PLAYSTAT=2
bt -> host: +A2DPSTAT=4

host -> bt: AT+PLAY(Play music)
bt -> host: OK
bt -> host: +A2DPSTAT=5
bt -> host: +PLAYSTAT=1
bt -> host: +TRACKINFO=Paris,Caro Emerald,The Shocking Miss Emerald
bt -> host: +TRACKSTAT=1,28,287
bt -> host: +TRACKSTAT=1,29,287
bt -> host: +TRACKSTAT=1,30,287
bt -> host: +TRACKINFO=In this room of disconnect,Paris — Caro Emerald,The Shocking Miss Emerald
bt -> host: +TRACKSTAT=1,31,287
bt -> host: +TRACKSTAT=1,33,287

host -> bt: AT+FORWARD (Switch to the next song)
bt -> host: OK
bt -> host: +TRACKSTAT=1,0,187
bt -> host: +TRACKINFO=Ocean and Dreams,Aria Flux,Ocean and Dreams
bt -> host: +TRACKSTAT=1,0,187
bt -> host: +TRACKINFO=Ocean and Dreams - Aria Flux,Ocean and Dreams — Aria Flux,Ocean and Dreams
bt -> host: +TRACKSTAT=1,2,187

host -> bt: AT+BACKWARD (Switch to the previous song)
bt -> host: OK
bt -> host: +TRACKSTAT=1,0,195
bt -> host: +TRACKINFO=Tangled Up,Caro Emerald,The Shocking Miss Emerald
bt -> host: +TRACKSTAT=1,1,195
bt -> host: +TRACKSTAT=1,2,195
bt -> host: +TRACKSTAT=1,3,195

host -> bt: AT+STOP (Stop music)
bt -> host: OK
bt -> host: +PLAYSTAT=2
bt -> host: +A2DPSTAT=4

@enduml

Source Mode Application

Application Scenarios

../_images/db200-bt1036-audio-tx-200dpi.png

Application Examples

Note

The default profile for FSC-BT1036C is 339, which enables both the classic Bluetooth audio transmission function and SPP, GATT_Server.

The module is set to analog input by default. If you need to use I2S input, please refer to the instruction AT+I2SCFG. After configuring I2S, you need to restart the device for the settings to take effect.

@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: search nearby devices and connect to airpods
host -> bt: AT+SCAN=1
bt -> host: +DEVSTAT=1
bt -> host: +DEVSTAT=9
bt -> host: +SCAN=1,-87,0,DC0D30001E49,FSC-BT1036-1E49,5A020C
bt -> host: +SCAN=2,-78,0,A0A3091593E7,AirPods Pro - Find My,240418
bt -> host: ...
bt -> host: +SCAN=E
bt -> host: << +DEVSTAT=1
bt -> host: << +DEVSTAT=1

host -> bt: AT+A2DPCONN=A0A3091593E7
bt -> host: OK
bt -> host: +A2DPSTAT=2
bt -> host: +PAIRREQ=838273,A0A3091593E7,AirPods Pro - Find My
bt -> host: +PAIRED=0,A0A3091593E7,AirPods Pro - Find My
bt -> host: +A2DPSTAT=3
bt -> host: +A2DPDEV=A0A3091593E7,AirPods Pro - Find My
bt -> host: +DEVSTAT=1
bt -> host: +HFPSTAT=2
bt -> host: +HFPSTAT=3 (HFP connected)
bt -> host: +HFPDEV=A0A3091593E7,AirPods Pro - Find My
bt -> host: +HFPVGS=11
bt -> host: +AVRCPSTAT=3(AVRCP connected)
bt -> host: +PLAYSTAT=2

rnote over host, bt: Established A2dp audio
host -> bt: AT+AUDROUTE=1
bt -> host: +AUDROUTE=1
bt -> host: OK
bt -> host: +PLAYSTAT=1
bt -> host: +A2DPSTAT=5
bt -> host: +AUDMODE=1

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

rnote over host, bt: Established HFP audio
host -> bt: AT+AUDROUTE=2
bt -> host: +AUDROUTE=2
bt -> host: OK
bt -> host: +HFPSR=16000
bt -> host: +HFPAUDIO=1 (audio established)
bt -> host: +HFPAUDIO=1
bt -> host: +AUDMODE=2
bt -> host: +HFPSTAT=6

rnote over host, bt: Release HFP audio
host -> bt: AT+AUDROUTE=0
bt -> host: +AUDROUTE=0
bt -> host: OK
bt -> host: +HFPAUDIO=0
bt -> host: +HFPSTAT=3
bt -> host: +AUDMODE=0

@enduml

Phonebook Download

Note

For some firmware versions of SOC audio modules, automatic connection to PBAP (Phone Book Access Profile) is not supported when downloading contacts. You need to first send the AT command AT+PBCONN to establish a PBAP connection before proceeding with the download.

@startuml
hide footbox
skinparam sequenceMessageAlign center

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

rnote over host, bt: Set Profile
host -> bt: AT+PROFILE=1195
bt -> host: OK
bt -> host: +HFPSTAT=1
bt -> host: +DEVSTAT=0
bt -> host: +PWRSTAT=0
bt -> host: ...
bt -> host: +PBSTAT=1
bt -> host: +DEVSTAT=3

rnote over host, bt: HFP connected
bt -> host: ...
bt -> host: +HFPSTAT=3

rnote over host, bt: PBAP connect
host -> bt: AT+PBCONN=5C873026D673
bt -> host: +PBSTAT=2
bt -> host: OK
bt -> host: +PBSTAT=3 (PBAP connected)

rnote over host, bt: Download all phonebook
host -> bt: AT+PBDOWN=1
bt -> host: +PBSTAT=4 (PBAP downloading)
bt -> host: OK
bt -> host: +PBSTAT=3 (PBAP connected)
bt -> host: +PBCNT=33
bt -> host: +PBDATA=1,Local number,+86186xxxx7272
bt -> host: +PBDATA=1,Tom,0571-85592192
bt -> host: ...
bt -> host: +PBDATA=1,jerry,189xxxx1215
bt -> host: +PBDATA=E (Download compete)
bt -> host: +PBSTAT=3

rnote over host, bt: Download 50 call records
host -> bt: AT+PBWODN=5,50
bt -> host: +PBSTAT=4
bt -> host: OK
bt -> host: +PBDATA=3,yidong,+10086,20200213T114247
bt -> host: ...
bt -> host: +PBDATA=2,andy,85592192,20200212T104202
bt -> host: +PBDATA=E (Download completed)
bt -> host: +PBSTAT=3

@enduml