ILI9341 with Arduino Nano 33 BLE

Hi,

I'm using the ILI9341 display with Arduino Nano 33 BLE. After playing with a couple of libraries Adafruit_ILI9341 and UTouch libraries seems to compile. However, the display is really really slow. The nano BLE board uses nRF52840, which has SPI speed up to 32MHz. How can I improve the refresh rate of the display? Here's the code I'm currently using.

//Adafruit and SPI libraries
#include "SPI.h"
#include "UTouch.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
//Pins
#define TFT_DC 10
#define TFT_CS 12
#define TFT_MOSI 9
#define TFT_CLK 8
#define TFT_RST 11
#define TFT_MISO 7
//Create ILI9341 instance
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

#define ts_sck  4
#define ts_cs   3
#define ts_mosi 2
#define ts_miso A6
#define ts_irq  A7
UTouch ts(ts_sck, ts_cs, ts_mosi, ts_miso, ts_irq);

void setup(){

  tft.begin();
  tft.setRotation(-1);  
  tft.fillScreen(ILI9341_YELLOW);
  

  ts.InitTouch();
  ts.setPrecision(PREC_HI);
  tft.setTextColor(ILI9341_BLACK);
  tft.setTextSize(3);
  tft.setCursor(80,15);
  tft.print("Test Touch ");
  
  tft.setTextColor(ILI9341_RED);
  tft.setTextSize(2);
  tft.setCursor(20,220);
  tft.print("test");
}
 
void loop()
{
  long x, y;
  
  while(ts.dataAvailable())
  {
    ts.read();
    x = ts.getX();//+15
    y = ts.getY();//+5
    if((x!=-1) && (y!=-1))
    {
      int radius = 3;
      tft.fillCircle(x, y, radius, ILI9341_BLACK);
    }
  }
}

The 33_BLE pins_arduino.h file says:

// SPI
#define PIN_SPI_MISO  (12u)
#define PIN_SPI_MOSI  (11u)
#define PIN_SPI_SCK   (13u)
#define PIN_SPI_SS    (10u)

So I would re-wire your screen to use these hardware pins.

Then verify your wiring with the bit-bang constructor

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

Then test with the hardware SPI constructor:

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

I would definitely not use 12 for TFT_RST

This should make a dramatic improvement to the TFT speed.

I don't have Nano BLE or Nano IOT boards. I have just typed from the documentation.

Note that the XPT2046 could be put on the hardware SPI bus if you use XPT2046_Touchscreen.h library.

David.