This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2564MODA: Problem using CC2564B Assisted A2DP Sink

Part Number: CC2564MODA

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.

8551.test_08.txt

8551.test_08.zip

  • Hey Marko,

    I have assigned this thread to one of our SW engineers to help.

  • Hello Marko,

    Thanks for reaching out. I will take a look into these logs. Ill follow up once I have had a chance to go through them.

    Best,

    Rogelio

  • Hi Rogelio, Thank you for the effort, take your time.

  • Additional question: When I want to use Assisted A2DP Sink on CC2564B then should I also explicitly send VC command HCI_VS_Write_SCO_Configuration (0xFE10) with ConnectionType=0 or sending HCI_VS_A3DP_Sink_Codec_Configuration (0xFD9C) will do it automatically – during music play it will route SCO/ACL packets to decoder instead HCI? It is weird that sending HCI_VS_Write_SCO_Configuration (0xFE10) with ConnectionType=0 or 1 doesn’t make any difference, during music play all received SCO/ACL packets are sent to HCI.

  • From the internet I found TI wiki page printout “CC256x Advanced Voice and Audio Features - Texas Instruments Wiki” and there is software flow diagram of A3DP signaling sequence. There the BT controller A3DP initialization was done in different order than in my implementation. So I used the same order - HCI_VS_A3DP_Sink_Open_Stream (0xFD9A) => HCI_VS_Write_CODEC_Config (0xFD06) => HCI_VS_A3DP_Sink_Codec_Configuration (0xFD9C) after btstack at host receives event AVDTP_STREAM_ENDPOINT_OPENED. Sad that the TI wiki pages of CC256x are gone..Still the PCM output didn’t work and ACL packages were sent over HCI during music play. Although something was different this time because BT controller TX_Debug reported loaded decoder configuration:


    SINK: Sampling frequency of the stream = 2
    A3DP SINK: channelMode = 3, The allocation method = 0.
    A3DP SINK: Number of blocks = 16, The number of subbands = 8.
    A3DP SINK: The number of channels = 2

    Then I changed the parameter L2CAP CID value in vs command HCI_VS_A3DP_Sink_Open_Stream (0xFD9A) to the value reported by btstack l2cap_media_cid 0x44 and now during the music play no ACL packages are sent over HCI and with oscilloscope I can see PCM signals toggling with correct Fsynch and data clock frequencies which indicates that BT Assisted A2DP sink seems to work. Also the TX_Debug indicates the A3DP SINK operation:

    34810 18:09:35.359 +1:17:47.844 A3DP: Init. E N J O Y T H E M U S I C
    34811 18:09:35.359 +1:17:47.844 AVPR init completed, version 2.17
    34816 18:09:35.390 +1:17:47.875 A3DP SINK: Init. S I N K O N T H E A I R ! E N J O Y T H E M U S I C
    34817 18:09:35.390 +1:17:47.875 AVPR init completed, version 2.17
    ...
    35335 18:10:00.046 +1:18:12.531 AVPR received a message from ARM [0x0017], number 23
    35352 18:10:00.062 +1:18:12.547 AVPR received a message from ARM [0x0017], number 23
    ... btstack: AVDTP_STREAM_ENDPOINT_OPENED
    36053 18:10:03.296 +1:18:15.781 hcic_process_hci_commands: HCIPP_A3DP_SNK_OPEN_STREAM (Group 3f Opcode 0x19a)
    36054 18:10:03.296 +1:18:15.781 hcic_get_num_of_host_commands. Total free = 3, Reported to host = 1
    36055 18:10:03.296 +1:18:15.781 HCI Send Event: HCI_COMMAND_COMPLETE_EVT
    36056 18:10:03.328 +1:18:15.813 hcic_process_hci_commands: HCIPP_WRITE_CODEC_CONFIG_ISLAND3 (Group 3f Opcode 0x106)
    36057 18:10:03.328 +1:18:15.813 hcic_get_num_of_host_commands. Total free = 3, Reported to host = 1
    36058 18:10:03.328 +1:18:15.813 HCI Send Event: HCI_COMMAND_COMPLETE_EVT
    36059 18:10:03.343 +1:18:15.828 hcic_process_hci_commands: HCIPP_A3DP_SNK_CODEC_CONFIGURATION (Group 3f Opcode 0x19c)
    36060 18:10:03.343 +1:18:15.828 hcic_get_num_of_host_commands. Total free = 3, Reported to host = 1
    36061 18:10:03.343 +1:18:15.828 HCI Send Event: HCI_COMMAND_COMPLETE_EVT
    36062 18:10:03.343 +1:18:15.828 AVPR received a message from ARM A3DP_SNK_CODEC_CONFIGURATION_COMMAND, number 19
    36063 18:10:03.343 +1:18:15.828 A3DP SINK: Sampling frequency of the stream = 2
    36064 18:10:03.343 +1:18:15.828 A3DP SINK: channelMode = 3, The allocation method = 0.
    36065 18:10:03.343 +1:18:15.828 A3DP SINK: Number of blocks = 16, The number of subbands = 8.
    36066 18:10:03.343 +1:18:15.828 A3DP SINK: The number of channels = 2
    ... btstack: AVDTP_SI_START
    39254 18:10:25.843 +1:18:38.328 hcic_process_hci_commands: HCIPP_A3DP_SNK_START_STREAM (Group 3f Opcode 0x19d)
    39255 18:10:25.843 +1:18:38.328 hcic_get_num_of_host_commands. Total free = 3, Reported to host = 1
    39256 18:10:25.843 +1:18:38.328 HCI Send Event: HCI_COMMAND_COMPLETE_EVT
    39257 18:10:25.843 +1:18:38.328 AVPR received a message from ARM [0x0017], number 23
    39258 18:10:25.921 +1:18:38.406 A3DP SINK: Send start STREAMING to AVPR
    39259 18:10:25.921 +1:18:38.406 A3DP SNK: ARM7 state machine move to state STATE_STEAMING
    39260 18:10:25.921 +1:18:38.406 A3DP_SNK: free_ipc_space = 1772
    39261 18:10:25.921 +1:18:38.406 AVPR received a message from ARM A3DP_SNK_START_STREAM_COMMAND, number 20
    39262 18:10:25.921 +1:18:38.406 AVDTP Header: version =2, padding =0
    39263 18:10:25.921 +1:18:38.406 AVDTP Header: csrcCount =0, marker =0
    39264 18:10:25.921 +1:18:38.406 AVDTP Header: payloadType =96, sequenceNumber =0
    39265 18:10:25.921 +1:18:38.406 AVDTP Header: timestamp = 0x0, ssrc = 0x34
    39266 18:10:25.921 +1:18:38.406 AVDTP Header: size =12
    39267 18:10:25.921 +1:18:38.406 A3DP SINK: Sampling frequency of the stream = 2
    39268 18:10:25.921 +1:18:38.406 A3DP SINK: channelMode = 3, The allocation method = 0.
    39269 18:10:25.921 +1:18:38.406 A3DP SINK: Number of blocks = 16, The number of subbands = 8.
    39270 18:10:25.921 +1:18:38.406 A3DP SINK: The number of channels = 2
    ... btstack: AVDTP_SI_SUSPEND
    53003 18:11:37.828 +1:19:50.313 hcic_process_hci_commands: HCIPP_A3DP_SNK_STOP_STREAM (Group 3f Opcode 0x19e)
    53004 18:11:37.828 +1:19:50.313 hcic_get_num_of_host_commands. Total free = 3, Reported to host = 1
    53005 18:11:37.828 +1:19:50.313 HCI Send Event: HCI_COMMAND_COMPLETE_EVT
    53006 18:11:37.828 +1:19:50.313 AVPR received a message from ARM A3DP_SNK_STOP_STREAM_COMMAND, number 21
    53007 18:11:38.062 +1:19:50.547 ACL_DATA_STATISTICS for LC handle 0: Rx bps - 56 , Tx bps - 48 , remote NACK ratio - 0

    During music streaming I see log output:
    41001 18:10:34.921 +1:18:47.406 ACL: not enough time to schedule: clock 68388
    41435 18:10:37.484 +1:18:49.969 ACL: not enough time to schedule: clock 70436

    Should I be worried or what problem it might indicate?

    At the moment I have solved the problem and we can close this thread.