mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-11 11:42:39 +02:00
Merge branch 'bugfix/i2s_pdm_dac_wrong_clock_freq' into 'master'
i2s_pdm: fix tx frequency limitation Closes IDFGH-9010 See merge request espressif/esp-idf!21764
This commit is contained in:
@@ -45,7 +45,7 @@ typedef struct {
|
||||
i2s_isr_callback_t on_sent; /**< Callback of data sent event, only for tx channel
|
||||
* The event data includes DMA buffer address and size that just finished sending data
|
||||
*/
|
||||
i2s_isr_callback_t on_send_q_ovf; /**< Callback of sending queue overflowed evnet, only for tx channel
|
||||
i2s_isr_callback_t on_send_q_ovf; /**< Callback of sending queue overflowed event, only for tx channel
|
||||
* The event data includes buffer size that has been overwritten
|
||||
*/
|
||||
} i2s_event_callbacks_t;
|
||||
@@ -130,7 +130,7 @@ esp_err_t i2s_channel_get_info(i2s_chan_handle_t handle, i2s_chan_info_t *chan_i
|
||||
* @brief Enable the i2s channel
|
||||
* @note Only allowed to be called when the channel state is READY, (i.e., channel has been initialized, but not started)
|
||||
* the channel will enter RUNNING state once it is enabled successfully.
|
||||
* @note Enbale the channel can start the I2S communication on hardware. It will start outputting bclk and ws signal.
|
||||
* @note Enable the channel can start the I2S communication on hardware. It will start outputting bclk and ws signal.
|
||||
* For mclk signal, it will start to output when initialization is finished
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
|
||||
@@ -89,8 +89,8 @@ typedef struct {
|
||||
* @brief I2S PDM RX mode major configuration that including clock/slot/gpio configuration
|
||||
*/
|
||||
typedef struct {
|
||||
i2s_pdm_rx_clk_config_t clk_cfg; /*!< PDM RX clock configurations, can be genertated by macro I2S_PDM_RX_CLK_DEFAULT_CONFIG */
|
||||
i2s_pdm_rx_slot_config_t slot_cfg; /*!< PDM RX slot configurations, can be genertated by macro I2S_PDM_RX_SLOT_DEFAULT_CONFIG */
|
||||
i2s_pdm_rx_clk_config_t clk_cfg; /*!< PDM RX clock configurations, can be generated by macro I2S_PDM_RX_CLK_DEFAULT_CONFIG */
|
||||
i2s_pdm_rx_slot_config_t slot_cfg; /*!< PDM RX slot configurations, can be generated by macro I2S_PDM_RX_SLOT_DEFAULT_CONFIG */
|
||||
i2s_pdm_rx_gpio_config_t gpio_cfg; /*!< PDM RX slot configurations, specified by user */
|
||||
} i2s_pdm_rx_config_t;
|
||||
|
||||
@@ -116,7 +116,7 @@ esp_err_t i2s_channel_init_pdm_rx_mode(i2s_chan_handle_t handle, const i2s_pdm_r
|
||||
* @brief Reconfigure the I2S clock for PDM RX mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to PDM RX mode, i.e., 'i2s_channel_init_pdm_rx_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to PDM RX mode, i.e., 'i2s_channel_init_pdm_rx_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S rx channel handler
|
||||
* @param[in] clk_cfg PDM RX mode clock configuration, can be generated by `I2S_PDM_RX_CLK_DEFAULT_CONFIG`
|
||||
@@ -131,7 +131,7 @@ esp_err_t i2s_channel_reconfig_pdm_rx_clock(i2s_chan_handle_t handle, const i2s_
|
||||
* @brief Reconfigure the I2S slot for PDM RX mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to PDM RX mode, i.e., 'i2s_channel_init_pdm_rx_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to PDM RX mode, i.e., 'i2s_channel_init_pdm_rx_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S rx channel handler
|
||||
* @param[in] slot_cfg PDM RX mode slot configuration, can be generated by `I2S_PDM_RX_SLOT_DEFAULT_CONFIG`
|
||||
@@ -147,7 +147,7 @@ esp_err_t i2s_channel_reconfig_pdm_rx_slot(i2s_chan_handle_t handle, const i2s_p
|
||||
* @brief Reconfigure the I2S gpio for PDM RX mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to PDM RX mode, i.e., 'i2s_channel_init_pdm_rx_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to PDM RX mode, i.e., 'i2s_channel_init_pdm_rx_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S rx channel handler
|
||||
* @param[in] gpio_cfg PDM RX mode gpio configuration, specified by user
|
||||
@@ -210,7 +210,7 @@ esp_err_t i2s_channel_reconfig_pdm_rx_gpio(i2s_chan_handle_t handle, const i2s_p
|
||||
* 2: fp = 960, fs = 480, in this case, Fpdm = 128*Fpcm = 128*sample_rate_hz
|
||||
* If the pdm receiver do not care the pdm serial clock, it's recommended set Fpdm = 128*48000.
|
||||
* Otherwise, the second configuration should be adopted.
|
||||
* @param rate sample rate
|
||||
* @param rate sample rate (not suggest to exceed 48000 Hz, otherwise more glitches and noise may appear)
|
||||
*/
|
||||
#define I2S_PDM_TX_CLK_DEFAULT_CONFIG(rate) { \
|
||||
.sample_rate_hz = rate, \
|
||||
@@ -256,7 +256,7 @@ typedef struct {
|
||||
i2s_pdm_sig_scale_t lp_scale; /*!< Low pass filter scaling value */
|
||||
i2s_pdm_sig_scale_t sinc_scale; /*!< Sinc filter scaling value */
|
||||
#if SOC_I2S_HW_VERSION_2
|
||||
i2s_pdm_tx_line_mode_t line_mode; /*!< PDM TX line mode, on-line codec, one-line dac, two-line dac mode can be selected */
|
||||
i2s_pdm_tx_line_mode_t line_mode; /*!< PDM TX line mode, one-line codec, one-line dac, two-line dac mode can be selected */
|
||||
bool hp_en; /*!< High pass filter enable */
|
||||
float hp_cut_off_freq_hz; /*!< High pass filter cut-off frequency, range 23.3Hz ~ 185Hz, see cut-off frequency sheet above */
|
||||
uint32_t sd_dither; /*!< Sigma-delta filter dither */
|
||||
@@ -269,12 +269,12 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
/* General fields */
|
||||
uint32_t sample_rate_hz; /*!< I2S sample rate */
|
||||
uint32_t sample_rate_hz; /*!< I2S sample rate, not suggest to exceed 48000 Hz, otherwise more glitches and noise may appear */
|
||||
i2s_clock_src_t clk_src; /*!< Choose clock source */
|
||||
i2s_mclk_multiple_t mclk_multiple; /*!< The multiple of mclk to the sample rate */
|
||||
/* Particular fields */
|
||||
uint32_t up_sample_fp; /*!< Up-sampling param fp */
|
||||
uint32_t up_sample_fs; /*!< Up-sampling param fs */
|
||||
uint32_t up_sample_fs; /*!< Up-sampling param fs, not allowed to be greater than 480 */
|
||||
} i2s_pdm_tx_clk_config_t;
|
||||
|
||||
/**
|
||||
@@ -297,8 +297,8 @@ typedef struct {
|
||||
* @brief I2S PDM TX mode major configuration that including clock/slot/gpio configuration
|
||||
*/
|
||||
typedef struct {
|
||||
i2s_pdm_tx_clk_config_t clk_cfg; /*!< PDM TX clock configurations, can be genertated by macro I2S_PDM_TX_CLK_DEFAULT_CONFIG */
|
||||
i2s_pdm_tx_slot_config_t slot_cfg; /*!< PDM TX slot configurations, can be genertated by macro I2S_PDM_TX_SLOT_DEFAULT_CONFIG */
|
||||
i2s_pdm_tx_clk_config_t clk_cfg; /*!< PDM TX clock configurations, can be generated by macro I2S_PDM_TX_CLK_DEFAULT_CONFIG */
|
||||
i2s_pdm_tx_slot_config_t slot_cfg; /*!< PDM TX slot configurations, can be generated by macro I2S_PDM_TX_SLOT_DEFAULT_CONFIG */
|
||||
i2s_pdm_tx_gpio_config_t gpio_cfg; /*!< PDM TX gpio configurations, specified by user */
|
||||
} i2s_pdm_tx_config_t;
|
||||
|
||||
@@ -324,7 +324,7 @@ esp_err_t i2s_channel_init_pdm_tx_mode(i2s_chan_handle_t handle, const i2s_pdm_t
|
||||
* @brief Reconfigure the I2S clock for PDM TX mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to PDM TX mode, i.e., 'i2s_channel_init_pdm_tx_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to PDM TX mode, i.e., 'i2s_channel_init_pdm_tx_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S tx channel handler
|
||||
* @param[in] clk_cfg PDM TX mode clock configuration, can be generated by `I2S_PDM_TX_CLK_DEFAULT_CONFIG`
|
||||
@@ -339,7 +339,7 @@ esp_err_t i2s_channel_reconfig_pdm_tx_clock(i2s_chan_handle_t handle, const i2s_
|
||||
* @brief Reconfigure the I2S slot for PDM TX mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to PDM TX mode, i.e., 'i2s_channel_init_pdm_tx_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to PDM TX mode, i.e., 'i2s_channel_init_pdm_tx_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S tx channel handler
|
||||
* @param[in] slot_cfg PDM TX mode slot configuration, can be generated by `I2S_PDM_TX_SLOT_DEFAULT_CONFIG`
|
||||
@@ -355,7 +355,7 @@ esp_err_t i2s_channel_reconfig_pdm_tx_slot(i2s_chan_handle_t handle, const i2s_p
|
||||
* @brief Reconfigure the I2S gpio for PDM TX mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to PDM TX mode, i.e., 'i2s_channel_init_pdm_tx_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to PDM TX mode, i.e., 'i2s_channel_init_pdm_tx_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S tx channel handler
|
||||
* @param[in] gpio_cfg PDM TX mode gpio configuration, specified by user
|
||||
|
||||
@@ -293,7 +293,7 @@ esp_err_t i2s_channel_init_std_mode(i2s_chan_handle_t handle, const i2s_std_conf
|
||||
* @brief Reconfigure the I2S clock for standard mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to standard mode, i.e., 'i2s_channel_init_std_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to standard mode, i.e., 'i2s_channel_init_std_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
* @param[in] clk_cfg Standard mode clock configuration, can be generated by `I2S_STD_CLK_DEFAULT_CONFIG`
|
||||
@@ -308,7 +308,7 @@ esp_err_t i2s_channel_reconfig_std_clock(i2s_chan_handle_t handle, const i2s_std
|
||||
* @brief Reconfigure the I2S slot for standard mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to standard mode, i.e., 'i2s_channel_init_std_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to standard mode, i.e., 'i2s_channel_init_std_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
* @param[in] slot_cfg Standard mode slot configuration, can be generated by `I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG`,
|
||||
@@ -325,7 +325,7 @@ esp_err_t i2s_channel_reconfig_std_slot(i2s_chan_handle_t handle, const i2s_std_
|
||||
* @brief Reconfigure the I2S gpio for standard mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to standard mode, i.e., 'i2s_channel_init_std_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to standard mode, i.e., 'i2s_channel_init_std_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
* @param[in] gpio_cfg Standard mode gpio configuration, specified by user
|
||||
|
||||
@@ -137,7 +137,7 @@ typedef struct {
|
||||
i2s_slot_mode_t slot_mode; /*!< Set mono or stereo mode with I2S_SLOT_MODE_MONO or I2S_SLOT_MODE_STEREO */
|
||||
|
||||
/* Particular fields */
|
||||
i2s_tdm_slot_mask_t slot_mask; /*!< Slot mask. Activating slots by setting 1 to corresponding bits. When the activated slots is not consecutive, those data in unactivated slots will be ignored */
|
||||
i2s_tdm_slot_mask_t slot_mask; /*!< Slot mask. Activating slots by setting 1 to corresponding bits. When the activated slots is not consecutive, those data in inactivated slots will be ignored */
|
||||
uint32_t ws_width; /*!< WS signal width (i.e. the number of bclk ticks that ws signal is high) */
|
||||
bool ws_pol; /*!< WS signal polarity, set true to enable high lever first */
|
||||
bool bit_shift; /*!< Set true to enable bit shift in Philips mode */
|
||||
@@ -209,7 +209,7 @@ esp_err_t i2s_channel_init_tdm_mode(i2s_chan_handle_t handle, const i2s_tdm_conf
|
||||
* @brief Reconfigure the I2S clock for TDM mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to TDM mode, i.e., 'i2s_channel_init_tdm_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to TDM mode, i.e., 'i2s_channel_init_tdm_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
* @param[in] clk_cfg Standard mode clock configuration, can be generated by `I2S_TDM_CLK_DEFAULT_CONFIG`
|
||||
@@ -224,7 +224,7 @@ esp_err_t i2s_channel_reconfig_tdm_clock(i2s_chan_handle_t handle, const i2s_tdm
|
||||
* @brief Reconfigure the I2S slot for TDM mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to TDM mode, i.e., 'i2s_channel_init_tdm_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to TDM mode, i.e., 'i2s_channel_init_tdm_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
* @param[in] slot_cfg Standard mode slot configuration, can be generated by `I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG`,
|
||||
@@ -241,7 +241,7 @@ esp_err_t i2s_channel_reconfig_tdm_slot(i2s_chan_handle_t handle, const i2s_tdm_
|
||||
* @brief Reconfigure the I2S gpio for TDM mode
|
||||
* @note Only allowed to be called when the channel state is READY, i.e., channel has been initialized, but not started
|
||||
* this function won't change the state. 'i2s_channel_disable' should be called before calling this function if i2s has started.
|
||||
* @note The input channel handle has to be initialized to TDM mode, i.e., 'i2s_channel_init_tdm_mode' has been called before reconfigring
|
||||
* @note The input channel handle has to be initialized to TDM mode, i.e., 'i2s_channel_init_tdm_mode' has been called before reconfiguring
|
||||
*
|
||||
* @param[in] handle I2S channel handler
|
||||
* @param[in] gpio_cfg Standard mode gpio configuration, specified by user
|
||||
|
||||
Reference in New Issue
Block a user