I have an out-of-warranty wifi speaker (Sns Play 5 Gen 1) that is bricked. I would like to use it as a sound card to play audio from a Teensy, using the Teensy Audio Library (GitHub - PaulStoffregen/Audio: Teensy Audio Library)
My question is:
Which I2S parameters (bits per sample, clock frequencies, etc) are configurable in the Teensy Audio Library and how do I set them? They seem to be hidden in the hardware specific audio objects like SGTL5000 etc.
The speaker uses the CS44800-CQZ chip that takes an incoming digital audio stream and sends sound to the amps and speaker elements. The following pins of the chip are accessible on a connector on the board inside the speaker: SCLK/MCLK, LRCK and SDIN1. They should be enough to send I2S audio in, right?
Datasheet: https://media.digikey.com/pdf/Data%20Sheets/Cirrus%20Logic%20PDFs/CS44800.pdf
So far I have been able to read and write to the configuration registers of the CS44800-CQZ chip through its I2C interface.
Which Teensy? I'm only familiar with the workings of I2S on T3.2 - T3.6. You can find the I2S capabilities by reading the datasheet for the particular processor. They are linked on the PJRC website.
Take a look at the .h and .cpp files for output_i2s class to see how to set up the I2S interface.
Thanks for the reply @gfvalvo.
Yes, it looks like one should modify the #define MCLK_MULT
and #define MCLK_DIV
statements in output_i2s.cpp to change clock signal speed. I couldn't find where to modify the bits per sample parameter though. Maybe it is hard-coded?
I have a bunch of Teensy-LCs on hand - which according to processor datasheets have same i2s capacity as T3.2 - but never pass up a chance to buy more hw 
I realized too late that this question would have been better to ask in the Teensy Audio forum, apologies for that.
My guess is that you don't have to change anything. Configure the CS44800 (over I2C) per Figure 17 in its datasheet. This is the exact format used by output_i2s class. Done. No need to make things more difficult / complex than necessary.
Thanks! Sounds great! Configuring the CS44800 for I2S is already done 
Furthermore, I found a T3.2 in an old project. Will try it out tonight!
Yes, I was able to get it to work with the standard teensy audio library. Had to write a new device class to do the configuration of CS44800 registers over I2C. Do you think that would be of interest to someone else?
1 Like
plengqui:
Do you think that would be of interest to someone else?
More likely to be of interest on the Teensy Audio forum.