feelfreelinux / cspot

A Spotify Connect player targeting, but not limited to embedded devices (ESP32).
Other
497 stars 46 forks source link

support for ES8388 DAC chip #98

Closed HeikoGr closed 2 years ago

HeikoGr commented 2 years ago

this pull request should add support for the (newer) ESP32-A1S AudioKIT Boards from AI Thinker, as these has the ES8388 chip as DAC instead AC101.

with little adjustments (GPIOs) it should work with ESP32 Lyrat Boards (with ES8388 chips) - but this is untestet.

You need to adjust targets/esp32/main/main.cpp in line 38 to match the new chip.

=== Sorry for any bad coding style or bad mistakes in this pull request. i never before coded in c/cpp. This PR is heavilly bases on copy/paste/test/debug

HeikoGr commented 2 years ago

i should add, that at the moment only the earphone port is supported. But i'm so glad it worked that i just wanted to submit this patch :-D

feelfreelinux commented 2 years ago

Great, will test on LyraT-4.3 :)

feelfreelinux commented 2 years ago

About that dac though - i also implemented a driver for it in my player that uses cspot. I don't have a board to test new a1s support, so i'd really appreciate if you could give it a try :) https://github.com/feelfreelinux/euphonium/releases/tag/v0.0.12

(Download the .tar.gz file, run flash_all.sh with address of the usb serial adapter. The password to the AP network is "euphonium"

HeikoGr commented 2 years ago

Wow, this is even better then cspot stand-alone. What a pity that my effort was not really necessary :-) (but it was educational and fun).

i wasn't able to get it working. But i think it's because you hard coded the i2s address 0x10 into the sources. In my cspot driver i only got it working with 0x20. Even if an i2c address scanner always said there is only a device at 0x10. I will try to recompile it and give it a second chance.

HeikoGr commented 2 years ago

i'm not able to compile it at the moment.

i think it's this warning:

../main/driver/I2SDriver.cpp:28:24: error: narrowing conversion of '(uint32_t)sampleRate' from 'uint32_t' {aka 'unsigned int'} to 'int' inside { } [-Werror=narrowing] .sample_rate = (uint32_t) sampleRate,

feelfreelinux commented 2 years ago

i'm not able to compile it at the moment.

i think it's this warning:

../main/driver/I2SDriver.cpp:28:24: error: narrowing conversion of '(uint32_t)sampleRate' from 'uint32_t' {aka 'unsigned int'} to 'int' inside { } [-Werror=narrowing] .sample_rate = (uint32_t) sampleRate,

Please compile with version 4.4 of esp-idf. Also, feel free to reach out to me on discord / telegram / matrix, I'd be willing to explain anything about euphonium. It is in super early development, so I haven't really written any docs as of now.

HeikoGr commented 2 years ago

i managed to use github workflow to compile the whole thing for me :-D now it's up and running. But still without the DAC working.

Error in console:

I [esp32] I2CDriver.cpp:7: Installing I2C driver
E [i2c] I2CDriver.cpp:40: Error writing i2c! (multiple times)
...
E (2946) I2S: mclk is too small