Ai-Thinker-Open / ESP32-A1S-AudioKit

Ai-Thinker AudioKit Board SDK - 安信可 esp32-a1s 音频模组开发板
Other
134 stars 63 forks source link

Codec initialization fails #26

Open mihovilkolaric opened 3 years ago

mihovilkolaric commented 3 years ago

I bought a "ESP32 Audio Kit v2.2 2957" and installed the toolchain as described in this readly, and the ADF (+IDF) from this repo. I can compile and flash all examples I tried so far (here, e.g. ESP32-A1S-AudioKit/examples/get-started/play_mp3), but when running them, I find following errors on the serial console:

E (1026) AC101: reset failed!
E (1026) AUDIO_HAL: codec init failed!
E (1026) AUDIO_BOARD: /home/test/esp/ESP32-A1S-AudioKit/components/audio_board/ai_thinker_audio_kit_v2_2/board.c:55 (audio_board_codec_init): Got NULL Pointer
E (1036) AUDIO_HAL: audio_hal handle is null

and do not hear anything in the earphones.

I verified that in make menuconfig the board ESP32-AiThinker-audio V2.2 is selected.

What can I do to fix this issue?

PratyushGehlot commented 3 years ago

Hi @mihovilkolaric , I also bought last week ESP32 Audio Kit v2.2 2957 and facing the same issue. I used Arduino sketch from here - https://github.com/schreibfaul1/AC101/blob/master/examples/ESP32AudioKit/ESP32AudioKit.ino

AC101 init failing -

Serial.printf("Connect to AC101 codec... "); while (not ac.begin(IIC_DATA, IIC_CLK))
{ Serial.printf("Failed!\n"); delay(1000); }

Serial Output : Connect to AC101 codec... Failed!

Setup : esp32AudioKit

xpeace commented 3 years ago

Recent AI Thinker boards V2.2 2957 are using A1S designs where the AC101 was replaced by the ES8388 eventually these are the wrong boards for this A1S version. It could be possible that all recent boards are defective if the outputs of the A1S-ES8388 are not compatible to the 2.2 Audio Kit board... I did not receive an official statement regarding this mess yet... please ask the AI Thinker support. However I have created an Arduino file which autodetecs your HW wether you're having an AC101 or the ES8388 based design... AI Thinker confirmed they created these A1S ES8388 based chips... they gave no answer why tho. You see the chip when removing the EM shield - or upload the arduino file... https://www.mikrocontroller.net/topic/474383?goto=6754783#6752864

maqsudbd commented 3 years ago

Hi @PratyushGehlot am facing the same issue.

Did you find any solution?

Hi @xpeace

Did you mean that the board is faulty? Or we will have to use driver for ES8388?

mihovilkolaric commented 3 years ago

@maqsudbd : when using the driver for ES8388 (tried this by changing the "Audio Board" to LyraT 4.3 in make menuconfig), the codec can be initialized, but on the headphones-jack of the audio-board you hear only one channel, the volume is very low (hardly hearable), and can not be controlled by software. So, hard to tell whether the board is faulty (resp.: pinning of board and chip are incompatible), or whether some adjustments in the code/firmware/GPIO-config are enough to make it work. It is impossible to say, without having a datasheet of the used A1S (with ES8388).

maqsudbd commented 3 years ago

@mihovilkolaric Thanks for update.

I was planning to use Arduino, made a code for AC101 and I was able to made it work for a friend. Now I am stuck and hope someone will find a solution.

I think datasheet of the used A1S (with ES8388) will help to find the root cause. I hope the board is not faulty by design.

xpeace commented 3 years ago

Eventually GPIO 21 needs to be activated to enable the amp... Still trying to get in contact with AI Thinker... not much success lately...

The A1S was so much better than the LyraT -

It would be sufficient for me to get just one channel mic in / headphone out...

Anyone willing to unsolder the ES32-A1S 2974 from the Ver 2.2 2957 board ( IO connectors are labeled on the rear side of the board... )

Here is an image of the A1S (ES8388) with EM shield removed ES8388

