From e366230efc8f39ca78f89e8043d60421eb6762a9 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 16 Oct 2019 01:06:17 +0700 Subject: [PATCH] use spim3, testing with 32Mhz --- libraries/SPI/SPI.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 907c1c4e..2569f0fb 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -36,8 +36,13 @@ SPIClass::SPIClass(NRF_SPI_Type *p_spi, uint8_t uc_pinMISO, uint8_t uc_pinSCK, u assert(p_spi != NULL); _p_spi = p_spi; +#ifdef NRF52840_XXAA + _spim.p_reg = NRF_SPIM3; + _spim.drv_inst_idx = NRFX_SPIM3_INST_IDX; +#else _spim.p_reg = NRF_SPIM0; _spim.drv_inst_idx = NRFX_SPIM0_INST_IDX; +#endif // pins _uc_pinMiso = g_ADigitalPinMap[uc_pinMISO]; @@ -62,7 +67,7 @@ void SPIClass::begin() .ss_active_high = false, .irq_priority = 3, .orc = 0xFF, - .frequency = NRF_SPIM_FREQ_8M, // NRF_SPIM_FREQ_4M, + .frequency = NRF_SPIM_FREQ_32M, // NRF_SPIM_FREQ_4M, .mode = NRF_SPIM_MODE_0, .bit_order = NRF_SPIM_BIT_ORDER_MSB_FIRST, };