Merge branch 'bugfix/i2s_write_failed_in_32bit_slave_mode_v4.2' into 'release/v4.2'

i2s: fix write failure issue in slave mode (backport v4.2)

See merge request espressif/esp-idf!15082
This commit is contained in:
morris 2022-03-09 19:10:56 +08:00
commit cc518c3d05

View File

@ -318,6 +318,14 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b
return ESP_ERR_INVALID_ARG;
}
p_i2s_obj[i2s_num]->sample_rate = rate;
/**
* Due to hardware issue, bck division on ESP32/ESP32-S2 should be greater than 8 in slave mode
* So the factor need to be an appropriate value
*/
if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE)) {
factor = 16 * bits;
}
double clkmdiv = (double)I2S_BASE_CLK / (rate * factor);
if (clkmdiv > 256) {