xpeace commented 3 years ago

Additionally I`ve found this pdf reflecting changes in the A1S board...

https://www.docdroid.net/L6LX9SK/esp32-a1s-esv23zh-cnen-pdf but I think they left out the correct values when describing I²C / I²S values... for the esp-adf

/ I2C gpios /

define IIC_CLK 23

define IIC_DATA 18

It does also mention a V2.3 Audio Kit - while AI Thinker put them on a V2.2 pcb...

I now have stereo playback - headphone jack insertion event on the A1S is mapped to Key 3 when using LyraT 4.3 profile.

Volume control seems to be accepted - but there is no change in volume output on the headphone.

xpeace commented 3 years ago

Most recent V2.3 pdf... https://docs.ai-thinker.com/_media/esp32-a1s_v2.3_specification.pdf

maqsudbd commented 3 years ago

@xpeace Thanks for sharing the pdf.

It seems the board is not faulty rather a new one with new design. I2C are now on different pins (23,18 now, before 32,33). Also the I2S pins are different.

tttin46 commented 3 years ago

I found this topic in Chinese: https://blog.csdn.net/Boantong_/article/details/117479162?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163258324316780269812827%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D Hope this help

xpeace commented 3 years ago

Apart from headphone recognition I got all the functions I need working. To get max volume from the mic of the ES8388 unit it requires to enable AGC.

tttin46 commented 3 years ago

New modified ESP-ADF git: https://github.com/SeaHi-Mo/esp-adf

rxd1999 commented 3 years ago

Apart from headphone recognition I got all the functions I need working. To get max volume from the mic of the ES8388 unit it requires to enable AGC.

Hi I meet the same problem these days. Could you tell me how to enable "AGC"? Thanks !

tttin46 commented 3 years ago

Apart from headphone recognition I got all the functions I need working. To get max volume from the mic of the ES8388 unit it requires to enable AGC.

Hi I meet the same problem these days. Could you tell me how to enable "AGC"? Thanks !

AMP is controlled by IO21 but its use for Speaker not for headphone jack. screenshot_1633530849

xpeace commented 3 years ago

I think the question is not about the amp, to increase the mic input sensitivity AGC (Automatic Gain Control) needs to be enabled. Unfortunately it is not possible to increase the pga (programmable gain amplifier) unit without enabling AGC and adjusting the corresponding values.

Here is the settings section I am using to test the mic input. Enable the deemphasis to reduce the quantization noise - and try to reduce any heavy calculation during capture :)... Imho the biggest feature with this chip is - you got the cpu's impacting the AD signal path. Boot buttons and Key6 is also interfering the signal capture - anyone knows what`s up there ?

// PGA ALC/AGC
es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL10, 0xDA);  // Reg 0x12 (ALC enable, PGA Max. Gain=23.5dB, Min. Gain=0dB)
es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL11, 0x91);  // Reg 0x13 (ALC Target=-4.5dB, ALC Hold time = 0 mS)
es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL12, 0x12);  // Reg 0x14 (Decay time =820uS , Attack time = 416 uS)
es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL13, 0x06);  // Reg 0x15 (ALC mode) 96 Samples
es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL14, 0x00);  // Reg 0x16 (noise gate = -40.5dB, NGG = 0x01(mute ADC))
GillesLACAUD commented 2 years ago

