muvox-io / euphonium

Tiny audio platform
GNU Affero General Public License v3.0
96 stars 15 forks source link

Getting started issues with ai esp32 audio kit 2.2 #23

Open rhaamo opened 2 years ago

rhaamo commented 2 years ago

Hello,

Just got an Ai ESP32 Audio Kit V2.2 and flashed it with latest tarball from the releases but I have some issue.

No matter what board I use in the selector, nothing got out, CSPOT does connect but same, nothing out.

Any ideas to debug thoses issues ?

EDIT, logs when setting to board ai thinker AC101:

I [http] HTTPModule.cpp:50: Body: {"configSchema":{"sda":{"tooltip":"I2C - SDA","type":"number","value":"33","defaultValue":"0"},"ws":{"tooltip":"I2S - WS / LRCLK","t}
I [http] HTTPServer.cpp:296: Publishing event
I (481382) I2S: DMA queue destroyed
I (481392) I2S: APLL expected frequency is 22579200 Hz, real frequency is 22579193 Hz
I (481392) I2S: DMA Malloc info, datalen=blocksize=2048, dma_buf_count=8
I [core] Core.cpp:194: No data
D [core] Core.cpp:198: Free memory: (psram) 3040867, (internal) 41433
I [i2s] I2SDriver.cpp:47: Setting pins 0 27 26 25
I (481422) I2S: I2S0, MCLK output by GPIO0
I [esp32] I2CDriver.cpp:9: Installing I2C driver
I [i2c] I2CDriver.cpp:62: Read / Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:62: Read / Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [i2c] I2CDriver.cpp:62: Read / Write failed!
I [i2c] I2CDriver.cpp:34: Write failed!
I [http] HTTPModule.cpp:64: Posting the event
D [core] Core.cpp:113: Got event
I [http] HTTPModule.cpp:48: Responding to connection
I [http] HTTPModule.cpp:49: Status: 200
I [http] HTTPModule.cpp:50: Body: {"configSchema":{"sda":{"tooltip":"I2C - SDA","type":"number","value":"33","defaultValue":"0"},"ws":{"tooltip":"I2S - WS / LRCLK","t}

same write failed with ES8388 ai tinker board.

According to https://github.com/Ai-Thinker-Open/ESP32-A1S-AudioKit#hardware my A1S has a ES8388

rhaamo commented 2 years ago

Apparently the v2.2 can have I2C on different pins... https://github.com/Ai-Thinker-Open/ESP32-A1S-AudioKit/issues/26#issuecomment-967341319 because of two versions of the ESP32 module...

That does makes the write failed goes away, but still no audio output, wondering if I2S is routed differently, or the headphones are on a different setting than "amp" out ?

EDIT (again), tried with dac_config: model=ES8388,bck=27,ws=25,do=26,sda=33,scl=32,i2c=16 so I guess WS=25, BCK=27, MCLK=0 and DATA/DIN = 26, but no audio connected a small 8ohm speaker to L or R, no output, even with headphones jack out

rhaamo commented 2 years ago

Got the artifact from the latest master CI build (feat MA12070p driver, after that the builds fails)

Selected the board "AI-Thinker Audio board (A1S ES8388)" again and now it works ? idk what have changed between the two builds but well...

Remain things are:

feelfreelinux commented 2 years ago

Hi, thanks for trying this out! The A1S chip is honestly a mess - I was able to count 3 different versions of those chips with different DAC (AC101 or ES8388) and even different I2S pinouts. I have looked into the chip you most likely are using, and seems like it requires two extra registers (0x30 and 0x31) to have the volume written to in order to make it work. I have pushed the changes on newest master, will try to fix the build issue.

https://github.com/feelfreelinux/euphonium/commit/e26ee70af16602ae4bed48d94aca14974b988a19

Line-in support will come soon (currently planning t release along with multiroom and UI redesign). It will route all the audio from the aux in port, apply internal DSP and output on DAC.

Thanks for trying out euphonium btw! Feel free to reach out to me on @feelfreelinux:matrix.org with questions and feedback!

feelfreelinux commented 2 years ago

Build fail resolved, corrupt cache issue.

The line-in support will come around the time when im able to assemble my board with MA12070P and WM8782 ADC. All part should be easily sourceable :)

rhaamo commented 2 years ago

Ahah yes from what I have gathered in various links it's a mess, and it's even from a genuine board...

I have fetch the latest artifact and I can confirm that the headphones jack works ! But audio volume has no effect.

To plan if possible would be to be able to toggle headphones or amp output (like using both or only one of the two)

Thanks for planning line-in!

HeikoGr commented 2 years ago

The toggle could be done via GPIO_NUM_39 as far as i know (https://github.com/pschatzmann/arduino-audiokit has got it working). it's on my todo, if @feelfreelinux is not faster then me...

HeikoGr commented 2 years ago

i have an ai thinker board v2.2 3478 with ESP32-A1S v2974 Headphone Jack: working (with Volume control) LineOut: working (with Volume control)

jwktje commented 2 years ago

I have a V2.2 with v2974 but setting volume on the headphone seems to have no effect. It works fine but the volume is very low. How did you manage to get it to work @HeikoGr ?

HeikoGr commented 2 years ago

sorry for late reply. it works for me (same board) - but i compiled euphonium from the latest sources for myself. did you use a release version?

nvschilleman commented 2 years ago

i have an ai thinker board v2.2 3478 with ESP32-A1S v2974 Headphone Jack: working (with Volume control) LineOut: working (with Volume control)

Do you mind sharing your binaries? I also have a v2974 board but I do not manage to get this to work? Also, did you change DIP settings on the board?

HeikoGr commented 2 years ago

i think i haven't change the dips, its: on on on off off you don't need my binary, as feelfreelinux has published release 0.3.0 with the most recent code. i just tested it succesfully and can control the volume on lineout and headphone.

i only set the preset for the board under: "System configuration" > "Hardware" to "AI-Thinker [...] ES8388" and "apply changes"