Skip to content

Commit 459a078

Browse files
dlim04kartben
authored andcommitted
drivers: spi: cc13xx_cc26xx: Allow clocks below 2 MHz
Remove unnecessary check that the SPI clock is being set to a frequency above 2 MHz to allow devices running at common lower frequencies (i.e. 1.2 MHz and 400 kHz). Replace with check that the frequency is not below the minimum frequency supported by the chipset to prevent overflow error which can occur if the HAL sets a frequency too low resulting in a SPI clock much larger than expected. Fixes #69986 Signed-off-by: David Lim <[email protected]>
1 parent 0448f4b commit 459a078

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/spi/spi_cc13xx_cc26xx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ static int spi_cc13xx_cc26xx_configure(const struct device *dev,
8181
return -EINVAL;
8282
}
8383

84-
if (config->frequency < 2000000) {
85-
LOG_ERR("Frequencies lower than 2 MHz are not supported");
84+
if (config->frequency < CPU_FREQ / (254 * (255 + 1))) {
85+
LOG_ERR("Frequencies lower than %d Hz are not supported",
86+
CPU_FREQ / (254 * (255 + 1)));
8687
return -EINVAL;
8788
}
8889

0 commit comments

Comments
 (0)