Same Issue for me with a new ESP32 Audio Kit V2.2 3378.....I have an ES8388 but it is on the I2C 33/32....and now i not very sure about the I2S pinout....i have read so many configurations :-(.

GillesLACAUD commented 2 years ago

If they change the codec and change also the pinout between the different productions....

GillesLACAUD commented 2 years ago

I can find any schematic with the I2C 33/32 and the ES8388 !!!

GillesLACAUD commented 2 years ago

and i confirm my A1S board is not the same as the Xpeace picture....the components are not in the same place. (i have removed the shield). PLEASE AI WHERE IS THE LAST SCHEMATIC

xuhongv commented 2 years ago

@GillesLACAUD @xpeace @rxd1999 @mihovilkolaric

hi , we change the i2s port in the newest A1S module:

image

GillesLACAUD commented 2 years ago

Hi Xuhongv. Thank you for your quick answer. It will be very usefull. Can you also upload the last schematic or data sheet in this post or on your web site, and give us the link. Is it the final version of the ESP32 Audio Kit or you plan to change something else in the futur ? I want to buy a lot of your cards and i must be sure to have always the same boards.

GillesLACAUD commented 2 years ago

I am sorry but i am a little bit lost... **Where is the github with your informations ? **.

When i search i find this in the 2 repo:

For the ADF github https://github.com/espressif/esp-adf/blob/master/components/audio_board/lyrat_v4_3/board_pins_config.c And For the Audio kit github https://github.com/Ai-Thinker-Open/ESP32-A1S-AudioKit/blob/master/components/audio_board/lyrat_v4_3/board_pins_config.c

image

xuhongv commented 2 years ago

You can use the sdk on ESPRESSIF ADF github , and then you alter the i2s pins .

GillesLACAUD commented 2 years ago

And the I2C pins too... Did you have the schematics please ?

GillesLACAUD commented 2 years ago

ok Xuhongv....Thx for the two links....but when i open the doc the pinout is not correct So i do not understand the difference between the software and the hardware part. Could you check again please... And thank you again for you help...I very appreciate For The I2C image For The I2S image

GillesLACAUD commented 2 years ago

Could you also tell us how we can find an identification of the version of the A1S module ? How we can know if we have an AC101, an ES8388 with 18/23 on I2C and an ES8388 with 33/32 on I2C ? On the A1S Module we have always the same FCC ID

xuhongv commented 2 years ago

esp32-a1s_v2.3-20210508(1).pdf

xuhongv commented 2 years ago

You can see the bottom font of the module.

GillesLACAUD commented 2 years ago

Thx,Thx 🥇 Ok now the pinout and the software config are in line.... :-). I hope i have the good board now... Did you find some information about the identification ? Please update your documentation...i know it is not always easy to track all of this.

I do not unserstand : "the bottom font of the module".

xuhongv commented 2 years ago

We already to halt producte the an ES8388 module with 18/23 on I2C .

asantoni commented 2 years ago

Just in case this helps someone else: I have a board labelled ESP32 Audio Kit V2.2 that just arrived and based on this thread, I assumed it was using the ES8388 but my GPIOs didn't match what GillesLACAUD posted nor the Lyra V4.3 pinout. However, I looked at the esp32-a1s_v2.3-20210508(1).pdf that xuhongv posted 4 days ago and it has the correct pins for my board.

In board_pins_config.c, I needed these pins: image

With these, I'm finally able to get the play_mp3_control example to work correctly. Before, I was just getting static noise out the headphone jack. If I push the KEY2 button on my board, it plays each of the sample MP3s correctly. Volume buttons are working, although volume is low.

GillesLACAUD commented 2 years ago

Hi Asantoni

Thank you very much for your feedback. Can you please tell us what is the number near the V2.2... I think it is a data code or an identification for the ESP32 Audio Kit. Just on the right of the V2.2 for me it is 3378.

For me I have check the I2S signal near the ES8388 (without anything insert in the jack)

SCLK----C14----pin2 ES8388---1.4MHertz (44.1KHertz 16bits 2Channels) LRCLK--C15-----pin7 ES8388---44.1KHertz SDIN------------pin6 ES8388---I send a square waveform and I find good pattern on this pin MCLK--C13-----pin1 ES8388---Nothing

But nothing on the 11-12 14-15 pin....no noise, no sound....

(I did not use the adf part)

@xuhongv Under the ESP32-A1S there is an identification ESP32-A1S 2974. Please can you find the correlation between the different versions and this number. In fact when the ESP32-A1S is sold on the ESP32 Audio Kit we can not see anymore if it is a AC101 or ES8388 Or please can you report the V2.3 identification on the silkscreen

