I’ve got a Particle P1 device that I’m trying to get sounds playing on using an external amplifier.
The chip I’m using for the amplifier is the MAX98357A, which uses the I2S standard for operation.
I’ve currently got the amp connected to the SPI1 enabled pins, and I’m having some trouble figuring out how to reliably play sounds through the device.
My pinout is as follows:
Amp connection - Particle P1
Mode select (SD_MODE) - P1S4
Data Clock (BCLK) - D4 (SPI1 SCK)
Left/Right channel clock (LRCLK) - D5 (SPI1 SS)
Data in (DIN) - D2 (SPI1 MOSI)
One problem is that the amp requires a second clock for Left/Right channel selection, which operates a 1/16th of the Data clock, and I can’t seem to find a way to reliably set a secondary clock for for SPI1.
Also to be considered is that the RAM can barely hold a quarter of a second of audio at CD quality, but I’m just looking to play simple sounds, and I can reliably load content from an SD card attached to the device (which is on SPI0), so I can theoretically do some kind of multiple buffering trickery with RAM.
I was wondering if anyone had worked out any previous I2S implementations or done any work regarding playing sound out of the device that is ideally not too processor heavy (so ideally through DMA, interrupts are too processor intensive and the device is doing other things).
I’ve taken a look through the forums already and haven’t found anything applicable.
I’m also fine to not use that external amplifier or changing my approach if there’s an easier solution that I’m just missing completely.
Any help would be appreciated.