diff --git a/README.md b/README.md index 950fa4f..3d7967c 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,8 @@ sample manipulation needed. ### Hardware +You will need an ESP32 or ESP32-S2 and an I2S DAC. We recommend using a Lyrat board. For pinout see the config options. + - ESP pinout MA12070P ------------------------------------------------------ -> I2S_BCK Audio Clock 3.072 MHz @@ -105,28 +107,67 @@ sample manipulation needed. -> NMUTE Amplifier Mute active low -## Build +## Installation Clone this repo: - - git clone https://github.com/CarlosDerSeher/snapclient +``` +git clone https://github.com/CarlosDerSeher/snapclient +cd snapclient +``` Update third party code (opus, flac and esp-dsp): +``` +git submodule update --init +``` - git submodule update --init +### ESP-IDF environnement configuration +- If you're on Windows : Install ESP-IDF v4.3.5 locally [https://github.com/espressif/esp-idf/releases/tag/v4.3.5](https://github.com/espressif/esp-idf/releases/tag/v4.3.5). More info: [https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup-update.html](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup-update.html) +- If you're on Linux : Use the docker image for ESP-IDF by following [docker build](doc/docker_build.md) doc. + +### Snapcast ESP Configuration +Configure your platform: +``` +idf.py menuconfig +``` Configure to match your setup - - Wifi network name and password - - Audio codec/board setup + - Audio HAL : Choose your audio board + - Lyrat (4.3, 4.2) + - Lyrat TD (2.2, 2.1) + - Lyrat Mini (1.1) + - KORVO DU1906 + - ESP32-S2 Kaluga (1.2) + - Or a custom board + - Custom Audio Board : Configure your DAC and GPIO + - DAC Chip : + - TI PCM51XX/TAS57XX DAC (PCM51XX are stereo DAC in TSSOP package and TAS57XX are class-D amp in HTSSOP package. Both have i2s input and i2c control) + - TI PCM5102A DAC (Very basic stereo DAC WITHOUT i2c control. Use this option if you only want i2s out like for a MAX98357) + - Infineon MA120X0 (High power class-D amp in QFN package) + - Analog Devices ADAU1961 (Stereo DAC with multiple analog inputs in LFCSP package) + - DAC I2C control interface : Choose GPIO pin of your I2C line and address of the DAC. If your DAC doesn't support I2C (PCM5102A or equivalent), put unused GPIO values. + - I2C master interface : GPIO pin of your DAC I2S bus. + - DAC interface configuration : Configure specific GPIO for your DAC functionnalities. If you use a MAX98357 with PCM5102A config, don't connect the SD pin to master mute. (PCM5102A logic is inverted) + - ESP32 DSP processor config : + - DSP flow : Choose between Stereo, Bassboost, Bi-amp or Bass/Treble EQ. You can further configure it on the ESP web interface/ + - Use asm version of Biquad_f32 : Optimized version of the DSP algorithm only for ESP32. Don't work on ESP32-S2 + - Use software volume : Handle snapcast volume in the ESP. Activate this if your DAC do not provide a volume control (no I2C like PCM5102A or MAX98357) + - WiFi Configuration : + - WiFi Provisioning : Use the Espressif "ESP SoftAP Prov" APP to configure your wifi network. + - SSID : The SSID to connect to or the provisioning SSID. + - Password : The password of your WiFi network or the provisioning netword. + - Maximum retry: Use 0 for no limit. + - Snapclient configuration : + - Use mDNS : The client will search on the network for the snapserver automatically. Your network must support mDNS. + - Snapserver host : IP or URL of the server if mDNS is disabled or the mDNS resolution fail. + - Snapserver port : Port of your snapserver, default is 1704. + - Snapclient name : The name under wich your ESP will appear on the Snapserver. + - HTTP Server Setting : The ESP create a basic webpage. You can configure the port to view this page and configure the DSP. -Use [docker](doc/docker_build.md) or local IDF installation - - idf.py menuconfig - -Build, compile and flash: - - idf.py build flash monitor +### Compile and flash +``` +idf.py build flash monitor +``` ## Test Setup a snapcast server on your network @@ -173,7 +214,7 @@ Then on every `git commit`, a few sanity/formatting checks will be performed. - [ok] Integrate ESP wifi provision - [ok] Find and connect to Avahi broadcasted Snapcast server name - [ ] Add a client command interface layer like volume/mute control -- [ ] add missing codec's (ogg, pcm, opus) +- [ ] add missing codec's (ogg) - [ok] test esp-dsp functionality after ADF drop - [ok] Check compatibility with different HW than Lyrat v4.3 - [ok] rework dsp_processor and test. At the moment only dspfStereo and dspfBassBoost will work. Also ensure/test we got enough RAM on WROVER modules @@ -181,7 +222,7 @@ Then on every `git commit`, a few sanity/formatting checks will be performed. - [ ] dsp_processor: add equalizer * Control interface for equalizer - [ ] clean and polish code (remove all unused variables etc.) -- [ ] Improve Documentation, e.g. Hardware guide (supported codecs) +- [ok] Improve Documentation, e.g. Hardware guide (supported codecs) - [ ] upgrade to IDF v5 - [ ] in IDF v5 use native i2s driver, as it supports preloading DMA buffer with valid data now - [ ] Throw out ADF copied components from project tree and use CmakeLists.txt to pull in necessary files from ADF diff --git a/doc/docker_build.md b/doc/docker_build.md index 396723f..edb65be 100644 --- a/doc/docker_build.md +++ b/doc/docker_build.md @@ -2,22 +2,50 @@ # Building in Docker ### Prerequisities -- only Docker +- Linux platform +- Docker +- Repository clone (refer to [README.md](/README.md)) -No need to install ESP-IDF or anything else. All commands should be run in a project root. +No need to install ESP-IDF or anything else. All commands should be run in project root folder. - -## menuconfig +## Configure, Build and Flash +### Start an interactive IDF environnement +In this interactive shell you can run menuconfig, build, flash and monitor command. ``` -docker run --rm -it -v .:/project -w /project espressif/idf:v4.3.1 idf.py menuconfig +docker run --rm -it -v .:/project -w /project -v /dev:/dev --privileged espressif/idf:v4.3.5 ``` -## Build +### Configure +Then in your docker interactive shell, start by configuring for your platform. More info about the config in [README.md](/README.md#config). ``` -docker run --rm -it -v .:/project -w /project espressif/idf:v4.3.1 idf.py build +idf.py menuconfig +``` +Save with `` and exit with ``. + +### Build, flash and monitor: +``` +idf.py build flash monitor +``` +If idf.py can't access to USB devices, try to restart your docker interactive shell in sudo. + +### Exit +Exit IDF monitor mode: `` + +Exit docker interactive shell: `exit` + +## Specific actions +If you want to execute a specific command or to generate a reusable .bin file. +### menuconfig +``` +docker run --rm -it -v .:/project -w /project espressif/idf:v4.3.5 idf.py menuconfig ``` -## Flash +### Build +``` +docker run --rm -it -v .:/project -w /project espressif/idf:v4.3.5 idf.py build +``` + +### Flash Mapping of serial port to container is not simple in windows but you can merge all generated `bin` files into single firmware and flash the firmware manually using some windows tool. - [ESP Tool web flasher](https://espressif.github.io/esptool-js/) - [ESP32 Flash Download tool](https://www.espressif.com/en/support/download/other-tools) @@ -42,6 +70,8 @@ docker run -it // runs interactive terminal -v .:/project // maps current directory to /project in container -w /project // sets working directory inside a container to /project + -v /dev:/dev // maps devices directory to acces USB and Serial devices inside docker + --privileged // grants docker rights to acces host devices espressif/idf:v4.3.5 // image name + version idf.py menuconfig // run menuconfig ```