GillesLACAUD commented 2 years ago

@asantoni Could you share you bin file ?....so i can test my ESP32 boards. It a mp3 player, and the mp3 is on the SD card...is it correct ?

asantoni commented 2 years ago

@GillesLACAUD: Yes, my kit is marked with 3378 too.

Here's my compiled binary of the play_mp3_control example. The sample MP3 files are built into the image so there is no SD card needed. I just plug in some headphones into the "earphones" jack and then push key 2 to cycle through the different files/samplerates (same file in 3 different samplerates). play_mp3_control.zip

Visual Studio Code flashes these files to the Audio Kit with: C:\Users\Albert\.espressif\python_env\idf4.3_py3.8_env\Scripts\python.exe C:\esp\esp-idf\components\esptool_py\esptool\esptool.py -p COM3 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 play_mp3_control.bin 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin

Note that you will need to set the flash size to 4 MB in the menuconfig. (I was experimenting with this before, sorry!)

GillesLACAUD commented 2 years ago

Thank a lot asantoni....I will test this ASAP.... :-)

tttin46 commented 2 years ago

I'm trying to make Audio Chat Over IP system (TCP audio stream) with Audio Kit V2.2 as clients and a PC as Chat server. But I stuck in making ES8388 library for Arduino about 2 weeks. Does anybody have library for arduino?

GillesLACAUD commented 2 years ago

I have receive some new boards yesterday ESP32 Audio Kit V2.2 2957. With the I2C scanner I find an I2C chip at 0x10 address pin 33/32. It is the codec for sure... But when I try to read a register it fails !!!!! so another behavior, again..... (try on two different boards 2957)

With the same code and an ESP32 Audio Kit V2.2 3378 I find the codec at the 0x10 address and I can read the Register...but no audio output for now with my code.

@asantoni I have try your bin file (Thank and Thank again :-)) ESP32 Audio Kit V2.2 3378 IT WORKS......BINGO....BRAVO !!!!! nice mp3 ESP32 Audio Kit V2.2 2957 FAIL

I suppose you use the adf driver. Correct ? I use this to upload your bin image

GillesLACAUD commented 2 years ago

for information's I measured the clock LRCLK----------- 8Khertz SCLK-------------256KHertz----------- 216LRCLK MCLK------------2.048MHertz---------8*SCLK

GillesLACAUD commented 2 years ago

I have understand.... I just forgot to set the Master clock :-( REG_WRITE(PIN_CTRL, 0xFFFFFFF0); PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);

But for the ESP32 Audio Kit 2957 it is alway fail....

GillesLACAUD commented 2 years ago

@xuhongv Did you have any idea about the 2957 boards ?

mdhosale commented 2 years ago

Hi all- I think I have a better way to explain this. I made some progress on the AiThinker with the ES388, but I am having an issue where the sound is working, but I am hearing a low hiss in the right channel that eventually gets louder and louder, I am not sure where to beg into debug that. i am about 90-95% there. Maybe someone has some tips on what may be wrong. Here’s what I found:

Note: I am using Arduino IDE with ESP32 boards 1.6 (2.0 is not working) this is for a project that takes audio in, processes it via a bank of filters, then outputs it out the headphone jack.

I am working based on the faust esp32 example found here: https://faustdoc.grame.fr/tutorials/esp32/

The pinouts on the AiThinker with an E8388 need to be changed as per the image provided above. So, I made the following changes,

in the Faust generated .cpp file : #define LYRA_T true

then where is reads:

#elif LYRA_T
            pin_config = {
                .bck_io_num = 5,
                .ws_io_num = 25,
                .data_out_num = 26,
                .data_in_num = 35
            };

change to:

#elif LYRA_T
            pin_config = {
                .bck_io_num = 27,
                .ws_io_num = 25,
                .data_out_num = 26,
                .data_in_num = 35
            };  

then in es388.h change, more pinout stuff:

#define I2C_MASTER_NUM I2C_NUM_1 /*!< I2C port number for master dev */

