mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
change(i2s): add warning for inaccurate sample rate
This commit is contained in:
parent
fe80989a17
commit
462698f2de
@ -39,6 +39,9 @@ static esp_err_t i2s_std_calculate_clock(i2s_chan_handle_t handle, const i2s_std
|
||||
clk_info->bclk = rate * handle->total_slot * slot_bits;
|
||||
clk_info->mclk = rate * clk_cfg->mclk_multiple;
|
||||
clk_info->bclk_div = clk_info->mclk / clk_info->bclk;
|
||||
if (clk_info->mclk % clk_info->bclk != 0) {
|
||||
ESP_LOGW(TAG, "the current mclk multiple cannot perform integer division (slot_num: %"PRIu32", slot_bits: %"PRIu32")", handle->total_slot, slot_bits);
|
||||
}
|
||||
} else {
|
||||
/* For slave mode, mclk >= bclk * 8, so fix bclk_div to 2 first */
|
||||
clk_info->bclk_div = 8;
|
||||
|
@ -46,6 +46,9 @@ static esp_err_t i2s_tdm_calculate_clock(i2s_chan_handle_t handle, const i2s_tdm
|
||||
clk_info->mclk = clk_info->bclk * clk_info->bclk_div;
|
||||
ESP_LOGW(TAG, "the current mclk multiple is too small, adjust the mclk multiple to %"PRIu32, clk_info->mclk / rate);
|
||||
}
|
||||
if (clk_info->mclk % clk_info->bclk != 0) {
|
||||
ESP_LOGW(TAG, "the current mclk multiple cannot perform integer division (slot_num: %"PRIu32", slot_bits: %"PRIu32")", handle->total_slot, slot_bits);
|
||||
}
|
||||
} else {
|
||||
if (clk_cfg->bclk_div < 8) {
|
||||
ESP_LOGW(TAG, "the current bclk division is too small, adjust the bclk division to 8");
|
||||
|
@ -435,3 +435,7 @@
|
||||
-
|
||||
re: "unplaced orphan section"
|
||||
hint: "Avoid creating custom sections. Please refer to the 'Linker Script Generation' article in the IDF documentation to address this. Or set option CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE (not recommended)."
|
||||
|
||||
-
|
||||
re: "the current mclk multiple cannot perform integer division"
|
||||
hint: "Please adjust the mclk multiple to get the accurate sample rate.\nFor example, if you're using 24-bit slot width or enabled 3 slots, then the mclk multiple should be a multiple of 3, otherwise the sample rate will be inaccurate."
|
||||
|
Loading…
Reference in New Issue
Block a user