From a80fd4fcb6cf5a7fd658aa5f2af1705a911444f4 Mon Sep 17 00:00:00 2001 From: Jidong Chen <123861172+jchen-dawnscene@users.noreply.github.com> Date: Mon, 13 Nov 2023 09:07:17 +0100 Subject: [PATCH] fix(SPI): avoid 0 delay when SPI clock > 1MHz Fixes #2181. Signed-off-by: Jidong Chen <123861172+jchen-dawnscene@users.noreply.github.com> Co-Authored-By: Frederic Pillon --- libraries/SPI/src/utility/spi_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SPI/src/utility/spi_com.c b/libraries/SPI/src/utility/spi_com.c index a67813e6b7..2cc6c28907 100644 --- a/libraries/SPI/src/utility/spi_com.c +++ b/libraries/SPI/src/utility/spi_com.c @@ -214,7 +214,7 @@ static uint32_t compute_disable_delay(spi_t *obj) SPI_HandleTypeDef *handle = &(obj->handle); prescaler = 1 << ((handle->Init.BaudRatePrescaler >> SPI_CFG1_MBR_Pos) + 1); - disable_delay = ((prescaler * 1000000) / spi_freq) / 2; + disable_delay = (((prescaler * 1000000) / spi_freq) / 2) + 1; return disable_delay; } #endif pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy