I figured that a way to do it is to write in blocks of 512 bytes using i2s_write(). However I am getting
Code: Select all
E (283) I2S: Invalid bits per sample
Code: Select all
ret = i2s_driver_install(0, &i2s_config, 0, NULL);
Code: Select all
static const i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
//.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
.sample_rate = 8000,
.bits_per_sample = 8,
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
.intr_alloc_flags = 0, // default interrupt priority
.dma_buf_count = 4,
.dma_buf_len = 512/4/8,
.use_apll = false
//.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1
};
I'm assuming that dma_buf_count is a more-or-less arbitrary number, and that the dma_buf_len multiplied by dma_buf_count must equal some other number.