cancel
Showing results for 
Search instead for 
Did you mean: 

HAP Central start stream fail

HuangFan
Associate II

MCU STM32WBA54/STM32WBA55

I was using a HAP central, from example BLE_Audio_HAP_Central, to connect to a headset. I can connect and start telephone stream successfully at the beginning. But after some times later, some hours perhaps, the connect and CAP linkup are returns OK, the steam cannot be started. The log shows that CAP_Unicast_AudioStart() returns OK, but no process was proceed and the procedure complete event will be triggered 5s later with error status 0x91. what's more, remove the bonded data by aci_gap_remove_bonded_device() and repairing still could not fix this issue. I have to clear all bonding table by aci_gap_clear_security_db() and repairing, then I can linkup and start stream successfully.

Compare the failed process with the successful one, in linkup process the CAP event 0x12 was incomplete, ASE ID 1, 2 are missing. 

Screenshot 2025-11-14 111001.jpg

Screenshot 2025-11-14 111137.jpg

 

Screenshot 2025-11-14 111402.jpg

 

log for stream start OK 

[10:18:07.876]·¢¡ú¡ó{A\0v³\0ÿÿ}¡õ
[10:18:07.878]ÊÕ¡û¡ôSelected device 0
aci_gap_create_connection() returns status 0x00
{A\0w³\0V˜}
[10:18:07.947]ÊÕ¡û¡ô>>== ACI_GAP_PROC_COMPLETE_VSEVT_CODE
>>== HCI_LE_ENHANCED_CONNECTION_COMPLETE_SUBEVT_CODE - Connection handle: 0x0001
     - Connection established with @:a4:90:ce:1e:a9:87
     - Connection Interval:   40.00 ms
     - Connection latency:    0
     - Supervision Timeout:   10000 ms
>>== device is already bonded
aci_gap_send_pairing_req returns 0
  Success: aci_gap_adv_set_enable stop

[10:18:08.212]ÊÕ¡û¡ô>>== ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE
     - Pairing Success

Pairing Complete with connection handle 0x0001
GAF Profiles Mask 0x0A present in NVM
profiles 0x00 of the GAF are already linked on ConnHandle 0x0001
CAP_Linkup() for GAF restoration on ConnHandle 0x0001 for link mask 0x0A returns status 0x00

[10:18:08.335]ÊÕ¡û¡ôMTU = 247
  Success: aci_gatt_update_char_value BLOCKSIZE command
CAP Event : 0x0A
CAP Unicast Linkup Event with status 0x00

[10:18:08.454]ÊÕ¡û¡ôCAP Event : 0x02
Sink PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              48 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 7.5 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x64004B
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x0098

[10:18:08.574]ÊÕ¡û¡ôCAP Event : 0x02
Sink PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              16 kHz
              24 kHz
              32 kHz
              48 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 10 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x9B001E
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x0004

[10:18:08.735]ÊÕ¡û¡ôCAP Event : 0x06
CAP Event : 0x12
ASE ID 1 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x00
CAP Event : 0x12
ASE ID 2 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x00
CAP Event : 0x12
ASE ID 5 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x00
CAP Event : 0x12
ASE ID 6 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x00

[10:18:08.933]ÊÕ¡û¡ôCAP Event : 0x03
Source PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              16 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 7.5 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x28001E
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x0098

[10:18:09.014]ÊÕ¡û¡ôCAP Event : 0x03
Source PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              16 kHz
              24 kHz
              32 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 10 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x500028
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x00D2

[10:18:09.614]ÊÕ¡û¡ôCAP Event : 0x39
Volume Control Profile is linked on ConnHandle 0x0001
CAP Event : 0x00
CAP Linkup Complete on Connhandle 0x0001 with status 0x00
Complete HAP Linkup on ConnHandle 0x0001 is started with status 0x00

[10:18:11.213]ÊÕ¡û¡ôHAP Linkup Complete Event with ConnHandle 0x0001 is received with status 0x00
HAP_HARC_ReadPresetsRequest() returns status 0x92

[10:18:14.374]·¢¡ú¡ó{A\0vµ\0ÿÿ}¡õ
[10:18:14.378]ÊÕ¡û¡ôStart Telephony Stream
Start Telephony Stream
Set Start Stream for CAP Acceptor 0 on connHandle 0x0001 :
Sink Codec Conf :
    Audio Channel Allocation : 0x00000003
    Channel Per CIS : 1
    Sampling Freq : 0x03
