Skip to content

Commit a80fd4f

Browse files
fix(SPI): avoid 0 delay when SPI clock > 1MHz
Fixes stm32duino#2181. Signed-off-by: Jidong Chen <[email protected]> Co-Authored-By: Frederic Pillon <[email protected]>
1 parent 586319c commit a80fd4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/SPI/src/utility/spi_com.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static uint32_t compute_disable_delay(spi_t *obj)
214214
SPI_HandleTypeDef *handle = &(obj->handle);
215215

216216
prescaler = 1 << ((handle->Init.BaudRatePrescaler >> SPI_CFG1_MBR_Pos) + 1);
217-
disable_delay = ((prescaler * 1000000) / spi_freq) / 2;
217+
disable_delay = (((prescaler * 1000000) / spi_freq) / 2) + 1;
218218
return disable_delay;
219219
}
220220
#endif

0 commit comments

Comments
 (0)