I’m having some trouble with the HFP-AG library and the HFPAGDemo you provided.
#1:
I set the HCI protocol to cpHCILL (as we don’t use the RTS and CTS signals).
In main() I add a PWM timer:
int main(void)
{
/* Configure the hardware for its intended use. */
HAL_ConfigureHardware(1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
GPIOPinConfigure(GPIO_PF2_T1CCP0);
GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_2);
TimerConfigure(TIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
TimerLoadSet(TIMER1_BASE, TIMER_A, round(SysCtlClockGet()/(32768)));
TimerMatchSet(TIMER1_BASE, TIMER_A, round(SysCtlClockGet()/(2*32768)));
TimerEnable(TIMER1_BASE, TIMER_A);
/* Enable interrupts and call the main application thread. */
MainThread();
/* MainThread should run continously, if it exits an error occured. */
while(1)
{
ToggleLED(NULL);
BTPS_Delay(100);
}
}
I then follow the guide Sundeep provided. After executing the OPENAUDIOGATEWAYCLIENT command, it crashes to FaultISR().
See console output below "Console output with protocol cpHCILL and PWM (crashes)".
#2:
If I just change the HCI protocol to cpHCILL and don’t add the PWM, it works fine.
See console output below "Console output with protocol cpHCILL and no PWM (OK)".
#3:
If I set the HCI protocol to cp3Wire and don’t add the PWM, I also get a crash.
See console output below "Console output with protocol cp3Wire and no PWM (crashes)".
Please let me know if you need additional information or traces.
Console output with protocol cpHCILL and PWM (crashes):
[09:05:11.2]OpenStack().
[09:05:11.4]HCI_VS_InitializeAfterHCIReset
[09:05:11.4]VS_Update_UART_Baud_Rate success.
[09:05:11.6]HCI_VS_InitializeAfterHCIReset Success
[09:05:11.7]Bluetooth Stack ID: 1.
[09:05:11.8]WBS Support initialized.
[09:05:11.8]Device Chipset Version: Unknown (greater 4.0)
[09:05:11.8]Bluetooth Device Address: 0x1cba8c2561b9
[09:05:11.9]GAP_Set_Connectability_Mode(cmConnectable).
[09:05:11.9]GAP_Set_Discoverability_Mode(dmGeneralDiscoverable, 0).
[09:05:11.9]GAP_Set_Pairability_Mode(pmPairableMode).
[09:05:11.9]GAP_Register_Remote_Authentication() Success.
[09:05:11.9]
[09:05:11.9]******************************************************************
[09:05:11.9]* Command Options: Inquiry, DisplayInquiryList, Pair, *
[09:05:11.9]* EndPairing, PINCodeResponse, PassKeyResponse, *
[09:05:11.9]* UserConfirmationResponse, *
[09:05:11.9]* SetDiscoverabilityMode, SetConnectabilityMode,*
[09:05:11.9]* SetPairabilityMode, *
[09:05:12.0]* ChangeSimplePairingParameters, *
[09:05:12.0]* GetLocalAddress, SetLocalName, GetLocalName, *
[09:05:12.0]* SetClassOfDevice, GetClassOfDevice, *
[09:05:12.0]* GetRemoteName, ManageAudio, *
[09:05:12.0]* OpenAudioGatewayClient, CloseAgClient, *
[09:05:12.0]* ServiceDiscovery, UpdateControlIndicators, *
[09:05:12.0]* CallWaiting, SendCallerIdNotification, *
[09:05:12.0]* SetRingIndication, RingIndication, *
[09:05:12.0]* SetVoiceRecognitionActivation, *
[09:05:12.0]* SetSpeakerGain, SetMicroPhoneGain, *
[09:05:12.0]* DisableRemoteSoundEnhancement, *
[09:05:12.0]* SendOperatorInfo, SendIncomingCallState, *
[09:05:12.0]* SendSubNumber, SendCallList, *
[09:05:12.0]* Help *
[09:05:12.0]******************************************************************
[09:05:12.0]
[09:05:15.9]HFRE16>inquiry
[09:05:15.9]Return Value is 0 GAP_Perform_Inquiry() SUCCESS.
[09:05:15.9]
[09:05:16.5]HFRE16>
[09:05:16.5]GAP Inquiry Entry Result: 0x00a09628868a.
[09:05:16.5]
[09:05:17.0]HFRE16>
[09:05:17.0]GAP Inquiry Entry Result: 0x7ce9d3e546db.
[09:05:17.0]
[09:05:17.4]HFRE16>
[09:05:17.4]GAP Inquiry Entry Result: 0x5cf370614af1.
[09:05:17.4]
[09:05:19.9]HFRE16>
[09:05:19.9]GAP Inquiry Entry Result: 0x00a09637861a.
[09:05:19.9]
[09:05:20.2]HFRE16>
[09:05:20.2]GAP Inquiry Entry Result: 0xe006e6ba56d1.
[09:05:20.2]
[09:05:21.0]HFRE16>
[09:05:21.0]GAP Inquiry Entry Result: 0x48c1ac21cebb.
[09:05:21.0]
[09:05:26.2]HFRE16>
[09:05:26.2]GAP_Inquiry_Result: 6 Found.
[09:05:26.2]GAP Inquiry Result: 1, 0x00a09628868a.
[09:05:26.2]GAP Inquiry Result: 2, 0x7ce9d3e546db.
[09:05:26.2]GAP Inquiry Result: 3, 0x5cf370614af1.
[09:05:26.2]GAP Inquiry Result: 4, 0x00a09637861a.
[09:05:26.2]GAP Inquiry Result: 5, 0xe006e6ba56d1.
[09:05:26.2]GAP Inquiry Result: 6, 0x48c1ac21cebb.
[09:05:26.2]
[09:05:31.5]HFRE16>pair 6
[09:05:31.5]GAP_Initiate_Bonding (Dedicated): Function Successful.
[09:05:31.5]
[09:05:35.0]HFRE16>
[09:05:35.0]atLinkKeyRequest: 0x48c1ac21cebb
[09:05:35.0]GAP_Authentication_Response() Success.
[09:05:35.0]
[09:05:35.0]HFRE16>
[09:05:35.0]atPINCodeRequest: 0x48c1ac21cebb
[09:05:35.0]
[09:05:35.0]Respond with the command: PINCodeResponse
[09:05:35.0]
[09:05:42.1]HFRE16>PINCodeResponse 0000
[09:05:42.1]PINCodeResponse.
[09:05:42.1]GAP_Authentication_Response(), Pin Code Response Success.
[09:05:42.1]
[09:05:42.2]HFRE16>
[09:05:42.2]atLinkKeyCreation: 0x48c1ac21cebb
[09:05:42.2]Link Key: 0xa5346782740f609f046e9f7da69ab766
[09:05:42.2]Link Key Stored locally.
[09:05:42.2]
[09:05:42.2]HFRE16>
[09:05:42.2]atAuthenticationStatus: 0 Board: 0x48c1ac21cebb
[09:05:42.2]
[09:05:55.1]HFRE16>OpenAudioGatewayClient 6 1
[09:05:55.1]Bluetooth Device Address: 0x48c1ac21cebb
[09:05:55.1]Open Remote HandsFree Port = 0001
[09:05:55.1]HFRE_Open_Remote_HandsFree_Port: Function Successful ID = 0001.
[09:05:55.1]OpenRemoteHandsFreePort: HFRE_Update_Current_Control_Indicator_Status Function Status 0.
[09:05:55.1]
[09:05:58.1]HFRE16>
[09:05:58.1]atLinkKeyRequest: 0x48c1ac21cebb
[09:05:58.1]GAP_Authentication_Response() Success.
[09:05:58.1]
[09:05:58.2]HFRE16>
[09:05:58.2]HFRE Open Port Confirmation, ID: 0x0001, Status: 0x0000.
[09:05:58.2]
Ends in FaultISR(). NVIC_FAULT_STATE = 0x00020000.
Console output with protocol cp3Wire and no PWM (crashes):
[09:18:37.8]OpenStack().
[09:18:38.3]HCI_VS_InitializeAfterHCIReset
[09:18:38.3]VS_Update_UART_Baud_Rate success.
[09:18:38.4]HCI_VS_InitializeAfterHCIReset Success
[09:18:38.4]Bluetooth Stack ID: 1.
[09:18:38.5]WBS Support initialized.
[09:18:38.5]Device Chipset Version: Unknown (greater 4.0)
[09:18:38.5]Bluetooth Device Address: 0x1cba8c2561b9
[09:18:38.5]GAP_Set_Connectability_Mode(cmConnectable).
[09:18:38.5]GAP_Set_Discoverability_Mode(dmGeneralDiscoverable, 0).
[09:18:38.5]GAP_Set_Pairability_Mode(pmPairableMode).
[09:18:38.5]GAP_Register_Remote_Authentication() Success.
[09:18:38.5]
[09:18:38.5]******************************************************************
[09:18:38.5]* Command Options: Inquiry, DisplayInquiryList, Pair, *
[09:18:38.5]* EndPairing, PINCodeResponse, PassKeyResponse, *
[09:18:38.5]* UserConfirmationResponse, *
[09:18:38.6]* SetDiscoverabilityMode, SetConnectabilityMode,*
[09:18:38.6]* SetPairabilityMode, *
[09:18:38.6]* ChangeSimplePairingParameters, *
[09:18:38.6]* GetLocalAddress, SetLocalName, GetLocalName, *
[09:18:38.6]* SetClassOfDevice, GetClassOfDevice, *
[09:18:38.6]* GetRemoteName, ManageAudio, *
[09:18:38.6]* OpenAudioGatewayClient, CloseAgClient, *
[09:18:38.6]* ServiceDiscovery, UpdateControlIndicators, *
[09:18:38.6]* CallWaiting, SendCallerIdNotification, *
[09:18:38.6]* SetRingIndication, RingIndication, *
[09:18:38.6]* SetVoiceRecognitionActivation, *
[09:18:38.6]* SetSpeakerGain, SetMicroPhoneGain, *
[09:18:38.6]* DisableRemoteSoundEnhancement, *
[09:18:38.6]* SendOperatorInfo, SendIncomingCallState, *
[09:18:38.6]* SendSubNumber, SendCallList, *
[09:18:38.6]* Help *
[09:18:38.7]******************************************************************
[09:18:38.7]
[09:18:43.7]HFRE16>inquiry
[09:18:43.7]Return Value is 0 GAP_Perform_Inquiry() SUCCESS.
[09:18:43.7]
[09:18:44.2]HFRE16>
[09:18:44.2]GAP Inquiry Entry Result: 0x7ce9d3e546db.
[09:18:44.2]
[09:18:44.6]HFRE16>
[09:18:44.6]GAP Inquiry Entry Result: 0x00a09628868a.
[09:18:44.6]
[09:18:44.8]HFRE16>
[09:18:44.8]GAP Inquiry Entry Result: 0x60d819bc3f37.
[09:18:44.8]
[09:18:46.5]HFRE16>
[09:18:46.5]GAP Inquiry Entry Result: 0x5cf370614af1.
[09:18:46.5]
[09:18:46.8]HFRE16>
[09:18:46.8]GAP Inquiry Entry Result: 0x48c1ac21cebb.
[09:18:46.8]
[09:18:54.0]HFRE16>
[09:18:54.0]GAP_Inquiry_Result: 5 Found.
[09:18:54.0]GAP Inquiry Result: 1, 0x7ce9d3e546db.
[09:18:54.0]GAP Inquiry Result: 2, 0x00a09628868a.
[09:18:54.0]GAP Inquiry Result: 3, 0x60d819bc3f37.
[09:18:54.0]GAP Inquiry Result: 4, 0x5cf370614af1.
[09:18:54.0]GAP Inquiry Result: 5, 0x48c1ac21cebb.
[09:18:54.0]
[09:18:59.9]HFRE16>pair 5
[09:18:59.9]GAP_Initiate_Bonding (Dedicated): Function Successful.
[09:18:59.9]
[09:19:03.0]HFRE16>
[09:19:03.0]atLinkKeyRequest: 0x48c1ac21cebb
[09:19:03.0]GAP_Authentication_Response() Success.
[09:19:03.0]
[09:19:03.0]HFRE16>
[09:19:03.0]atPINCodeRequest: 0x48c1ac21cebb
[09:19:03.0]
[09:19:03.0]Respond with the command: PINCodeResponse
[09:19:03.0]
[09:19:08.1]HFRE16>PINCodeResponse 0000
[09:19:08.1]PINCodeResponse.
[09:19:08.1]GAP_Authentication_Response(), Pin Code Response Success.
[09:19:08.1]
[09:19:08.2]HFRE16>
[09:19:08.2]atLinkKeyCreation: 0x48c1ac21cebb
[09:19:08.2]Link Key: 0xf0a1b06ef786bddfdfa0a6abf7cf0c17
[09:19:08.2]Link Key Stored locally.
[09:19:08.2]
[09:19:08.2]HFRE16>
[09:19:08.2]atAuthenticationStatus: 0 Board: 0x48c1ac21cebb
[09:19:08.2]
[09:19:23.3]HFRE16>OpenAudioGatewayClient 5 1
[09:19:23.3]Bluetooth Device Address: 0x48c1ac21cebb
[09:19:23.3]Open Remote HandsFree Port = 0001
[09:19:23.3]HFRE_Open_Remote_HandsFree_Port: Function Successful ID = 0001.
[09:19:23.4]OpenRemoteHandsFreePort: HFRE_Update_Current_Control_Indicator_Status Function Status 0.
[09:19:23.4]
[09:19:26.2]HFRE16>
[09:19:26.2]atLinkKeyRequest: 0x48c1ac21cebb
[09:19:26.2]GAP_Authentication_Response() Success.
[09:19:26.2]
[09:19:26.3]HFRE16>
[09:19:26.3]HFRE Open Port Confirmation, ID: 0x0001, Status: 0x0000.
[09:19:26.3]
Ends in FaultISR(). NVIC_FAULT_STATE = 0x00010000.
Console output with protocol cpHCILL and no PWM (OK):
[09:23:11.9]OpenStack().
[09:23:12.1]HCI_VS_InitializeAfterHCIReset
[09:23:12.1]VS_Update_UART_Baud_Rate success.
[09:23:12.3]HCI_VS_InitializeAfterHCIReset Success
[09:23:12.4]Bluetooth Stack ID: 1.
[09:23:12.5]WBS Support initialized.
[09:23:12.5]Device Chipset Version: Unknown (greater 4.0)
[09:23:12.5]Bluetooth Device Address: 0x1cba8c2561b9
[09:23:12.5]GAP_Set_Connectability_Mode(cmConnectable).
[09:23:12.6]GAP_Set_Discoverability_Mode(dmGeneralDiscoverable, 0).
[09:23:12.6]GAP_Set_Pairability_Mode(pmPairableMode).
[09:23:12.6]GAP_Register_Remote_Authentication() Success.
[09:23:12.6]
[09:23:12.6]******************************************************************
[09:23:12.6]* Command Options: Inquiry, DisplayInquiryList, Pair, *
[09:23:12.6]* EndPairing, PINCodeResponse, PassKeyResponse, *
[09:23:12.6]* UserConfirmationResponse, *
[09:23:12.6]* SetDiscoverabilityMode, SetConnectabilityMode,*
[09:23:12.6]* SetPairabilityMode, *
[09:23:12.6]* ChangeSimplePairingParameters, *
[09:23:12.6]* GetLocalAddress, SetLocalName, GetLocalName, *
[09:23:12.6]* SetClassOfDevice, GetClassOfDevice, *
[09:23:12.6]* GetRemoteName, ManageAudio, *
[09:23:12.6]* OpenAudioGatewayClient, CloseAgClient, *
[09:23:12.6]* ServiceDiscovery, UpdateControlIndicators, *
[09:23:12.7]* CallWaiting, SendCallerIdNotification, *
[09:23:12.7]* SetRingIndication, RingIndication, *
[09:23:12.7]* SetVoiceRecognitionActivation, *
[09:23:12.7]* SetSpeakerGain, SetMicroPhoneGain, *
[09:23:12.7]* DisableRemoteSoundEnhancement, *
[09:23:12.7]* SendOperatorInfo, SendIncomingCallState, *
[09:23:12.7]* SendSubNumber, SendCallList, *
[09:23:12.7]* Help *
[09:23:12.7]******************************************************************
[09:23:12.7]
[09:23:16.2]HFRE16>inquiry
[09:23:16.2]Return Value is 0 GAP_Perform_Inquiry() SUCCESS.
[09:23:16.2]
[09:23:16.3]HFRE16>
[09:23:16.3]GAP Inquiry Entry Result: 0x5cf370614af1.
[09:23:16.3]
[09:23:16.9]HFRE16>
[09:23:16.9]GAP Inquiry Entry Result: 0x00a09628868a.
[09:23:16.9]
[09:23:17.0]HFRE16>
[09:23:17.0]GAP Inquiry Entry Result: 0x60d819bc3f37.
[09:23:17.0]
[09:23:18.4]HFRE16>
[09:23:18.4]GAP Inquiry Entry Result: 0x7ce9d3e546db.
[09:23:18.4]
[09:23:19.7]HFRE16>
[09:23:19.7]GAP Inquiry Entry Result: 0x48c1ac21cebb.
[09:23:19.7]
[09:23:26.4]HFRE16>
[09:23:26.4]GAP_Inquiry_Result: 5 Found.
[09:23:26.4]GAP Inquiry Result: 1, 0x5cf370614af1.
[09:23:26.4]GAP Inquiry Result: 2, 0x00a09628868a.
[09:23:26.4]GAP Inquiry Result: 3, 0x60d819bc3f37.
[09:23:26.4]GAP Inquiry Result: 4, 0x7ce9d3e546db.
[09:23:26.5]GAP Inquiry Result: 5, 0x48c1ac21cebb.
[09:23:26.5]
[09:23:38.2]HFRE16>pair 5
[09:23:38.2]GAP_Initiate_Bonding (Dedicated): Function Successful.
[09:23:38.2]
[09:23:41.0]HFRE16>
[09:23:41.0]atLinkKeyRequest: 0x48c1ac21cebb
[09:23:41.0]GAP_Authentication_Response() Success.
[09:23:41.0]
[09:23:41.0]HFRE16>
[09:23:41.0]atPINCodeRequest: 0x48c1ac21cebb
[09:23:41.0]
[09:23:41.0]Respond with the command: PINCodeResponse
[09:23:41.0]
[09:23:47.2]HFRE16>PINCodeResponse 0000
[09:23:47.2]PINCodeResponse.
[09:23:47.2]GAP_Authentication_Response(), Pin Code Response Success.
[09:23:47.2]
[09:23:47.3]HFRE16>
[09:23:47.3]atLinkKeyCreation: 0x48c1ac21cebb
[09:23:47.3]Link Key: 0x16a43435b4f8e67764d51cb583c3f8b4
[09:23:47.3]Link Key Stored locally.
[09:23:47.3]
[09:23:47.3]HFRE16>
[09:23:47.3]atAuthenticationStatus: 0 Board: 0x48c1ac21cebb
[09:23:47.3]
[09:24:01.6]HFRE16>OpenAudioGatewayClient 5 1
[09:24:01.6]Bluetooth Device Address: 0x48c1ac21cebb
[09:24:01.6]Open Remote HandsFree Port = 0001
[09:24:01.6]HFRE_Open_Remote_HandsFree_Port: Function Successful ID = 0001.
[09:24:01.6]OpenRemoteHandsFreePort: HFRE_Update_Current_Control_Indicator_Status Function Status 0.
[09:24:01.6]
[09:24:05.4]HFRE16>
[09:24:05.4]atLinkKeyRequest: 0x48c1ac21cebb
[09:24:05.4]GAP_Authentication_Response() Success.
[09:24:05.4]
[09:24:05.5]HFRE16>
[09:24:05.5]HFRE Open Port Confirmation, ID: 0x0001, Status: 0x0000.
[09:24:05.5]
[09:24:05.9]HFRE16>
[09:24:05.9]HFRE Open Service Level Connection Indication, ID: 0x0001
[09:24:05.9] RemoteSupportedFeaturesValid: TRUE
[09:24:05.9] RemoteSupportedFeatures: 0x00000019
[09:24:05.9] RemoteCallHoldMultipartySupport: 0x00000000
[09:24:05.9]HFRE_Enable Call Line Identification
[09:24:05.9]
[09:24:06.0]HFRE16>
[09:24:06.0]Unknown HFRE Event Received: 11.
[09:24:06.0]
[09:24:11.2]HFRE16>HFRE Speaker Gain Indication, ID: 0x0001, Speaker Gain 0x0007.
[09:24:11.2]