At present, I have configured the TLV320ADC to enable only one single stereo channel (with two PDM microphones connected) and as far as I can tell (both reading back the I2C registers and looking at the waveforms), it is up and running correctly. The PDMCLK is correctly generated and I can also see PDM data.
I've used the following configuration structs to set up the I2S:
Code: Select all
#define SAMPLE_BUFFER_SIZE 512
#define SAMPLE_RATE 8000s
//#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_RIGHT_LEFT
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_RIGHT
#define I2S_MIC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_32BIT
#define I2S_MIC_FORMAT I2S_COMM_FORMAT_I2S
//#define I2S_MIC_FORMAT I2S_COMM_FORMAT_PCM
#define I2S_MIC_SERIAL_CLOCK GPIO_NUM_21
#define I2S_MIC_LEFT_RIGHT_CLOCK GPIO_NUM_25
#define I2S_MIC_SERIAL_DATA GPIO_NUM_27
// don't mess around with this
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
.sample_rate = SAMPLE_RATE,
.bits_per_sample = I2S_MIC_BITS_PER_SAMPLE,
.channel_format = I2S_MIC_CHANNEL,
.communication_format = I2S_MIC_FORMAT,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 4,
.dma_buf_len = 1024,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0
};
i2s_pin_config_t i2s_mic_pins = {
.bck_io_num = I2S_MIC_SERIAL_CLOCK,
.ws_io_num = I2S_MIC_LEFT_RIGHT_CLOCK,
.data_out_num = I2S_PIN_NO_CHANGE,
.data_in_num = I2S_MIC_SERIAL_DATA
};
void setup()
{
/* set up the I2S bus */
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
i2s_set_pin(I2S_NUM_0, &i2s_mic_pins);
//i2s_set_clk(I2S_NUM_0, 16000, I2S_BITS_PER_SAMPLE_32BIT, I2S_CHANNEL_STEREO);
}
It's a long shot and I know I've not provided much details above. Has anyone encountered anything similar either using a similar audio codec such as the TLV320ADC?
Thanks in advance.