In my application, I'd like to use two codecs ES8311, but I cannot initialize both I2S channels, only one of them. And I cannot initialize USB stack with I2S channel initiated.
I2S initialize code:
Code: Select all
#define TRANSCEIVER_I2S_NUM (0)
#define HEADPHONES_I2S_NUM (1)
...
static esp_err_t transceiver_i2s_driver_init(void)
{
i2s_chan_config_t chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG((i2s_port_t)TRANSCEIVER_I2S_NUM, I2S_ROLE_MASTER);
chan_cfg.auto_clear = true; // Auto clear the legacy data in the DMA buffer
ESP_ERROR_CHECK(i2s_new_channel(&chan_cfg, &transceiver_tx_handle, &transceiver_rx_handle));
i2s_std_config_t std_cfg = {
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(EXAMPLE_SAMPLE_RATE),
.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO),
.gpio_cfg = {
.mclk = (gpio_num_t)CONFIG_TRANSCEIVER_I2S_MCK,
.bclk = (gpio_num_t)CONFIG_TRANSCEIVER_I2S_BCK,
.ws = (gpio_num_t)CONFIG_TRANSCEIVER_I2S_WS,
.dout = (gpio_num_t)CONFIG_TRANSCEIVER_I2S_DOUT,
.din = (gpio_num_t)CONFIG_TRANSCEIVER_I2S_DIN,
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = false,
},
},
};
std_cfg.clk_cfg.mclk_multiple = (i2s_mclk_multiple_t)EXAMPLE_MCLK_MULTIPLE;
ESP_ERROR_CHECK(i2s_channel_init_std_mode(transceiver_tx_handle, &std_cfg));
ESP_ERROR_CHECK(i2s_channel_init_std_mode(transceiver_rx_handle, &std_cfg));
ESP_ERROR_CHECK(i2s_channel_enable(transceiver_tx_handle));
ESP_ERROR_CHECK(i2s_channel_enable(transceiver_rx_handle));
return ESP_OK;
}
static esp_err_t headphones_i2s_driver_init(void)
{
i2s_chan_config_t chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG((i2s_port_t)HEADPHONES_I2S_NUM, I2S_ROLE_MASTER);
chan_cfg.auto_clear = true; // Auto clear the legacy data in the DMA buffer
ESP_ERROR_CHECK(i2s_new_channel(&chan_cfg, &headphones_tx_handle, &headphones_rx_handle));
i2s_std_config_t std_cfg = {
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(EXAMPLE_SAMPLE_RATE),
.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO),
.gpio_cfg = {
.mclk = (gpio_num_t)CONFIG_HEADPHONES_I2S_MCK,
.bclk = (gpio_num_t)CONFIG_HEADPHONES_I2S_BCK,
.ws = (gpio_num_t)CONFIG_HEADPHONES_I2S_WS,
.dout = (gpio_num_t)CONFIG_HEADPHONES_I2S_DOUT,
.din = (gpio_num_t)CONFIG_HEADPHONES_I2S_DIN,
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = false,
},
},
};
std_cfg.clk_cfg.mclk_multiple = (i2s_mclk_multiple_t)EXAMPLE_MCLK_MULTIPLE;
ESP_ERROR_CHECK(i2s_channel_init_std_mode(headphones_tx_handle, &std_cfg));
ESP_ERROR_CHECK(i2s_channel_init_std_mode(headphones_rx_handle, &std_cfg));
ESP_ERROR_CHECK(i2s_channel_enable(headphones_tx_handle));
ESP_ERROR_CHECK(i2s_channel_enable(headphones_rx_handle));
return ESP_OK;
}
Code: Select all
E (1730) gdma: gdma_install_tx_interrupt(800): alloc interrupt failed
E (1730) gdma: gdma_register_tx_event_callbacks(399): install interrupt service failed
E (1730) gdma: gdma_install_rx_interrupt(773): alloc interrupt failed
E (1740) gdma: gdma_register_rx_event_callbacks(435): install interrupt service failed
Could you please help me with the problem, especially with DMA channels select