Audiopants, part 2!

The NXP SGTL5000 Returneth

So last time I used a couple I2S dac/amp breakouts but things weren't quite like I wanted, I had some experience with the NXP SGTL5000 from my work on the lobstereo, and having an extra Teensy Audio Board I decided to protoboard up connections and try again. One of the reasons I decided to use it was the cap-less headphone output! This means there's a dedicated vground pin which is the headphone common connection, providing for very easy routing to headphones. The one big difference is that the SGTL5000 needs an I2C connection as well as the I2S. For this codec I2C is used to set up and configure parameters such as power management to audio equalizing, volume control etc. Now I'm not a programmer by any means, I usually learn as I hack together various libraries and with enough context clues I can make something work. With this in mind I had searched to see if there were any drivers I could use as an example and actually found a driver written specifically for this chip and the esp32-idf! The license was free use for non commercial uses and ask the authors if there's any plans for commercial usage, which works just fine for this use case.

Protoboard time:

I got myself some supplies together, and still having a teensy audio board from my lobstereo project whipped up a weird bulky protoboard adapter to connect the proper pins from the ESP32-Thing to the Audio board.

Firmware time:

I managed to hack together the codec driver into the esp-idf a2dp sink example. This required a lot more tinkering with the code to get to work, there was a lot of frustration but with it progress and learning! For the oddities of adapting the esp32, pin0 had to be used for a clock out on the esp32, this would provide the master clock for the I2S protocol, as I understand the mclk is not a part of the base standard but needed by some chips for timing. On the esp32 this clock signal is only able to be generated on 2-3 of pins and pin 0 would be the easiest to use. 

audiobit.h component pin settings
audiobit.h Pin Settings chosen

After a while of Tweaking and pin selection these seemed to work the best and I managed to get it to connect! There was some initial weirdness with connections and disconnection but It was enough progress for me to move to PHASE 3: The PCBENING!

Part 1, Part 2, Part 3