Running on an RP2350, 2 separate I2S engines, one output and one input
#include <I2S.h>
I2S i2s(OUTPUT);
I2S i2sIn(INPUT);
...
#define pBCLK 17
#define pDOUT 16
#define INBCLK 11
#define INDOUT 10
const int sampleRate = 44100;
... in Setup:
i2s.setBCLK(pBCLK);
i2s.setDATA(pDOUT);
i2s.setBitsPerSample(32);
i2s.setBuffers(4, 64); //number of buffers, size of each buffer.
i2s.begin(sampleRate);
i2sIn.setBCLK(INBCLK);
i2sIn.setDATA(INDOUT);
i2sIn.setBitsPerSample(32);
i2sIn.setBuffers(4, 64); //number of buffers, size of each buffer.
2sIn.begin(sampleRate);
This setup synchronizes LRCK edges to falling edges of BCK for the output I2S, but rising edges of BCK for the input I2S. Behavior is very robust, and doesn't seem to depend on BitsPerSample or buffer size.
Is this expected behavior? Some ADCs (PCM1808, PCM1820) expect LRCK to change on the falling edge of BCK. For the PCM1808, changing LRCK between 50nsec before and 10nsec after the rising edge of BCK can cause trouble.