Skip to content

STM32 I2S Driver Clock Configuration #77480

Closed Answered by marwaiehm-st
rriveramcrus asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rriveramcrus ,

You are right, the code in the function i2s_ll_stm32.c handles only multiple clock sources. In the case of a single clock source, the freq_in remains 0. Therefore, we should handle both cases where pclk_len is greater than 1 and where it is not, ensuring that the freq_in variable is correctly set:

static int i2s_stm32_set_clock(const struct device *dev,
			       uint32_t bit_clk_freq)
{
	const struct i2s_stm32_cfg *cfg = dev->config;
	uint32_t freq_in = 0U;
	uint8_t i2s_div, i2s_odd;

	if (cfg->pclk_len > 1) {
		// Handle multiple clock sources
		if (clock_control_get_rate(DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE),
					   (clock_control_subsys_t)&cfg->pclken[1],
					   &

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@rriveramcrus
Comment options

rriveramcrus Aug 27, 2024
Collaborator Author

@marwaiehm-st
Comment options

Answer selected by rriveramcrus
Comment options

rriveramcrus
Aug 28, 2024
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants