espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.25k stars 7.19k forks source link

Get MCLK in hfp_ag (IDFGH-12077) #13138

Open smishra123 opened 6 months ago

smishra123 commented 6 months ago

Answers checklist.

General issue report

I am working with hfp_ag on LyraT 4.3 board to build a custom product. The product almost works. The only issue left is getting MCLK from BT controller to the ES8388 audio chip. I have configured the audio chip and verified the configuration. However ES8388 on LyraT 4.3 seems to need the MCLK to function.

I can see all the I2S signals except MCLK on the oscilloscope when hfp-ag and headset combination are in a call. The LRCK is 8KHz while the SCLK is 256 KHz. When I loop back I2S data in and data out, the LyraT 4.3 board running hfp_ag echoes back what I have spoken in the headset. However without the MCLK input to ES8388 I cannot use the mic or speaker connected to ES8388.

I added the following function calls in to main.c in hfp_ag/main . These are adapted from i2s_check_set_mclk function in i2s_common.c. However this does not seem to work. My assumption was that the Bluetooth stack and controller generated the I2S signals and were also generating the MCLK, but that the MCLK was not made available on the GPIO pin since that pin could vary from board to board.

gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);

//gpio_ll_iomux_pin_ctrl(is_apll ? 0xFFF6 : (is_i2s0 ? 0xFFF0 : 0xFFFF));
gpio_ll_iomux_pin_ctrl(0xFFFF); // i tried all 3 combinations
esp-qing commented 6 months ago

Hi, this may be a configuration issue of the board in IDF. Please refer to the examples in ADF to modify the board configuration. https://github.com/espressif/esp-adf/tree/master/examples/player/pipeline_hfp_stream