Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HFP-AG example not working as intended (IDFGH-6114) #7792

Closed
MarcosHWconfig opened this issue Oct 28, 2021 · 5 comments
Closed

HFP-AG example not working as intended (IDFGH-6114) #7792

MarcosHWconfig opened this issue Oct 28, 2021 · 5 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@MarcosHWconfig
Copy link

MarcosHWconfig commented Oct 28, 2021

Environment

  • Development Kit: ESP32-LyraT v4.3
  • Module or chip used: ESP32-WROVER-E
  • IDF version: v4.3.1-245-gba15ac8634
  • Build System: idf.py
  • Compiler version: xtensa-esp32-elf-gcc --version
  • Operating System: Windows
  • (Windows only) environment type: ESP Command Prompt
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

I flashed the esp-idf\examples\bluetooth\bluedroid\classic_bt\hfp_ag example in my LyraT after modifying the following parameters from the menuconfig:

  • BR/EDR Sync(SCO/eSCO) max connections --> 1
  • BR/EDR Sync(SCO/eSCO) default data path --> HCI
  • audio(SCO) data path --> HCI
  • Wide band speech --> ON

From the example code I see that the AG sends a sinusoid to the connected client. I used several pairs of bluetooth headphones (fully functional) as clients but the only thing I hear is noise, definitely not a sinusoid. I have recorded the received signal, here is the plot:
out

Expected Behavior

Hear the sinusoid correctly from the client side.

Actual Behavior

I hear a strange noise from the client side, not a sinusoid.

Steps to reproduce

  1. Get the code esp-idf\examples\bluetooth\bluedroid\classic_bt\hfp_ag
  2. Change BR/EDR Sync(SCO/eSCO) max connections --> 1, BR/EDR Sync(SCO/eSCO) default data path --> HCI, audio(SCO) data path --> HCI, Wide band speech --> ON
  3. Edit app_hf_msg_set.c and set the MAC address of the client
  4. Open serial console, type con and after connection type cona
  5. Hear the noise from the client
@espressif-bot espressif-bot added the Status: Opened Issue is new label Oct 28, 2021
@github-actions github-actions bot changed the title HFP-AG example not working as intended HFP-AG example not working as intended (IDFGH-6114) Oct 28, 2021
@skateskate
Copy link

I am testing the same configuration as @MarcosHWconfig and I also have the same problem with the sinusoid.
Can someone look into it? Maybe @Wth-Esp can help us?

@ghost
Copy link

ghost commented Nov 3, 2021

hi all,

my colleague is handling this issue, could you @BetterJincheng please provide a patch here?

Thanks!

@BetterJincheng
Copy link
Collaborator

BetterJincheng commented Nov 3, 2021

patch.zip

Hi all,

This is the patch for this issue towards IDF_V4.3.
Try to use it by :
unzip patch.zip
git apply [patch_name]

Turn to us if any problems.

@skateskate
Copy link

Hello @BetterJincheng and @Wth-Esp, thanks for the patch.
On my system the sinusoid is now ok, but I can still hear some spikes now and then (let's say 3-4 spikes every 10 seconds). Is it normal?
If you don't mind I have another question: what is the purpose of the timer that runs out every 4000 microseconds (PCM_GENERATOR_TICK_US)? If I understand correctly, it is used to release the semaphore to the function that generates frame_data_num samples of the sinusoid, but why 4000 microseconds precisely? Could the spikes be related to this?

@BetterJincheng
Copy link
Collaborator

Hi @skateskate,

Codec (code & decode) for HFP is mSBC with specific parameters. It transfers 240 Bytes every 7.5 ms. So in the demo we need to create 240 Bytes every 7.5ms. PCM_GENERATOR_TICK_US is just the periodic duration we create the input audio data in the purpose of simulating a role of microphone. You can set it to any value as you want.

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants