Hello Everyone!
My intention:
I got an I²S DAC amp lying around, namely this module:
An 8-channel digital audio processor from a home cinema system.
I would like to know if it’s possible to use the arduino to generate an I²S signal. The audio data signal sent out by the arduino would be a simple sinus, generated with a simple programmed counter.
Information:
On I²S protocol:
On name confusion:
WS (word select) = LRCLK(Left-Right Clock) = select the right or left channel (stereo)
BCLK (bit clock) = SCLK (shift clock) is not the MCLK (master clock)!
On the serial data:
Serial data is made by the two’s complement protocol.
Below a picture of 4 bits data generating an audio wave:
In reality we use 16 bits of data.
Example I would like to try with arduino:
LRCLK = 32 kHz (lowest my module will take)
MCLK = 8.192 MHz (256LRCLK) → I know the max an arduino can generate is 8MHz right?
SCLK = 2.048 MHz (= 64 fs (64LRCLK))
Resolution of the serial data (produced by arduino by simple bitcounter): 16 bits
Questions in short:
- is the arduino able to output an 8 MHz master clock output on the SPI SCLK output (with SPI_CLOCK_DIV2 )? I got an arduino Mega with the atmega2560.
- the other I²S clocks (LRCLK/SCLK) need to be synchronized to the MCLK in the I²s protocol (which in this case would be the SPI SCLK clock from the arduino). Is this so internally in the atmega if I use different digital PWM outputs for the different clocks? Or could I use pins from the SPI interface and configure them to act like the I²S protocol?
- The arduino also needs to output I²C commands to control the module (volume, power down, mute, …). Is not to demanding using as well I²C and the SPI clock + shifting out 16 bit data with a bitcounter?
So really what i’m asking is an arduino up to this? Or am I short in computing power and do I need to buy myself a raspberry PI?
My common sense says it’s not possible, but everything is (just) within the specs of an arduino right?