diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2021-03-25 08:59:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-25 08:59:21 -0700 |
| commit | e9ceb9263e4939920678921c95d595cf5444d29a (patch) | |
| tree | 061637bb9249903d7fd48a68f51ec160b47b1568 | |
| parent | 7831be5a55baeecb98779fb1c9b62a014f89bdf4 (diff) | |
| parent | b440883fe55666d12f94a6d48513a1a68d218bc4 (diff) | |
Merge pull request #4474 from jepler/fix-spi-frequency
mimxrt: SPI: Set the TCR value returned by MasterBaudSetRate
| -rw-r--r-- | ports/mimxrt10xx/common-hal/busio/SPI.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index 3488ac0fb..1b72921d3 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -187,6 +187,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, LPSPI_Enable(self->spi, false); uint32_t tcrPrescaleValue; self->baudrate = LPSPI_MasterSetBaudRate(self->spi, config.baudRate, LPSPI_MASTER_CLK_FREQ, &tcrPrescaleValue); + self->spi->TCR = (self->spi->TCR & ~LPSPI_TCR_PRESCALE_MASK) | LPSPI_TCR_PRESCALE(tcrPrescaleValue); LPSPI_Enable(self->spi, true); claim_pin(self->clock->pin); @@ -236,6 +237,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, LPSPI_Enable(self->spi, false); uint32_t tcrPrescaleValue; self->baudrate = LPSPI_MasterSetBaudRate(self->spi, baudrate, LPSPI_MASTER_CLK_FREQ, &tcrPrescaleValue); + self->spi->TCR = (self->spi->TCR & ~LPSPI_TCR_PRESCALE_MASK) | LPSPI_TCR_PRESCALE(tcrPrescaleValue); LPSPI_Enable(self->spi, true); if ((polarity == common_hal_busio_spi_get_polarity(self)) && |