#define I2C_MASTER_SCL_IO GPIO_NUM_23//these are wrong 
#define I2C_MASTER_SDA_IO GPIO_NUM_18

#define I2C_MASTER_FREQ_HZ 100000 
#define I2C_MASTER_TX_BUF_DISABLE 0
#define I2C_MASTER_RX_BUF_DISABLE 0

#define WRITE_BIT I2C_MASTER_WRITE              /*!< I2C master write */
#define ACK_CHECK_EN 0x1

to

//from the example. nessecary info for I2C. common protocol defines
#define WRITE_BIT                          I2C_MASTER_WRITE /*!< I2C master write */
#define READ_BIT                           I2C_MASTER_READ  /*!< I2C master read */
#define ACK_CHECK_EN                       0x1              /!< I2C master will check ack from slave/
#define ACK_CHECK_DIS                      0x0              /*!< I2C master will not check ack from slave */
#define ACK_VAL                            (i2c_ack_type_t)0x0              /*!< I2C ack value */
#define NACK_VAL                           (i2c_ack_type_t)0x1              /*!< I2C nack value */

#define I2C_TX_BUF_DISABLE    0                /*!< I2C master do not need buffer */
#define I2C_RX_BUF_DISABLE    0                /*!< I2C master do not need buffer */

#define PA_ENABLE_GPIO          GPIO_NUM_21 //a relevent GPIO pin for the LYRAT 4.2, for turning the PA power on

#define I2C_MASTER_NUM I2C_NUM_1 /*!< I2C port number for master dev */

#define I2C_MASTER_SCL_IO GPIO_NUM_32
#define I2C_MASTER_SDA_IO GPIO_NUM_33

#define I2C_MASTER_FREQ_HZ 100000
//#define I2C_MASTER_TX_BUF_DISABLE 0
//#define I2C_MASTER_RX_BUF_DISABLE 0

#define WRITE_BIT I2C_MASTER_WRITE              /*!< I2C master write */
#define ACK_CHECK_EN 0x1

