mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
change(i2s): add warning for inaccurate sample rate
This commit is contained in:
@@ -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->bclk = rate * handle->total_slot * slot_bits;
|
||||||
clk_info->mclk = rate * clk_cfg->mclk_multiple;
|
clk_info->mclk = rate * clk_cfg->mclk_multiple;
|
||||||
clk_info->bclk_div = clk_info->mclk / clk_info->bclk;
|
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 {
|
} else {
|
||||||
/* For slave mode, mclk >= bclk * 8, so fix bclk_div to 2 first */
|
/* For slave mode, mclk >= bclk * 8, so fix bclk_div to 2 first */
|
||||||
clk_info->bclk_div = 8;
|
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;
|
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);
|
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 {
|
} else {
|
||||||
if (clk_cfg->bclk_div < 8) {
|
if (clk_cfg->bclk_div < 8) {
|
||||||
ESP_LOGW(TAG, "the current bclk division is too small, adjust the bclk division to 8");
|
ESP_LOGW(TAG, "the current bclk division is too small, adjust the bclk division to 8");
|
||||||
|
@@ -430,3 +430,7 @@
|
|||||||
-
|
-
|
||||||
re: "unplaced orphan section"
|
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)."
|
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."
|
||||||
|
Reference in New Issue
Block a user