esp-idf icon indicating copy to clipboard operation
esp-idf copied to clipboard

HFP_HF example project produces static in PCM mode (IDFGH-12758)

Open devrintalen opened this issue 9 months ago • 4 comments

Answers checklist.

  • [X] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • [X] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • [X] I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I am running the hfp_hf example project on my ESP32-PICO-KIT-1_V1.0 board and I am unable to get the PCM output to produce anything other than static.

I am building the project with the attached sdkconfig file (I had to rename to sdkconfig.txt in order to attach to this case). sdkconfig.txt

I am able to pair successfully to an iPhone 14. When I start a phone call, I see the I2S/PCM output begin clocking on the default GPIOs assigned in gpio_pcm_config.c. I capture this output with a logic analyzer:

image

We have connected this output to both an I2S DAC as well as parsing the logic analyzer capture and porting this to a WAV file. The output is just static.

What is the specific format of the data on the pins? The technical reference manual lists three modes:

  • Philips Standard
  • MSB Alignment Standard
  • PCM Standard

When I parse the data according to the MSB alignment standard I only hear static.

We have tried HCI mode with the wideband speech codec and the audio feedback is working as expected. Our issue is with the PCM output.

devrintalen avatar May 03 '24 14:05 devrintalen

We hooked the PCM_DOUT GPIO to the PCM_DIN GPIO and we can hear audio loopback in PCM mode. So this must be an issue of us not understanding the data format on the PCM pins. Can you please clarify what the format is?

devrintalen avatar May 03 '24 15:05 devrintalen

Hi, sorry for replying so late. In esp-idf, the default synchronization is 8kHZ; the default data clock is 256kHZ; Stereo mode, 16 bits samples; right channel when sync polarity = 0 , left channel when sync polarity = 1 ; sample are sent / received MSB first; pcmd_out pad is push-pull. The rest configuration can be checked in esp-idf. (including rising edge / falling edge and master / slave role). The default PCM output waveform of hfp example is similar to the MSB Alignment Standard in the esp32 I2S document. If you have any questions please feel free to ask.

esp-qing avatar May 07 '24 04:05 esp-qing

Qing, we are using a MAX98357A DAC to play the speaker output. This device expects the DIN pin to follow the Phillips Standard:

image

The data that I am tracing on the GPIO pins on our ESP32-PICO-KIT-1_V1.0 board looks like this, which shows that it is following the MSB alignment standard, as you said.

image image

Is it possible to modify the I2S output to follow the Phillips Standard?

devrintalen avatar Jul 25 '24 14:07 devrintalen

Hi, @devrintalen ,Sorry, the hfp-hf example cannot modify the output for now. But I have an idea for your previous problem, it seems to be this reason. https://github.com/espressif/esp-idf/issues/14231 Could you check if this is the reason according to the comments?

esp-qing avatar Jul 26 '24 08:07 esp-qing