Source Codec Conf :
    Audio Channel Allocation : 0x00000003
    Channel Per CIS : 1
    Sampling Freq : 0x03
CAP_Unicast_AudioStart() of 1 CAP Accceptors in Set Type 0x00 returns status 0x00
{A\0wµÄT}
[10:18:14.532]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 1 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x01

[10:18:14.692]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 2 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x01

[10:18:14.853]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 5 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x01

[10:18:14.972]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 6 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x01
>>== ISOCHRONOUS_GROUP_EVENT
     - Opcode:   0x2062
     - CIG ID:   0     - cis_conn_handle:   0x0009
     - CIG ID:   0     - cis_conn_handle:   0x000A

[10:18:15.134]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 1 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x02
CAP Event : 0x12
ASE ID 2 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x02
CAP Event : 0x12
ASE ID 5 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x02
CAP Event : 0x12
ASE ID 6 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x02

[10:18:15.252]ÊÕ¡û¡ôCAP Event : 0x06
CAP Event : 0x06

[10:18:15.294]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 1 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x03
CAP Event : 0x01
Init Audio Clock with freq 3
Audio Clock Initialization
RCC AS is now properly initialized
CAP Event : 0x12
ASE ID 2 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x03
CAP Event : 0x12
ASE ID 5 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x03
CAP Event : 0x12
ASE ID 6 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x03

[10:18:15.823]ÊÕ¡û¡ô>>== ISOCHRONOUS_GROUP_EVENT
     - Opcode:   0x0019
     - cis_conn_handle:   0x0009    - iso_interval:   8
==>> AUDIO_RegisterGroup()
CAP Event : 0x0E
Setup Output Audio Data Path is requested for ASE ID 5 on ACL Conn Handle 0x0001 (CIS Conn Handle 0x0009)
  Codec ID
    Coding format : 0x06
    Company id : 0x0000
    VS codec id : 0x0000
  Presentation Delay 40000 us
  Min Controller Delay 2813 us
  Max Controller Delay 230000 us
Setup Audio Peripheral for Sink Role at Sampling frequency 3
Audio Channels Allocation Configuration : 0x00000001
Number of Audio Channels 1 
Configure Audio Periphal drivers at Sampling frequency 3
Register callback to Start Audio Peripheral Tx
==>> CODEC Configure Data Path with following parameters:
  Direction : 1
  Data Path ID : 0x01
  Sample Depth : 16
  Decimation : 2
==>> CODEC_ConfigureDataPath() : Success
==>> CODEC Setup ISO Data Path for CIS Connection Handle 0x0009
==>> CODEC_SetupIsoDataPath() : Success
CAP Event : 0x0F
Number of Output Channels Up:  1
Output Audio Data Path is up with status 0x00 for CIS Conn handle 0x0009
Controller Delay : 22000 us
Transport Latency : 4290 us
Setup Unicast Audio Data Path for ASE ID 5 on CIS connection handle 0x0009 with controller delay at 22000 us returns status 0x00
Audio Data Path is complete with remaining Application delay for audio process to respect : 100us
CAP Event : 0x01
Init Audio Clock with freq 3
Audio Clock already configured
>>== HCI_LE_CIS_ESTABLISHED_SUBEVT_CODE - CIS Connection handle: 0x0009  - Status 0x00

[10:18:16.013]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 5 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x04

[10:18:16.443]ÊÕ¡û¡ô>>== ISOCHRONOUS_GROUP_EVENT
     - Opcode:   0x0019
     - cis_conn_handle:   0x000A    - iso_interval:   8
==>> AUDIO_RegisterGroup()
CAP Event : 0x0E
Setup Output Audio Data Path is requested for ASE ID 6 on ACL Conn Handle 0x0001 (CIS Conn Handle 0x000A)
  Codec ID
    Coding format : 0x06
    Company id : 0x0000
    VS codec id : 0x0000
  Presentation Delay 40000 us
  Min Controller Delay 2813 us
  Max Controller Delay 230000 us
Setup Audio Peripheral for Sink Role at Sampling frequency 3
Audio Channels Allocation Configuration : 0x00000002
Number of Audio Channels 1 
==>> CODEC Configure Data Path with following parameters:
  Direction : 1
  Data Path ID : 0x01
  Sample Depth : 16
  Decimation : 2
==>> CODEC_ConfigureDataPath() : Success
==>> CODEC Setup ISO Data Path for CIS Connection Handle 0x000A
==>> CODEC_SetupIsoDataPath() : Success
CAP Event : 0x0F
Number of Output Channels Up:  2
Output Audio Data Path is up with status 0x00 for CIS Conn handle 0x000A
Controller Delay : 22000 us
Transport Latency : 4290 us
Setup Unicast Audio Data Path for ASE ID 6 on CIS connection handle 0x000A with controller delay at 22000 us returns status 0x00
Audio Data Path is complete with remaining Application delay for audio process to respect : 100us
>>== HCI_LE_CIS_ESTABLISHED_SUBEVT_CODE - CIS Connection handle: 0x000A  - Status 0x00

[10:18:16.791]ÊÕ¡û¡ôSTART AUDIO SINK (output)

[10:18:16.813]ÊÕ¡û¡ôCAP Event : 0x0E
Setup Input Audio Data Path is requested for ASE ID 1 on ACL Conn Handle 0x0001 (CIS Conn Handle 0x0009)
  Codec ID
    Coding format : 0x06
    Company id : 0x0000
    VS codec id : 0x0000
  Presentation Delay 40000 us
  Min Controller Delay 5329 us
  Max Controller Delay 230000 us
Setup Audio Peripheral for Source Role at Sampling frequency 3
Audio Channels Allocation Configuration : 0x00000001
Number of Audio Channels 1 
Register callback to Start Audio Peripheral Rx
==>> CODEC Configure Data Path with following parameters:
  Direction : 0
  Data Path ID : 0x01
  Sample Depth : 16
  Decimation : 1
==>> CODEC_ConfigureDataPath() : Success
==>> CODEC Setup ISO Data Path for CIS Connection Handle 0x0009
==>> CODEC_SetupIsoDataPath() : Success
CAP Event : 0x0F
Input Audio Data Path is up with status 0x00 for CIS Conn handle 0x0009
Controller Delay : 22000 us
Transport Latency : 4290 us
Setup Unicast Audio Data Path for ASE ID 1 on CIS connection handle 0x0009 with controller delay at 22000 us returns status 0x00
Audio Data Path is complete with remaining Application delay for audio process to respect : 100us
CAP Event : 0x12
ASE ID 1 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x04
CAP Event : 0x0E
Setup Input Audio Data Path is requested for ASE ID 2 on ACL Conn Handle 0x0001 (CIS Conn Handle 0x000A)
  Codec ID
    Coding format : 0x06
    Company id : 0x0000
    VS codec id : 0x0000
  Presentation Delay 40000 us
  Min Controller Delay 5329 us
  Max Controller Delay 230000 us
Setup Audio Peripheral for Source Role at Sampling frequency 3
Audio Channels Allocation Configuration : 0x00000002
Number of Audio Channels 1 
==>> CODEC Configure Data Path with following parameters:
  Direction : 0
  Data Path ID : 0x01
  Sample Depth : 16
  Decimation : 1
