diff options
Diffstat (limited to 'src/lpc176x/spi.c')
-rw-r--r-- | src/lpc176x/spi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lpc176x/spi.c b/src/lpc176x/spi.c index 2e644a1e..582fa77e 100644 --- a/src/lpc176x/spi.c +++ b/src/lpc176x/spi.c @@ -1,6 +1,6 @@ // SPI support on lpc176x // -// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> +// Copyright (C) 2018-2021 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU GPLv3 license. @@ -58,7 +58,7 @@ spi_setup(uint32_t bus, uint8_t mode, uint32_t rate) // Setup clock rate and mode struct spi_config res = {spi_bus[bus].spi, 0, 0}; - uint32_t pclk = SystemCoreClock; + uint32_t pclk = get_pclock_frequency(spi_bus[bus].pclk); uint32_t div = DIV_ROUND_UP(pclk/2, rate) << 1; res.cpsr = div < 2 ? 2 : (div > 254 ? 254 : div); res.cr0 = 0x07 | ((mode & 2) << 5) | ((mode & 1) << 7); |