From bdb2c827144cb5f795b570f67c0882777e8733a3 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 18 Oct 2019 12:03:42 +0700 Subject: [PATCH] use high drive H0H1 for SCK and MOSI for better performance at highspeed 32Mhz --- libraries/SPI/SPI.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 7b15d492..83aa63b1 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -97,6 +97,21 @@ void SPIClass::begin() // blocking nrfx_spim_init(&_spim, &cfg, NULL, NULL); + + // highspeed SPIM should set SCK and MOSI to high drive + nrf_gpio_cfg(_uc_pinSCK, + NRF_GPIO_PIN_DIR_OUTPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_H0H1, + NRF_GPIO_PIN_NOSENSE); + + nrf_gpio_cfg(_uc_pinMosi, + NRF_GPIO_PIN_DIR_OUTPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_H0H1, + NRF_GPIO_PIN_NOSENSE); } void SPIClass::end()