reported from github: https://github.com/espressif/esp-idf/issues/1119
Digital team think it is due to the decimal divider.
We can reset the i2s tx and rx when calling i2s_stop to avoid this.
i2s_stop(i2s_num);
+
uint32_t cur_mode = 0;
if (p_i2s_obj[i2s_num]->channel_num != ch) {
p_i2s_obj[i2s_num]->channel_num = (ch == 2) ? 2 : 1;
I2S[i2s_num]->lc_conf.in_rst = 0;
I2S[i2s_num]->lc_conf.out_rst = 1;
I2S[i2s_num]->lc_conf.out_rst = 0;
+
+ I2S[i2s_num]->conf.tx_reset = 1;
+ I2S[i2s_num]->conf.tx_reset = 0;
+ I2S[i2s_num]->conf.rx_reset = 1;
+ I2S[i2s_num]->conf.rx_reset = 0;
I2S_EXIT_CRITICAL();
return 0;
}