Skip to content

Commit

Permalink
fix(SPI): avoid 0 delay when SPI clock > 1MHz
Browse files Browse the repository at this point in the history
Fixes #2181.

Signed-off-by: Jidong Chen <[email protected]>
Co-Authored-By: Frederic Pillon <[email protected]>
  • Loading branch information
jchen-dawnscene and fpistm committed Nov 14, 2023
1 parent 586319c commit 462c518
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/SPI/src/utility/spi_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 462c518

Please sign in to comment.