==>> CODEC_ConfigureDataPath() : Success
==>> CODEC Setup ISO Data Path for CIS Connection Handle 0x000A
==>> CODEC_SetupIsoDataPath() : Success
CAP Event : 0x0F
Input Audio Data Path is up with status 0x00 for CIS Conn handle 0x000A
Controller Delay : 22000 us
Transport Latency : 4290 us
Setup Unicast Audio Data Path for ASE ID 2 on CIS connection handle 0x000A with controller delay at 22000 us returns status 0x00
Audio Data Path is complete with remaining Application delay for audio process to respect : 100us
CAP Event : 0x12
ASE ID 2 [Type 0x00 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x04
START AUDIO SOURCE (input)

[10:18:17.093]ÊÕ¡û¡ôCAP Event : 0x12
ASE ID 6 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x04
CAP Event : 0x0B
CAP Unicast Start Procedure is Complete with status 0x00

 log for stream start fail 

[10:10:48.442]·¢¡ú¡ó{A\0v³\0ÿÿ}¡õ
[10:10:48.445]ÊÕ¡û¡ôaci_gap_terminate_gap_proc() returns status 0x00
HAPAPP_StopScanning() returns status 0x00
Selected device 0
aci_gap_create_connection() returns status 0x00
{A\0w³\0V˜}P_PROC_COMPLETE_VSEVT_CODE
>>== ACI_GAP_PROC_COMPLETE_VSEVT_CODE
>>== HCI_LE_ENHANCED_CONNECTION_COMPLETE_SUBEVT_CODE - Connection handle: 0x0001
     - Connection established with @:a4:90:ce:1e:a9:87
     - Connection Interval:   40.00 ms
     - Connection latency:    0
     - Supervision Timeout:   10000 ms
>>== device is already bonded
aci_gap_send_pairing_req returns 0
  Success: aci_gap_adv_set_enable stop

[10:10:48.726]ÊÕ¡û¡ô>>== ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE
     - Pairing Success

Pairing Complete with connection handle 0x0001
GAF Profiles Mask 0x0A present in NVM
profiles 0x00 of the GAF are already linked on ConnHandle 0x0001
CAP_Linkup() for GAF restoration on ConnHandle 0x0001 for link mask 0x0A returns status 0x00

[10:10:48.848]ÊÕ¡û¡ôMTU = 247
  Success: aci_gatt_update_char_value BLOCKSIZE command
CAP Event : 0x12
ASE ID 5 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x00
CAP Event : 0x12
ASE ID 6 [Type 0x01 ] with remote CAP Acceptor on ConnHandle 0x0001 is in State 0x00
CAP Event : 0x0A
CAP Unicast Linkup Event with status 0x00

[10:10:48.968]ÊÕ¡û¡ôCAP Event : 0x02
Sink PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              48 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 7.5 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x64004B
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x0098

[10:10:49.127]ÊÕ¡û¡ôCAP Event : 0x02
Sink PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              16 kHz
              24 kHz
              32 kHz
              48 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 10 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x9B001E
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x0004

[10:10:49.567]ÊÕ¡û¡ôCAP Event : 0x03
Source PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              16 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 7.5 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x28001E
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x0098

[10:10:49.727]ÊÕ¡û¡ôCAP Event : 0x03
Source PAC Record from CAP Acceptor on ConnHandle 0x0001
Remote Record: 
    Supported Sample Freq: 
              16 kHz
              24 kHz
              32 kHz
    Supported Frame Duration: 
              7.5 ms
              10 ms
              Preferred 10 ms
    Supported Channel Counts: 
              1 Channel
    Supported Octets Per Codec Frame: 0x500028
    Supported Max Codec Frame Per SDU: 2
    Supported Preferred Audio Contexts: 0x00D2

[10:10:50.446]ÊÕ¡û¡ôCAP Event : 0x39
Volume Control Profile is linked on ConnHandle 0x0001
CAP Event : 0x00
CAP Linkup Complete on Connhandle 0x0001 with status 0x00
Complete HAP Linkup on ConnHandle 0x0001 is started with status 0x00

[10:10:52.127]ÊÕ¡û¡ôHAP Linkup Complete Event with ConnHandle 0x0001 is received with status 0x00
HAP_HARC_ReadPresetsRequest() returns status 0x92

[10:10:54.362]·¢¡ú¡ó{A\0vµ\0ÿÿ}¡õ
[10:10:54.366]ÊÕ¡û¡ôStart Telephony Stream
Start Telephony Stream
Set Start Stream for CAP Acceptor 0 on connHandle 0x0001 :
Sink Codec Conf :
    Audio Channel Allocation : 0x00000003
    Channel Per CIS : 1
    Sampling Freq : 0x03
Source Codec Conf :
    Audio Channel Allocation : 0x00000003
    Channel Per CIS : 1
    Sampling Freq : 0x03
CAP_Unicast_AudioStart() of 1 CAP Accceptors in Set Type 0x00 returns status 0x00
{A\0wµÄT}
[10:10:59.485]ÊÕ¡û¡ôCAP Event : 0x0B
CAP Unicast Start Procedure is Complete with status 0x91
0 REPLIES 0