I am designing an audio device that requires two CODECs to be connected to the MCU - two stereo outputs, two stereo inputs. When working with a single codec, no problems with synchronization occur since left/right and input/output DMA streams are always in sync.
But how can I connect two CODECs and use data from all of them at the same time? They are not separate in my application: say, for example, I need to mix two stereo inputs and output the sum to both stereo audio outputs. How do I make sure that DMAs and CODECs are in sync, so that when a half-full DMA transfer occurs on one of them, the other CODEC's buffer is also half-full?
I don't see how making the uC I2S slave will help - there's no guarantee that CODECs themselves are in sync, even if they receive the same MCLK from STM32. Is there some interconnection possibility I'm missing?
I do understand that F7 series have SAI which can be synced exactly for this reason, but, unfortunately, I'm stuck with STM32F4 in this project. Essentially, I need to sync two SPIs... starting them at the same time (one clock apart) may be a solution, but it sounds pretty unstable.
Will turning ONE of the I2S to slave and physically conencting the master I2S clock signals to it help?