However, the incoming samples do not seem fall into their respective L/R channel - they appear the same regardless whether the mic is configured as L or R.
The data should be sampled on rising and falling edge of clock, and treated as two separate PDM streams. It rather looks as if the data was only sampled once and decimated into one channel.
Is stereo currently supported / will it be? My config looks like this:
Code: Select all
i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM,
.sample_rate = 48000,
.bits_per_sample = 16,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = I2S_COMM_FORMAT_PCM,
.dma_buf_count = 2,
.dma_buf_len = 8,
.use_apll = 0,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1
};
pin_config = {
.ws_io_num = 4, //PDM clock
.data_in_num = 2, //PDM data
};
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
i2s_set_pin(I2S_NUM_0, &pin_config);
In i2s.h there are also constants PDM_SAMPLE_RATE_RATIO_64 and PDM_SAMPLE_RATE_RATIO_128 that might be relevant but are not used anywhere else in the framework.