For whatever reason the codec initialization that was forked from the esspresif adf by AiThinker was not working for me, so I dug in and went register by register and made a function and added it to the es388.cpp file based on this user guide (https://dl.radxa.com/rock2/docs/hw/ds/ES8388%20user%20Guide.pdf):

Screen Shot 2021-11-04 at 11 56 59 AM

code is below:


esp_err_t es8388::es8388_startTest() {

  esp_err_t res = ESP_OK;
  uint8_t prev_data = 0, data = 0;

  int mode = ES_MODULE_ADC_DAC;

  audio_hal_codec_i2s_iface_t i2siface;

  i2siface.mode = AUDIO_HAL_MODE_MASTER;        /*!< audio codec chip mode */
  i2siface.fmt = AUDIO_HAL_I2S_NORMAL;       /*!< I2S interface format */
  i2siface.samples = AUDIO_HAL_48K_SAMPLES;  /*!< I2S interface samples per second */
  i2siface.bits = AUDIO_HAL_BIT_LENGTH_24BITS;        /*!< i2s interface number of bits per sample */
  //es.es8388_config_i2s((audio_hal_codec_mode_t)AUDIO_HAL_CODEC_MODE_LINE_IN,&i2siface);//AUDIO_HAL_CODEC_MODE_BOTH
  es8388_config_i2s((audio_hal_codec_mode_t)AUDIO_HAL_CODEC_MODE_BOTH, &i2siface); //AUDIO_HAL_CODEC_MODE_BOTH //it seems this only sets the bits

  audio_hal_codec_config_t audio_hal_codec_cfg;//AUDIO_HAL_CODEC_MODE_BOTH
  audio_hal_codec_cfg.adc_input = AUDIO_HAL_ADC_INPUT_ALL;
  audio_hal_codec_cfg.dac_output = AUDIO_HAL_DAC_OUTPUT_ALL;

  i2c_init(); // ESP32 in master mode

  /* enable es8388 PA */
  gpio_config_t  io_conf;
  bool enable = true;
  memset(&io_conf, 0, sizeof(io_conf));
  io_conf.intr_type = (gpio_int_type_t) GPIO_PIN_INTR_DISABLE;
  io_conf.mode = GPIO_MODE_OUTPUT;
  io_conf.pin_bit_mask = BIT(PA_ENABLE_GPIO); //the GPIO for pa_enable_gpio for the lyrat
  io_conf.pull_down_en = (gpio_pulldown_t) 0;
  io_conf.pull_up_en = (gpio_pullup_t) 0;
  gpio_config(&io_conf);
  if (enable) {
    gpio_set_level(PA_ENABLE_GPIO, 1);
  } else {
    gpio_set_level(PA_ENABLE_GPIO, 0);
  }

  /* Chip Control and Power Management */

  res |= es_write_reg(ES8388_ADDR, ES8388_MASTERMODE/*8, 0x08*/, 0x00); //84 master mode no dac heardCODEC IN I2S SLAVE MODE MCLK/4 
  res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER/*2, 0x02*/, 0xF3); //power down to set registers
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL21/*43, 0x2b*/, 0x80); //80 or 00?set internal ADC and DAC use the same LRCK clock, ADC LRCK as internal LRCK
  res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL1/*0, 0x00*/, 0x05);  //05, 12, 17 all work?12 Enfr=0,Play&Record Mode,(0x17-both of mic&paly)
  res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2/*1, 0x01*/, 0x40); //40,00? normal power

  res |= es_write_reg(ES8388_ADDR, ES8388_ADCPOWER/*3, 0x03*/, 0x00);//0x08?microphone bias power down (high impedance output, default)
  res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER/*4, 0x04*/, 0x3C);

  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL2/*10, 0x0a*/, 0x00); //ADC_INPUT_DIFFERENCE 0x00 LINSEL & RINSEL, LIN1/RIN1 as ADC Input; DSSEL,use one DS Reg11; DSR, LINPUT1-RINPUT1
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL1/*9,0x09*/, 0x00);// PGA gain
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL4/*12, 0x0c*/, 0x0c);// Left/Right data, Left/Right justified mode, Bits length, I2S format
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL5/*13, 0x0d*/, 0x02);
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL8/*16, 0x10*/, 0x00);//0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL9/*17, 0x11*/, 0x00);  //ADC Right Volume=0db
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL10, 0x12);    // Reg 0x12 = 0xe2(alc enable) (ALC disenable, PGA Max. Gain=23.5dB, Min. Gain=0dB) 
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL11, 0xa0);   // Reg 0x13 = 0xc0 (ALC Target=-4.5dB, ALC Hold time =0 mS)
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL12, 0x12);   // Reg 0x14 = 0x12(Decay time =820uS , Attack time = 416 uS)
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL13, 0x06);   // Reg 0x15 = 0x06(ALC mode) 
  res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL14, 0xc3);   // Reg 0x16 = 0xc3(nose gate = -40.5dB, NGG = 0x01(mute ADC))
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL1/*23, 0x17*/, 0x18);// 17 - 1a 0x18:16bit iis , 0x00:24
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL2/*24, 0x18*/, 0x02);  //DACFsMode,SINGLE SPEED; DACFsRatio,256
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL4/*26, 0x1a*/,     0x00); //left vol 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL5/*27, 0x1b*/,     0x00); // right vol 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL16/*38, 0x26*/,     0x00); //select for output mix - default
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL17/*39, 0x27*/,     0x90);//-B8 L mixer enable, set to 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL18 /* 40    0x28*/, 0x38);//??Phase inversion controls
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL19  /* 41   0x29*/,  0x38);//??stereo - mono controls
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL20/*42, 0x2a*/,     0x90);//-B8 R mixer enable, set to 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL24/*46, 0x2e*/,     0x1E);// Lout1 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL25/*47, 0x2f*/,     0x1E);// Rout1 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL26/*48, 0x30*/,     0x1E);// Lout2 0dB
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL27/*49, 0x31*/,     0x1E);// Lout2 0dB

  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL6/*28, 0x1c*/,     0x08); //phase invert off
  res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL7/*29, 0x1d*/,     0x40); //00 normal stereo, streength default, 40 mute R

  res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER/*2, 0x02*/, 0x00); // normal all and power up all

  //---------------------
  //--not used? res |= es_write_reg(ES8388_ADDR, ES8388_CHIPLOPOW1/*5,0x05*/,0x00);
  //--not used? res |= es_write_reg(ES8388_ADDR, ES8388_CHIPLOPOW2/*6, 0x06*/,0x00);
  //--not used? res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL3/*25, 0x19*/,     0x00);  // 32 disable volume control soft ramp, normal - check DAC mute if you hear inputs
  //--not used? res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL6/*28, 0x1c*/,     0x08); //phase invert off
  //--not used? res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL7/*29, 0x1d*/,     0x00); //00 normal stereo, streength default
  //--not used? res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL23/*45,0x2d*/, 0x00);   //VREF to analog output resistance
  //---------------------

  return res;
}

In Arduino I get this running by declaring the following:

 es.es8388_startTest();

  delay(3000);
  // start faust dsp
  faustcode.start();
GillesLACAUD commented 2 years ago

@xuhongv No idea about the 2957 boards ? It is very strange...

GillesLACAUD commented 2 years ago

@mdhosale Could you please give us the serial number of yours ESP32 Audio Kit ? Thank you

mdhosale commented 2 years ago

@mdhosale Could you please give us the serial number of yours ESP32 Audio Kit ? Thank you

it is also the 2974 board. thank you!

GillesLACAUD commented 2 years ago

So we have three serial Number

xuhongv commented 2 years ago

@GillesLACAUD the serial Number 2974 of module is with ES8388 .

GillesLACAUD commented 2 years ago

Thank you

@xuhongv Could you confirm this please ?

Thank you

So the 2957 and 2975/3378 are not compatible. Me I use the pin 18/23 as an UART to control a Nextion screen. So when I receive a 2957 board I can not use it. You have stop the production of the 2957 (pin 18/23) but the provider have always these boards in stock. So when I receive the boards I just hope to have the good serial numbers.... :-(

tttin46 commented 2 years ago

Finally I found this solution for low output volume at earphone jack. Just modify ADF audio hall 8366 driver (esp-adf\components\audio_hal\driver\es8388\es8388.c) Find "es8388_set_voice_volume" function and modify it like this:

esp_err_t es8388_set_voice_volume(int volume) { esp_err_t res = ESP_OK; if (volume < 0) volume = 0; else if (volume > 100) volume = 100; volume /= 3; res = es_write_reg(ES8388_ADDR, ES8388_DACCONTROL4, volume); res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL5, volume); res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL24, volume); res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL25, volume); res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL26, volume); res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL27, volume); return res; }

vanbwodonk commented 2 years ago

Thank you

@xuhongv Could you confirm this please ?

  • xxxx Codec AC101 with I2C pin 32/33
  • 2957 Codec ES8388 with I2C pin 18/23
  • 2974 Codec ES8388 with I2C pin 32/33
  • 3378 Codec ES8388 with I2C pin 32/33

Thank you

So the 2957 and 2975/3378 are not compatible. Me I use the pin 18/23 as an UART to control a Nextion screen. So when I receive a 2957 board I can not use it. You have stop the production of the 2957 (pin 18/23) but the provider have always these boards in stock. So when I receive the boards I just hope to have the good serial numbers.... :-(

@GillesLACAUD, i have 2 board 2974 with Codec ES8388, with i2c pin 18/23 and 32/33. I'm so confused.

GillesLACAUD commented 2 years ago

@vanbwodonk

I have receive 5 boards yesterday. 3 Boards with 2974 serial number 2 Boards with 2957 serial number And all the boards are OK....I'm so confused too.

Maybe we should check the two serial number

Can you please send some picture of the two boards. I am in touch with the AI support and they ask me to send them some picture of my fail boards...but I have return them yesterday.

Best