Skip to content

SPI disable deleay is zero when SPI clock > 1MHz #2181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jchen-dawnscene opened this issue Nov 13, 2023 · 0 comments · Fixed by #2182
Closed

SPI disable deleay is zero when SPI clock > 1MHz #2181

jchen-dawnscene opened this issue Nov 13, 2023 · 0 comments · Fixed by #2182
Labels
fix 🩹 Bug fix
Milestone

Comments

@jchen-dawnscene
Copy link
Contributor

It is related to:
#1294

Although the issue above is fixed by pull request #1506, there is a small glitch.
In spi_com.c, compute_disable_delay(), spi disable delay is calculated by:

disable_delay = ((prescaler * 1000000) / spi_freq) / 2;

if the spi clock > 1MHz, i.e. spi_freq / prescaler > 1000000, disable_delay is 0, which actually make this fix invalid.

The solution shall be:

disable_delay = ((prescaler * 1000000) / spi_freq) / 2 + 1;

It was tested to work on our environment.

@fpistm fpistm added this to the 2.7.0 milestone Nov 13, 2023
@fpistm fpistm added the fix 🩹 Bug fix label Nov 13, 2023
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Nov 13, 2023
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Nov 13, 2023
Fixes stm32duino#2181.

Signed-off-by: Jidong Chen <[email protected]>
Co-Authored-By: Frederic Pillon <[email protected]>
fpistm added a commit that referenced this issue Nov 14, 2023
Fixes #2181.

Signed-off-by: Jidong Chen <[email protected]>
Co-Authored-By: Frederic Pillon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
Development

Successfully merging a pull request may close this issue.

2 participants