CHanging SPI Speed on the NORA-W306

I’m having difficulty changing the SPI port speed on my NORA-W306 - it’s interfaced with an ST7735 TFT display. I can’t get the SPI clock to run faster than ~175KHz (so the display is updating slowly) - is there some reason I can’t get it to run faster? I’m using the SPISettings command trying to set it to max speed.

OK. More information. I was using a software SPI port. I have switched to a hardware and things are much faster. Makes sense that the software SPI would run significantly slower. Leaving this up here in case someone runs into the same issue.

Excellent! I was going to suggest that, and maybe try an alternative library if you still need more:

Replace the Adafruit library with TFT_eSPI, which offers better performance and DMA support:

#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
1 Like

Quick follow up - it looks like all the SPI calls default to SPI0. How to I use SPI1 for my TFT interface?

Here’s how you would typically set up SPI1 on the Nordic nRF platform:

  1. If you’re using the Arduino framework with Nordic boards:
#include <SPI.h>

// Create an SPI instance for SPI1
SPIClass SPI1(NRF_SPIM1); // Use the SPIM1 peripheral

// Define your pins (adjust as needed for your specific pinout)
#define TFT_SCLK  PIN_SPI1_SCK    // SPI clock pin
#define TFT_MOSI  PIN_SPI1_MOSI   // SPI MOSI pin
#define TFT_MISO  PIN_SPI1_MISO   // SPI MISO pin
#define TFT_CS    PIN_SPI1_SS     // Chip select pin
#define TFT_DC    PIN_D3          // Data/Command pin
#define TFT_RST   PIN_D5          // Reset pin

void setup() {
  // Initialize SPI1
  SPI1.begin();
  
  // Set up your ST7735 display using SPI1
  // The syntax depends on your library
}
  1. If you’re using the Nordic SDK directly, you would use the SPIM1 peripheral:
// Configure SPI1
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.sck_pin = SPIM1_SCK_PIN;
spi_config.mosi_pin = SPIM1_MOSI_PIN;
spi_config.miso_pin = SPIM1_MISO_PIN;
spi_config.ss_pin = SPIM1_SS_PIN;
spi_config.frequency = NRF_DRV_SPI_FREQ_8M; // Try higher frequency
spi_config.mode = NRF_DRV_SPI_MODE_0;
spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;

// Initialize SPI
APP_ERROR_CHECK(nrf_drv_spi_init(&spi1, &spi_config, spi_event_handler, NULL));