Hi,
I have designed an audio system that is using C2000 microcontroller and I2S buses to transfer audio streams between modules. Now I need to add Bluetooth module that has I2S interface and for that I have selected BT controller CC2564B (CC2564MODA).
Because I am already using the C2000 microcontroller I can not use TI Dual-Mode Bluetooth Stack Bluetopia since there is no library binary build for C2000 microcontrollers. So for Bluetooth stack I decided to use open source btstack from bluekitchen github.com/.../btstack. There they have a2dp sink demo example for CC2564B BT controller. I had to make some modifications in the source to compile it for C2000 microcontroller. At the moment this demo is running as expected. I can find BT controller with smartphone, pair phone with BT a2dp sink demo. During music playback the BT controller streams back ACL packages over the HCI interface to host microcontroller as expected.
Since I want to use BT controller I2S/PCM interface I modified the btstack code so that it will send the required vendor specific HCI commands to activate Assisted A2DP Sink (A3DP, SBC decoder, PCM interface).
The btstack init phase is using the TI provided CC256xB BT Service Pack CC256XB_BT_SP_v1.8 (initscripts-TIInit_6.7.16_bt_spec_4.1.bts + initscripts-TIInit_6.7.16_avpr_add-on.bts) init scripts that will activate AVPR as sink.
Then:
1) At the end of init phase the btstack issues a command HCI_VS_Write_SCO_Configuration (0xFE10) with arguments:
Connection type = 0 (Codec) – I assume that then no audio packets are sent over HCI?
TX Buffer Size = 0 (Keep Current Packet Size)
TX buffer max latency = 0 (Keep current max latency)
Accept packet with bad CRC = 1 (Accept packet with bad CRC)
2) HCI_VS_LE_Enable (0xFD5B) 0 – Disable, 0 - Do not load code.
3) When smartphone makes connection after pairing and receives SBC configuration
A2DP Sink : Received SBC codec configuration
- num_channels: 2
- sampling_frequency: 44100
- channel_mode: 3
- block_length: 16
- subbands: 8
- allocation_method: 0
- bitpool_value [2, 53]
then following VS HCI commands are sent:
HCI_VS_A3DP_Sink_Codec_Configuration (0xFD9C)
PCM number of channels = 2
SBC input sample frequency = 2
SBC channel mode = 3
SBC number of blocks = 16
SBC number of sub-bands = 8
SBC allocation method = 0
HCI_VS_Write_CODEC_Config (0xFD06)
Clock rate = 2824
Clock direction = 0
Frame-sync frequency = 44100
Frame-sync duty cycle = 0
Frame-sync edge = 1
Frame-sync polarity = 0
Channel 1 data out size = 16
Channel 1 data out offset = 1
Channel 1 data out edge = 1
Channel 1 data in size = 16
Channel 1 data in offset = 1
Channel 1 data in edge = 0
Fsynch Multiplier = 0
Channel 2 data out size = 16
Channel 2 data out offset = 17
Channel 2 data out edge = 1
Channel 2 data in size = 16
Channel 2 data in offset 17
Channel 2 data in edge = 0
HCI_VS_Write_CODEC_Config_Enhanced (0xFD07)
Clock shutdown = 0
Clock start = 0
Clock stop = 0
Channel 1 data in order = 0
Channel 1 data out order = 1
Channel 1 data out mode = 1
Channel 1 data out duplication = 0
Channel 1 TX_dup_value = 0
Channel 1 data quant = 0
Channel 2 data in order = 0
Channel 2 data out order = 1
Channel 2 data out mode = 1
Channel 2 data out duplication = 0
Channel 2 TX_dup_value = 0
Channel 2 data quant = 0
4) When AVDTP_STREAM_ENDPOINT_OPENED event received then command is sent:
HCI_VS_A3DP_Sink_Open_Stream (0xFD9A)
Connection handle = 1
L2CAP CID = 0x44
values provided by btstack L2CAP module: L2CAP_EVENT_CHANNEL_OPENED status 0x0 addr 10:2F:6B:BD:43:D4 handle 0x1 psm 0x19 local_cid 0x45 remote_cid 0x44 local_mtu 120, remote_mtu 672, flush_timeout 0
5) When audio playback is started then the VS HCI command is sent:
HCI_VS_A3DP_Sink_Start_Stream (0xFD9D)
Then right after that the btstack starts to receive ACL packets from the BT controller over HCI and at the same time there is no activity at PCM interface, no clock or frame synck signals are toggled. It seems that the Assisted A2DP Sink and internal SBC+PCM is not working and the audio data is routed to HCI regardless of HCI_VS_Write_SCO_Configuration config? Or is there some parameter incorrect in VS HCI commands sent?
All the VS commands sent were indicated as Command succeeded at btstack log output.
Similar issue was described also in thread “CC2564B A3DP settings” – but no clear solution was described.
I have attached BT controller TX_Debug log file recorded with TI Israel Logger 5.0 using TIInit_6.7.16.ili file.
In that log file there are some interesting events at following lines:
801
802 A3DP SINK Init
925
975
1414 Pairing completed
1531 L2CAP
1723 ACL: not enough time to schedule: clock 67159
3001 HCIPP_A3DP_SNK_CODEC_CONFIGURATION (Group 3f Opcode 0x19c)
3027 HCIPP_WRITE_CODEC_CONFIG_ISLAND3 (Group 3f Opcode 0x106)
3030 HCIPP_WRITE_CODEC_CONFIG_ENHANCED_ISLAND3 (Group 3f Opcode 0x107)
3239 HCIPP_A3DP_SNK_OPEN_STREAM (Group 3f Opcode 0x19a)
6767 send LMP_ACCEPTED (3), trans_id: master (0)
6832 SBR subrate instant expired start sniff subrate
6956 SBR received data in sniff subrate.listen for 0 slots
6959 hcic_process_hci_commands: HCIPP_A3DP_SNK_START_STREAM (Group 3f Opcode 0x19d)
6964 cdc compensation learning not valid for clock_domain_1
8450 hcic_process_hci_commands: HCIPP_A3DP_SNK_STOP_STREAM (Group 3f Opcode 0x19e)
Might be that the line (6964 cdc compensation learning not valid for clock_domain_1) indicates some problem?
I also attached the btstack text log file that indicates all events and HCI data dumps. It contains log from the moment when host microcontroller initializes CC2564B, smartphone connects and pairs with BT ADP sink, audio playback start and stop, and finally smartphone disconnects.