zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.34k stars 6.33k forks source link

NRFX I2S Driver Bug -- division by zero #70316

Closed pauleffect90 closed 1 month ago

pauleffect90 commented 5 months ago

The NRF53 I2S driver fails with "division by zero" when user selects a 48Khz sampling frequency and an ACLK value of 11.2896. I haven't really researched the exact line, because I bypass clock division entirely, but the offending function is [find_suitable_clock]. Found it by mistake - obviously can't divide that 11.2896 by 48000, but there could be other combinations that yield similar results.

To reproduce, simply change the sampling frequency to 48000 in the i2s sample and run it. The pdm peripheral uses a similar function, it's probably affected too.

(https://github.com/zephyrproject-rtos/zephyr/blob/20f747bb630b4ce9e84d5e3e7f525df19f33cc43/drivers/i2s/i2s_nrfx.c#L62)

github-actions[bot] commented 5 months ago

Hi @pauleffect90! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

github-actions[bot] commented 3 months ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.