Help with Ai-Thinker ESP32-A1S Audio Kit

adrianrb
Posts: 1
Joined: Tue Mar 01, 2016 5:44 pm

Help with Ai-Thinker ESP32-A1S Audio Kit

Postby adrianrb » Fri Feb 14, 2020 5:20 pm

Hi all!
First THANK YOU for ESP32, IDF and ADF... Fantastic work!
I´ve this board (v2.2 - 2 mics - not 4), and managed to make it work OK from mics (stereo mode: left mic -> left speaker/earphone; right mic -> right speaker/earphone).
But no way to make LINEIN input work... never!
Changed audio_hal_codec_mode_t to AUDIO_HAL_CODEC_MODE_LINE_IN and nothing happens.
Any ideas?

Adrian

User avatar
shabtronic
Posts: 49
Joined: Sun Nov 03, 2019 1:33 pm

Re: Help with Ai-Thinker ESP32-A1S Audio Kit

Postby shabtronic » Sat Feb 15, 2020 8:44 pm

probably the mixer line-in routing isn't setup properly.

You'll need to read the AC101 codec data sheet and bodge in some functionality to do that.

http://www.x-powers.com/en.php/Info/down/id/96

I'd would code this up - but I no longer have my A1S boards for a short while :(

Seeed has some example AC101 code - maybe it'll help you roll some code?

https://github.com/respeaker/seeed-voic ... er/ac101.c

rabarar
Posts: 4
Joined: Tue Jan 22, 2019 1:54 am

Re: Help with Ai-Thinker ESP32-A1S Audio Kit

Postby rabarar » Sun May 17, 2020 2:59 pm

Adrian,

Did you ever get a solution to make LINEIN work? I'm looking for a similar solution.

Best,
Rob

rabarar
Posts: 4
Joined: Tue Jan 22, 2019 1:54 am

Re: Help with Ai-Thinker ESP32-A1S Audio Kit

Postby rabarar » Sun May 17, 2020 4:15 pm

Adrian,

I took a look at the code, and figured out how to make it work - so the short answer is you need to modify the ac101 codec init function - the HAL doesn't expose the necessary interfaces to control the register writing for the source selection - I downloaded the data sheet for the AC101 Codec and found the values for register 0x51 and 0x54 - here's the mods that I made:

i conditionally compiled it
in components/audio_hal/driver/ac101/ac101.c in ac101_init(audio_hal_codec_config_t *codec_cfg) modify the two register writes...

Code: Select all

 #ifndef USE_LINEIN
     res |= ac101_write_reg(ADC_SRC, 0x2020);
#else
     ESP_LOGI(TAG, "[ ROB ] ADC_SRC linein L/R");
     res |= ac101_write_reg(ADC_SRC, 0x0810);
#endif

Code: Select all

#ifndef USE_LINEIN
    res |= ac101_write_reg(OMIXER_SR, 0x0081);
#else
    ESP_LOGI(TAG, "[ ROB ] OMIXER_SR linein L/R");
     res |= ac101_write_reg(OMIXER_SR, 0x0810);
#endif
Hope that helps!

Rob

Who is online

Users browsing this forum: No registered users and 4 guests